Skip to content

Commit 7be933e

Browse files
authored
Enable test262 on CI (#11)
Fixes: #3
1 parent b6e5541 commit 7be933e

File tree

7 files changed

+576
-23
lines changed

7 files changed

+576
-23
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,19 @@ on:
1313
branches:
1414
- master
1515

16-
# TODO(bnoordhuis) run test262 tests
1716
jobs:
1817
linux:
1918
runs-on: ubuntu-latest
2019
steps:
2120
- uses: actions/checkout@v3
21+
with:
22+
submodules: true
2223
- name: build
2324
run: |
24-
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y
25-
- name: stats
26-
run: |
27-
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y qjs
28-
./qjs -qd
25+
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y all run-test262
2926
- name: test
3027
run: |
31-
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y test
28+
make test test2
3229
linux-asan:
3330
runs-on: ubuntu-latest
3431
steps:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ qjscalc
1111
qjscalc.c
1212
repl.c
1313
run-test262
14-
test262/
1514
test262_*.txt
1615
test_fib.c
1716
tests/bjson.so

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "test262"]
2+
path = test262
3+
url = https://github.com/tc39/test262
4+
shallow = true

run-test262.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum test_mode_t {
6363
TEST_STRICT, /* run tests as strict, skip nostrict tests */
6464
TEST_ALL, /* run tests in both strict and nostrict, unless restricted by spec */
6565
} test_mode = TEST_DEFAULT_NOSTRICT;
66+
int compact;
6667
int skip_async;
6768
int skip_module;
6869
int new_style;
@@ -1885,10 +1886,24 @@ void show_progress(int force) {
18851886
clock_t t = clock();
18861887
if (force || !last_clock || (t - last_clock) > CLOCKS_PER_SEC / 20) {
18871888
last_clock = t;
1888-
/* output progress indicator: erase end of line and return to col 0 */
1889-
fprintf(stderr, "%d/%d/%d\033[K\r",
1890-
test_failed, test_count, test_skipped);
1891-
fflush(stderr);
1889+
if (compact) {
1890+
static int last_test_skipped;
1891+
static int last_test_failed;
1892+
char c = '.';
1893+
if (test_skipped > last_test_skipped) c = '-';
1894+
if (test_failed > last_test_failed) c = '!';
1895+
last_test_skipped = test_skipped;
1896+
last_test_failed = test_failed;
1897+
fputc(c, stderr);
1898+
if (force)
1899+
fputc('\n', stderr);
1900+
fflush(stderr);
1901+
} else {
1902+
/* output progress indicator: erase end of line and return to col 0 */
1903+
fprintf(stderr, "%d/%d/%d\033[K\r",
1904+
test_failed, test_count, test_skipped);
1905+
fflush(stderr);
1906+
}
18921907
}
18931908
}
18941909

@@ -1968,6 +1983,7 @@ int main(int argc, char **argv)
19681983
BOOL is_module = FALSE;
19691984

19701985
#if !defined(_WIN32)
1986+
compact = !isatty(STDERR_FILENO);
19711987
/* Date tests assume California local time */
19721988
setenv("TZ", "America/Los_Angeles", 1);
19731989
#endif
@@ -2126,5 +2142,6 @@ int main(int argc, char **argv)
21262142
free(harness_exclude);
21272143
free(error_file);
21282144

2129-
return 0;
2145+
/* Signal that the error file is out of date. */
2146+
return new_errors || changed_errors || fixed_errors;
21302147
}

test262

Submodule test262 added at c1281db

test262.conf

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,41 @@ testdir=test262/test
4747
# Standard language features and proposed extensions
4848
# list the features that are included
4949
# skipped features are tagged as such to avoid warnings
50+
# Keep this list alpha-sorted (:sort i in vim)
5051

52+
__getter__
53+
__proto__
54+
__setter__
5155
AggregateError
5256
align-detached-buffer-semantics-with-web-reality
5357
arbitrary-module-namespace-names=skip
5458
array-find-from-last=skip
59+
array-grouping=skip
60+
Array.fromAsync=skip
5561
Array.prototype.at=skip
5662
Array.prototype.flat
5763
Array.prototype.flatMap
5864
Array.prototype.flatten
65+
Array.prototype.includes
5966
Array.prototype.values
6067
ArrayBuffer
68+
arraybuffer-transfer=skip
6169
arrow-function
6270
async-functions
6371
async-iteration
64-
Atomics
72+
Atomics=skip # disabled because of Windows <-> pthreads
6573
Atomics.waitAsync=skip
6674
BigInt
6775
caller
76+
change-array-by-copy # works except for missing toReversed/toSorted/toSpliced
6877
class
6978
class-fields-private
7079
class-fields-private-in=skip
7180
class-fields-public
7281
class-methods-private
7382
class-static-block=skip
74-
class-static-fields-public
7583
class-static-fields-private
84+
class-static-fields-public
7685
class-static-methods-private
7786
cleanupSome=skip
7887
coalesce-expression
@@ -88,15 +97,17 @@ DataView.prototype.getInt8
8897
DataView.prototype.getUint16
8998
DataView.prototype.getUint32
9099
DataView.prototype.setUint8
100+
decorators=skip
91101
default-parameters
92102
destructuring-assignment
93103
destructuring-binding
94104
dynamic-import
95105
error-cause=skip
106+
exponentiation
96107
export-star-as-namespace-from-module
97108
FinalizationGroup=skip
98-
FinalizationRegistry=skip
99109
FinalizationRegistry.prototype.cleanupSome=skip
110+
FinalizationRegistry=skip
100111
Float32Array
101112
Float64Array
102113
for-in-order
@@ -105,13 +116,16 @@ generators
105116
globalThis
106117
hashbang
107118
host-gc-required=skip
108-
import.meta
109119
import-assertions=skip
120+
import-attributes=skip
121+
import.meta
110122
Int16Array
111123
Int32Array
112124
Int8Array
113125
IsHTMLDDA
126+
iterator-helpers=skip
114127
json-modules=skip
128+
json-parse-with-source=skip
115129
json-superset
116130
legacy-regexp=skip
117131
let
@@ -127,6 +141,7 @@ Object.is
127141
optional-catch-binding
128142
optional-chaining
129143
Promise
144+
promise-with-resolvers=skip
130145
Promise.allSettled
131146
Promise.any
132147
Promise.prototype.finally
@@ -137,22 +152,27 @@ Reflect.construct
137152
Reflect.set
138153
Reflect.setPrototypeOf
139154
regexp-dotall
155+
regexp-duplicate-named-groups=skip
140156
regexp-lookbehind
141157
regexp-match-indices=skip
142158
regexp-named-groups
143159
regexp-unicode-property-escapes
160+
regexp-v-flag=skip
144161
resizable-arraybuffer=skip
145162
rest-parameters
146163
Set
164+
set-methods=skip
147165
ShadowRealm=skip
148166
SharedArrayBuffer
149167
string-trimming
150168
String.fromCodePoint
169+
String.prototype.at=skip
151170
String.prototype.endsWith
152171
String.prototype.includes
153-
String.prototype.at=skip
172+
String.prototype.isWellFormed=skip
154173
String.prototype.matchAll
155174
String.prototype.replaceAll
175+
String.prototype.toWellFormed=skip
156176
String.prototype.trimEnd
157177
String.prototype.trimStart
158178
super
@@ -171,6 +191,7 @@ Symbol.split
171191
Symbol.toPrimitive
172192
Symbol.toStringTag
173193
Symbol.unscopables
194+
symbols-as-weakmap-keys
174195
tail-call-optimization=skip
175196
template
176197
Temporal=skip
@@ -186,9 +207,6 @@ WeakMap
186207
WeakRef=skip
187208
WeakSet
188209
well-formed-json-stringify
189-
__getter__
190-
__proto__
191-
__setter__
192210

193211
[exclude]
194212
# list excluded tests and directories here

0 commit comments

Comments
 (0)