Repository navigation
Closed
Description
Try a simple browser test:
#include <assert.h>
#include <stdbool.h>
int main() {
assert(false);
return 0;
}And execute it in Python with either btest_exit or btest (both should respect exit code in theory):
def test_assert(self):
self.btest_exit('hello_world.c', expected='1')When executed, it takes a very long time and the output looks like this:
$ ./tests/runner.py browser.test_assert
runner:WARNING: use EMTEST_ALL_ENGINES=1 in the env to run against all JS engines, which is slower but provides more coverage
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 447529]
runner:INFO: Using default system browser
Running the browser tests. Make sure the browser allows popups from localhost.
test_assert (test_browser.browser) ... [client logging: /?exception=Uncaught RuntimeError: abort(Assertion failed: false, at: /usr/local/google/home/rreverser/emscripten/tests/hello_world.c,12,main) at Error
at jsStackTrace (http://localhost:8888/test.js:1809:19)
at stackTrace (http://localhost:8888/test.js:1826:16)
at abort (http://localhost:8888/test.js:1522:44)
at ___assert_fail (http://localhost:8888/test.js:1832:7)
at http://localhost:8888/test.wasm:wasm-function[2]:0x1c1
at main (http://localhost:8888/test.wasm:wasm-function[3]:0x1c9)
at http://localhost:8888/test.js:1599:22
at callMain (http://localhost:8888/test.js:2164:15)
at doRun (http://localhost:8888/test.js:2235:23)
at http://localhost:8888/test.js:2246:7 / undefined ]
[unresponsive tests: 1]
[test error (see below), automatically retrying]
Unexpected difference:
--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:1
+[no http server activity]
For full output run with EMTEST_VERBOSE=1.
[client logging: /?exception=Uncaught RuntimeError: abort(Assertion failed: false, at: /usr/local/google/home/rreverser/emscripten/tests/hello_world.c,12,main) at Error
at jsStackTrace (http://localhost:8888/test.js:1809:19)
at stackTrace (http://localhost:8888/test.js:1826:16)
at abort (http://localhost:8888/test.js:1522:44)
at ___assert_fail (http://localhost:8888/test.js:1832:7)
at http://localhost:8888/test.wasm:wasm-function[2]:0x1c1
at main (http://localhost:8888/test.wasm:wasm-function[3]:0x1c9)
at http://localhost:8888/test.js:1599:22
at callMain (http://localhost:8888/test.js:2164:15)
at doRun (http://localhost:8888/test.js:2235:23)
at http://localhost:8888/test.js:2246:7 / undefined ]
[unresponsive tests: 2]
FAIL
[Browser harness server terminated]
======================================================================
FAIL: test_assert (test_browser.browser)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1371, in run_browser
self.assertIdenticalUrlEncoded(expectedResult, output)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 734, in assertIdenticalUrlEncoded
self.assertIdentical(expected, unquote(actual), **kwargs)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 730, in assertIdentical
self.fail(fail_message)
File "/usr/lib/python3.8/unittest/case.py", line 753, in fail
raise self.failureException(msg)
AssertionError: Unexpected difference:
--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:1
+[no http server activity]
For full output run with EMTEST_VERBOSE=1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/google/home/rreverser/emscripten/tests/test_browser.py", line 667, in test_assert
self.btest_exit('hello_world.c', expected='1')
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1525, in btest_exit
return self.btest(filename, *args, **kwargs)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1555, in btest
self.run_browser(outfile + url_suffix, message, ['/report_result?' + e for e in expected], timeout=timeout, extra_tries=extra_tries)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1376, in run_browser
return self.run_browser(html_file, message, expectedResult, timeout, extra_tries - 1)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1378, in run_browser
raise e
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 1371, in run_browser
self.assertIdenticalUrlEncoded(expectedResult, output)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 734, in assertIdenticalUrlEncoded
self.assertIdentical(expected, unquote(actual), **kwargs)
File "/usr/local/google/home/rreverser/emscripten/tests/runner.py", line 730, in assertIdentical
self.fail(fail_message)
AssertionError: Unexpected difference:
--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:1
+[no http server activity]
For full output run with EMTEST_VERBOSE=1.
----------------------------------------------------------------------
Ran 1 test in 121.390s
FAILED (failures=1)
That is, instead of failing on assert, it just printed an error message to console, then kept waiting for an exit status and eventually timed out. On time out, it decided to re-run the test and same happened again.
Same happens if the expected='0' or any other status code, that is any assertion failure results in a time out.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Call onExit callback on abort
Call onExit callback on abort
Call onExit callback on abort
Call onExit callback on abort
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as onExit in browser_reporting.js
tests: handle onAbort as well as onExit in browser_reporting.js (#13631)