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 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"); diff --git a/travis-ci.sh b/travis-ci.sh index 2fb75ba..83bbb4a 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 @@ -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