diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7bc6fd0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Test Suite + +# Only triggers on pushes/PRs to master +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + name: CI + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + dc: [dmd-latest, ldc-latest, ldc-1.15.0] + arch: [x86, x86_64] + + 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}} + ARCH: ${{matrix.arch}} + shell: bash + run: dub test :engine + testsuite: + name: Test262 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + dc: [dmd-latest] + arch: [x86_64] + + 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}} + ARCH: ${{matrix.arch}} + shell: bash + run: ./run-test262.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2ab348e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: d -sudo: false - -script: - - ./build.sh - - ./run-test262.sh diff --git a/ds-ext/source/ext.d b/ds-ext/source/ext.d index 81ec9df..4efb1e6 100644 --- a/ds-ext/source/ext.d +++ b/ds-ext/source/ext.d @@ -2,9 +2,9 @@ import dmdscript.program; import dmdscript.script; import dmdscript.extending; +import std.file; import std.stdio; import std.typecons; -import std.stdio; int func(int a,int b){ return a*b; } diff --git a/engine/source/dmdscript/outbuffer.d b/engine/source/dmdscript/outbuffer.d index d52a810..3b26129 100644 --- a/engine/source/dmdscript/outbuffer.d +++ b/engine/source/dmdscript/outbuffer.d @@ -250,68 +250,6 @@ class OutBuffer return cast(string) data[0 .. offset].idup; } - /***************************************** - * Append output of C's vprintf() to internal buffer. - */ - - void vprintf(string format, va_list args) - { - char[128] buffer; - char* p; - uint psize; - int count; - - auto f = toStringz(format); - p = buffer.ptr; - psize = buffer.length; - for (;;) - { - version(Windows) - { - count = _vsnprintf(p,psize,f,args); - if (count != -1) - break; - psize *= 2; - p = cast(char *) alloca(psize); // buffer too small, try again with larger size - } - version(Posix) - { - count = vsnprintf(p,psize,f,args); - if (count == -1) - psize *= 2; - else if (count >= psize) - psize = count + 1; - else - break; - /+ - if (p != buffer) - c.stdlib.free(p); - p = (char *) c.stdlib.malloc(psize); // buffer too small, try again with larger size - +/ - p = cast(char *) alloca(psize); // buffer too small, try again with larger size - } - } - write(cast(ubyte[]) p[0 .. count]); - /+ - version (Posix) - { - if (p != buffer) - c.stdlib.free(p); - } - +/ - } - - /***************************************** - * Append output of C's printf() to internal buffer. - */ - - void printf(string format, ...) - { - va_list ap; - ap = cast(va_list)&format; - ap += format.sizeof; - vprintf(format, ap); - } /***************************************** * At offset index into buffer, create nbytes of space by shifting upwards @@ -349,7 +287,6 @@ unittest buf.write("hello"[]); buf.write(cast(byte)0x20); buf.write("world"[]); - buf.printf(" %d", 6); //printf("buf = '%.*s'\n", buf.toString()); - assert(cmp(buf.toString(), "hello world 6") == 0); + assert(cmp(buf.toString(), "hello world") == 0); } diff --git a/run-test262.sh b/run-test262.sh index 409fc3b..95d6866 100755 --- a/run-test262.sh +++ b/run-test262.sh @@ -1,25 +1,33 @@ #!/bin/bash -set -e +set -xe + +./build.sh if ! [ -d test262 ] ; then echo "Cloning test262 test suite..." git clone https://github.com/tc39/test262.git + cd test262 + git checkout a456b0a390bb0f70b4cb8d38cb5ab0ecb557a851 + cd .. echo "Applying patch to make the harness ES3/5 compatible..." sed 's/ let / var /g' -i test262/harness/assert.js fi if ! [ -d test262-harness-py ] ; then echo "Cloning the console test runner..." git clone https://github.com/test262-utils/test262-harness-py.git + cd test262-harness-py + git checkout 0f2acdd882c84cff43b9d60df7574a1901e2cdcd + cd .. echo "Applying patch to adjust the runner for the latest version of the test suite..." sed '/self\.suite\.GetInclude("cth\.js")/d' -i test262-harness-py/src/test262.py fi echo "Running the test suite..." cd test262-harness-py -src/test262.py --summary --non_strict_only --command ../timed-dmdscript.sh --tests=../test262 | tee ../dmdscript-test262.log | grep '=== .* failed in .* ===' +python2 src/test262.py --summary --non_strict_only --command ../timed-dmdscript.sh --tests=../test262 | tee ../dmdscript-test262.log | grep '=== .* failed in .* ===' cd .. -EXPECTED_TO_PASS=5238 +EXPECTED_TO_PASS=5223 PASSED=$(grep ' - Passed [0-9]* tests' dmdscript-test262.log | sed -n 's/.*Passed \([0-9]*\) tests.*/\1/;P') if [ "$PASSED" -gt "$EXPECTED_TO_PASS" ]; then