Fix a bunch more tests to run in STRICT mode (#11124)
Tested with `./tests/runner.py strict`. There are still a few that need more work but this covers the low hanging fruit.
This commit is contained in:
Родитель
d262c2a6c5
Коммит
cccf9bf536
|
@ -196,7 +196,7 @@ if (ENVIRONMENT_IS_NODE) {
|
||||||
console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?');
|
console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?');
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
Worker = nodeWorkerThreads.Worker;
|
global.Worker = nodeWorkerThreads.Worker;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WASM == 2
|
#if WASM == 2
|
||||||
|
@ -337,7 +337,7 @@ if (ENVIRONMENT_IS_NODE) {
|
||||||
// Polyfill the performance object, which emscripten pthreads support
|
// Polyfill the performance object, which emscripten pthreads support
|
||||||
// depends on for good timing.
|
// depends on for good timing.
|
||||||
if (typeof performance === 'undefined') {
|
if (typeof performance === 'undefined') {
|
||||||
performance = require('perf_hooks').performance;
|
global.performance = require('perf_hooks').performance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -307,7 +307,7 @@ if (typeof process === 'object' && typeof process.versions === 'object' && typeo
|
||||||
|
|
||||||
var nodeWorkerThreads = require('worker_threads');
|
var nodeWorkerThreads = require('worker_threads');
|
||||||
|
|
||||||
Worker = nodeWorkerThreads.Worker;
|
global.Worker = nodeWorkerThreads.Worker;
|
||||||
|
|
||||||
var parentPort = nodeWorkerThreads.parentPort;
|
var parentPort = nodeWorkerThreads.parentPort;
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("QS: %d\n", emscripten_get_compiler_setting("QUANTUM_SIZE"));
|
printf("EXIT_RUNTIME: %d\n", emscripten_get_compiler_setting("EXIT_RUNTIME"));
|
||||||
assert((unsigned)emscripten_get_compiler_setting("OPT_LEVEL") <= 3);
|
assert((unsigned)emscripten_get_compiler_setting("OPT_LEVEL") <= 3);
|
||||||
assert((unsigned)emscripten_get_compiler_setting("DEBUG_LEVEL") <= 4);
|
assert((unsigned)emscripten_get_compiler_setting("DEBUG_LEVEL") <= 4);
|
||||||
printf("EV: %s\n", (char*)emscripten_get_compiler_setting("EMSCRIPTEN_VERSION"));
|
printf("EMSCRIPTEN_VERSION: %s\n", (char*)emscripten_get_compiler_setting("EMSCRIPTEN_VERSION"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
QS: 4
|
EXIT_RUNTIME: 0
|
||||||
EV: waka
|
EMSCRIPTEN_VERSION: waka
|
||||||
|
|
|
@ -13,7 +13,7 @@ int main() {
|
||||||
printf("%d %d %d %d %s\n", c[0] & 0xff, c[1] & 0xff, c[2] & 0xff, c[3] & 0xff,
|
printf("%d %d %d %d %s\n", c[0] & 0xff, c[1] & 0xff, c[2] & 0xff, c[3] & 0xff,
|
||||||
c);
|
c);
|
||||||
emscripten_run_script(
|
emscripten_run_script(
|
||||||
"cheez = _malloc(100);"
|
"var cheez = _malloc(100);"
|
||||||
"Module.stringToUTF8(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez, 100);"
|
"Module.stringToUTF8(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez, 100);"
|
||||||
"out([UTF8ToString(cheez), Module.getValue(cheez, "
|
"out([UTF8ToString(cheez), Module.getValue(cheez, "
|
||||||
"'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, "
|
"'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, "
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
var dummy_device = FS.makedev(64, 0);
|
var dummy_device = FS.makedev(64, 0);
|
||||||
FS.registerDevice(dummy_device, {});
|
FS.registerDevice(dummy_device, {});
|
||||||
|
|
||||||
FS.mkdir('/forbidden', 0000);
|
FS.mkdir('/forbidden', 0o000);
|
||||||
FS.mkdir('/forbidden/test');
|
FS.mkdir('/forbidden/test');
|
||||||
FS.mkdir('/abc');
|
FS.mkdir('/abc');
|
||||||
FS.mkdir('/abc/123');
|
FS.mkdir('/abc/123');
|
||||||
|
|
|
@ -12,7 +12,7 @@ int main()
|
||||||
EM_ASM(
|
EM_ASM(
|
||||||
FS.writeFile('testfile', 'a=1\nb=2\n');
|
FS.writeFile('testfile', 'a=1\nb=2\n');
|
||||||
var stream = FS.open('testfile', 'a');
|
var stream = FS.open('testfile', 'a');
|
||||||
fd = FS.write(stream, new Uint8Array([99, 61, 51]) /* c=3 */, 0, 3);
|
var fd = FS.write(stream, new Uint8Array([99, 61, 51]) /* c=3 */, 0, 3);
|
||||||
|
|
||||||
// check invalid whence
|
// check invalid whence
|
||||||
var ex;
|
var ex;
|
||||||
|
|
|
@ -244,6 +244,7 @@ core_test_modes = [
|
||||||
'wasm3',
|
'wasm3',
|
||||||
'wasms',
|
'wasms',
|
||||||
'wasmz',
|
'wasmz',
|
||||||
|
'strict'
|
||||||
]
|
]
|
||||||
|
|
||||||
if shared.Settings.WASM_BACKEND:
|
if shared.Settings.WASM_BACKEND:
|
||||||
|
|
|
@ -8817,6 +8817,8 @@ NODEFS is no longer included by default; build with -lnodefs.js
|
||||||
def test_undefined_main(self):
|
def test_undefined_main(self):
|
||||||
if self.get_setting('LLD_REPORT_UNDEFINED'):
|
if self.get_setting('LLD_REPORT_UNDEFINED'):
|
||||||
self.skipTest('LLD_REPORT_UNDEFINED does not allow implicit undefined main')
|
self.skipTest('LLD_REPORT_UNDEFINED does not allow implicit undefined main')
|
||||||
|
if self.get_setting('STRICT'):
|
||||||
|
self.skipTest('STRICT does not allow implicit undefined main')
|
||||||
# By default in emscripten we allow main to be undefined. Its used when
|
# By default in emscripten we allow main to be undefined. Its used when
|
||||||
# building library code that has no main.
|
# building library code that has no main.
|
||||||
# TODO(sbc): Simplify the code by making this an opt-in feature.
|
# TODO(sbc): Simplify the code by making this an opt-in feature.
|
||||||
|
@ -8868,7 +8870,7 @@ NODEFS is no longer included by default; build with -lnodefs.js
|
||||||
self.do_run_in_out_file_test('tests', 'core', 'test_get_exported_function')
|
self.do_run_in_out_file_test('tests', 'core', 'test_get_exported_function')
|
||||||
|
|
||||||
def test_auto_detect_main(self):
|
def test_auto_detect_main(self):
|
||||||
if not self.get_setting('LLD_REPORT_UNDEFINED'):
|
if not self.get_setting('LLD_REPORT_UNDEFINED') and not self.get_setting('STRICT'):
|
||||||
self.do_run_in_out_file_test('tests', 'core', 'test_ctors_no_main')
|
self.do_run_in_out_file_test('tests', 'core', 'test_ctors_no_main')
|
||||||
|
|
||||||
# Disabling IGNORE_MISSING_MAIN should cause link to fail due to missing main
|
# Disabling IGNORE_MISSING_MAIN should cause link to fail due to missing main
|
||||||
|
@ -8975,7 +8977,8 @@ asm2nn = make_run('asm2nn', emcc_args=['-O2'], settings={'WASM': 0}, env={'EMCC_
|
||||||
# wasm
|
# wasm
|
||||||
wasm2s = make_run('wasm2s', emcc_args=['-O2'], settings={'SAFE_HEAP': 1})
|
wasm2s = make_run('wasm2s', emcc_args=['-O2'], settings={'SAFE_HEAP': 1})
|
||||||
wasm2ss = make_run('wasm2ss', emcc_args=['-O2'], settings={'STACK_OVERFLOW_CHECK': 2})
|
wasm2ss = make_run('wasm2ss', emcc_args=['-O2'], settings={'STACK_OVERFLOW_CHECK': 2})
|
||||||
strict = make_run('strict', emcc_args=['-O2'], settings={'DEFAULT_TO_CXX': 0})
|
# Add DEFAULT_TO_CXX=0
|
||||||
|
strict = make_run('strict', emcc_args=[], settings={'STRICT': 1})
|
||||||
|
|
||||||
if not shared.Settings.WASM_BACKEND:
|
if not shared.Settings.WASM_BACKEND:
|
||||||
# emterpreter
|
# emterpreter
|
||||||
|
@ -8989,7 +8992,6 @@ if shared.Settings.WASM_BACKEND:
|
||||||
|
|
||||||
# Experimental modes (not tested by CI)
|
# Experimental modes (not tested by CI)
|
||||||
lld = make_run('lld', emcc_args=[], settings={'LLD_REPORT_UNDEFINED': 1})
|
lld = make_run('lld', emcc_args=[], settings={'LLD_REPORT_UNDEFINED': 1})
|
||||||
strict = make_run('strict', emcc_args=[], settings={'STRICT': 1})
|
|
||||||
|
|
||||||
# TestCoreBase is just a shape for the specific subclasses, we don't test it itself
|
# TestCoreBase is just a shape for the specific subclasses, we don't test it itself
|
||||||
del TestCoreBase # noqa
|
del TestCoreBase # noqa
|
||||||
|
|
|
@ -27,10 +27,10 @@ int main() {
|
||||||
FS.mount(NODEFS, { root: '.' }, 'working');
|
FS.mount(NODEFS, { root: '.' }, 'working');
|
||||||
#endif
|
#endif
|
||||||
FS.chdir('working');
|
FS.chdir('working');
|
||||||
FS.writeFile('forbidden', ''); FS.chmod('forbidden', 0000);
|
FS.writeFile('forbidden', ''); FS.chmod('forbidden', 0o000);
|
||||||
FS.writeFile('readable', ''); FS.chmod('readable', 0444);
|
FS.writeFile('readable', ''); FS.chmod('readable', 0o444);
|
||||||
FS.writeFile('writeable', ''); FS.chmod('writeable', 0222);
|
FS.writeFile('writeable', ''); FS.chmod('writeable', 0o222);
|
||||||
FS.writeFile('allaccess', ''); FS.chmod('allaccess', 0777);
|
FS.writeFile('allaccess', ''); FS.chmod('allaccess', 0o777);
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
// Empty path checks #9136 fix
|
// Empty path checks #9136 fix
|
||||||
|
@ -68,10 +68,10 @@ int main() {
|
||||||
// won't have problems on deleting the files. On Windows, calling shutil.rmtree()
|
// won't have problems on deleting the files. On Windows, calling shutil.rmtree()
|
||||||
// will fail if any of the files are read-only.
|
// will fail if any of the files are read-only.
|
||||||
EM_ASM(
|
EM_ASM(
|
||||||
FS.chmod('forbidden', 0777);
|
FS.chmod('forbidden', 0o777);
|
||||||
FS.chmod('readable', 0777);
|
FS.chmod('readable', 0o777);
|
||||||
FS.chmod('writeable', 0777);
|
FS.chmod('writeable', 0o777);
|
||||||
FS.chmod('allaccess', 0777);
|
FS.chmod('allaccess', 0o777);
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ int main() {
|
||||||
|
|
||||||
FS.mkdir('/folder');
|
FS.mkdir('/folder');
|
||||||
FS.symlink('/folder', '/link');
|
FS.symlink('/folder', '/link');
|
||||||
FS.writeFile('/file', '', { mode: 0777 });
|
FS.writeFile('/file', '', { mode: 0o777 });
|
||||||
);
|
);
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
|
@ -22,7 +22,7 @@ int main() {
|
||||||
FS.chdir('working');
|
FS.chdir('working');
|
||||||
FS.writeFile('towrite', 'abcdef');
|
FS.writeFile('towrite', 'abcdef');
|
||||||
FS.writeFile('toread', 'abcdef');
|
FS.writeFile('toread', 'abcdef');
|
||||||
FS.chmod('toread', 0444);
|
FS.chmod('toread', 0o444);
|
||||||
);
|
);
|
||||||
|
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
@ -87,7 +87,7 @@ int main() {
|
||||||
// won't have problems on deleting the files. On Windows, calling shutil.rmtree()
|
// won't have problems on deleting the files. On Windows, calling shutil.rmtree()
|
||||||
// will fail if any of the files are read-only.
|
// will fail if any of the files are read-only.
|
||||||
EM_ASM(
|
EM_ASM(
|
||||||
FS.chmod('toread', 0777);
|
FS.chmod('toread', 0o777);
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче