Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ds-ext/source/ext.d
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
65 changes: 1 addition & 64 deletions engine/source/dmdscript/outbuffer.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
14 changes: 11 additions & 3 deletions run-test262.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down