From 415fc984ced76ecd85da7633a34a1c247865452f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Wed, 25 Nov 2020 23:48:29 +0100 Subject: [PATCH 1/4] Add GitHub actions based CI recipe. --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..393d4c4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: Test Suite + +# Only triggers on pushes/PRs to master +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + name: CI + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + dc: [dmd-latest, ldc-latest] + arch: [x86_64] + config: [select, epoll, cfrunloop, winapi] + exclude: + - {os: ubuntu-latest, config: cfrunloop} + - {os: ubuntu-latest, config: winapi} + - {os: macOS-latest, config: epoll} + - {os: macOS-latest, config: winapi} + - {os: windows-latest, config: cfrunloop} + - {os: windows-latest, config: epoll} + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + + - name: Install D compiler + uses: dlang-community/setup-dlang@v1 + with: + compiler: ${{ matrix.dc }} + + - name: Run tests + env: + CONFIG: ${{matrix.config}} + shell: bash + run: ./travis-ci.sh From 3ab928398614d09979666520778cc4243fe23cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 26 Nov 2020 08:27:20 +0100 Subject: [PATCH 2/4] Avoid unsupported build configuration on Windows. --- travis-ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis-ci.sh b/travis-ci.sh index 2fb75ba..7045c09 100755 --- a/travis-ci.sh +++ b/travis-ci.sh @@ -6,8 +6,8 @@ set -e -x -o pipefail dub build -b release --compiler=$DC -c $CONFIG # test for successful 32-bit build -if [ "$DC" == "dmd" ]; then - dub build --arch=x86 -c $CONFIG +if [ "$DC" == "ldc2" ]; then + dub build --arch=x86 --compiler=ldc2 -c $CONFIG fi dub test --compiler=$DC -c $CONFIG From 494a835adc780fb28a7a9ef85ac3bf9e661a8c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 26 Nov 2020 08:31:46 +0100 Subject: [PATCH 3/4] Fix example deletion code for Windows. --- travis-ci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/travis-ci.sh b/travis-ci.sh index 7045c09..83bbb4a 100755 --- a/travis-ci.sh +++ b/travis-ci.sh @@ -18,7 +18,8 @@ if [ ${BUILD_EXAMPLE=1} -eq 1 ]; then dub build --compiler=$DC --override-config eventcore/$CONFIG --single $ex done rm -rf examples/.dub/ - rm examples/*-example + rm -f examples/*-example + rm -f examples/*-example.exe fi if [ ${RUN_TEST=1} -eq 1 ]; then for ex in `\ls -1 tests/*.d`; do From 046fedd934dfdc1b3a19b9da53bf267ec66d6bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 26 Nov 2020 08:57:17 +0100 Subject: [PATCH 4/4] Fix ThreadedFileEventDriver.getSize on Windows. fstat doesn't work correctly on Windows, possibly due to a bad C header translation on Druntime. Also switches to _lseeki64/lseek64 to avoid 32-bit file length limitations on 32-bit systems. --- source/eventcore/drivers/threadedfile.d | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/eventcore/drivers/threadedfile.d b/source/eventcore/drivers/threadedfile.d index c3b9dd4..9058483 100644 --- a/source/eventcore/drivers/threadedfile.d +++ b/source/eventcore/drivers/threadedfile.d @@ -25,7 +25,7 @@ version (Windows) { int close(int fd) @safe; int read(int fd, void *buffer, uint count); int write(int fd, in void *buffer, uint count); - off_t lseek(int fd, off_t offset, int whence) @safe; + long _lseeki64(int fd, long offset, int origin) @safe; } enum O_RDONLY = 0; @@ -46,6 +46,11 @@ else enum O_BINARY = 0; } +version (darwin) { + // NOTE: Always building for 64-bit, so these are identical + alias lseek64 = lseek; +} + private { enum SEEK_SET = 0; enum SEEK_CUR = 1; @@ -197,7 +202,9 @@ final class ThreadedFileEventDriver(Events : EventDriverEvents) : EventDriverFil version (linux) { // stat_t seems to be defined wrong on linux/64 - return .lseek(cast(int)file, 0, SEEK_END); + return .lseek64(cast(int)file, 0, SEEK_END); + } else version (Windows) { + return _lseeki64(cast(int)file, 0, SEEK_END); } else { stat_t st; () @trusted { fstat(cast(int)file, &st); } (); @@ -361,9 +368,8 @@ log("start processing"); auto bytes = buffer; version (Windows) { - assert(offset <= off_t.max); - .lseek(cast(int)file, cast(off_t)offset, SEEK_SET); - } else .lseek(cast(int)file, offset, SEEK_SET); + ._lseeki64(cast(int)file, offset, SEEK_SET); + } else .lseek64(cast(int)file, offset, SEEK_SET); scope (exit) { log("trigger event");