Skip to content

Commit bcde51d

Browse files
authored
Revise stack overflow checks in the core suite (#25322)
Revise stack overflow and abort checks in the core suite to allow testing stack overflow tests also in minimal0 suite. Checking for the presence of the `"Aborted("` prefix does not seem essential to any of these tests.
1 parent 508bcb0 commit bcde51d

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ jobs:
746746
wasmfs.test_fs_llseek_rawfs
747747
wasmfs.test_freetype
748748
minimal0.test_utf
749+
minimal0.test_stack_overflow
749750
omitexports0.test_asyncify_longjmp
750751
omitexports0.test_emscripten_api
751752
strict.test_no_declare_asm_module_exports

test/test_core.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ def test_bsearch(self):
28142814

28152815
def test_stack_overflow(self):
28162816
self.set_setting('ASSERTIONS', 2)
2817-
self.do_runf('core/stack_overflow.c', 'Aborted(stack overflow', assert_returncode=NON_ZERO)
2817+
self.do_runf('core/stack_overflow.c', 'stack overflow', assert_returncode=NON_ZERO)
28182818

28192819
def test_stackAlloc(self):
28202820
self.do_core_test('test_stackAlloc.c')
@@ -7253,7 +7253,7 @@ def test(expected, args=None, assert_returncode=0):
72537253
test('ALLOC_STACK is not defined', args=['-DDIRECT'], assert_returncode=NON_ZERO)
72547254

72557255
# When assertions are enabled direct and indirect usage both abort with a useful error message.
7256-
not_exported = "Aborted('ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ))"
7256+
not_exported = "'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)"
72577257
not_included = "`ALLOC_STACK` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$ALLOC_STACK')"
72587258
self.set_setting('ASSERTIONS')
72597259
test(not_exported, assert_returncode=NON_ZERO)
@@ -8676,15 +8676,15 @@ def test_fs_dict_none(self):
86768676
def test_stack_overflow_check(self):
86778677
self.set_setting('STACK_SIZE', 1048576)
86788678
self.set_setting('STACK_OVERFLOW_CHECK', 2)
8679-
self.do_runf('stack_overflow.cpp', 'Aborted(stack overflow', assert_returncode=NON_ZERO)
8679+
self.do_runf('stack_overflow.cpp', 'stack overflow', assert_returncode=NON_ZERO)
86808680

86818681
self.cflags += ['-DONE_BIG_STRING']
8682-
self.do_runf('stack_overflow.cpp', 'Aborted(stack overflow', assert_returncode=NON_ZERO)
8682+
self.do_runf('stack_overflow.cpp', 'stack overflow', assert_returncode=NON_ZERO)
86838683

86848684
# ASSERTIONS=2 implies STACK_OVERFLOW_CHECK=2
86858685
self.clear_setting('STACK_OVERFLOW_CHECK')
86868686
self.set_setting('ASSERTIONS', 2)
8687-
self.do_runf('stack_overflow.cpp', 'Aborted(stack overflow', assert_returncode=NON_ZERO)
8687+
self.do_runf('stack_overflow.cpp', 'stack overflow', assert_returncode=NON_ZERO)
86888688

86898689
@node_pthreads
86908690
def test_binaryen_2170_emscripten_atomic_cas_u8(self):
@@ -9125,9 +9125,9 @@ def test_safe_stack(self):
91259125
self.set_setting('STACK_OVERFLOW_CHECK', 2)
91269126
self.set_setting('STACK_SIZE', 1024)
91279127
if self.is_optimizing():
9128-
expected = [r'Aborted\(stack overflow \(Attempt to set SP to 0x[0-9a-fA-F]+, with stack limits \[0x[0-9a-fA-F]+ - 0x[0-9a-fA-F]+\]\)']
9128+
expected = [r'stack overflow \(Attempt to set SP to 0x[0-9a-fA-F]+, with stack limits \[0x[0-9a-fA-F]+ - 0x[0-9a-fA-F]+\]\)']
91299129
else:
9130-
expected = [r'Aborted\(stack overflow \(Attempt to set SP to 0x[0-9a-fA-F]+, with stack limits \[0x[0-9a-fA-F]+ - 0x[0-9a-fA-F]+\]\)',
9130+
expected = [r'stack overflow \(Attempt to set SP to 0x[0-9a-fA-F]+, with stack limits \[0x[0-9a-fA-F]+ - 0x[0-9a-fA-F]+\]\)',
91319131
'__handle_stack_overflow']
91329132
self.do_runf('core/test_safe_stack.c',
91339133
expected_output=expected,
@@ -9142,9 +9142,9 @@ def test_safe_stack_pthread(self):
91429142
self.set_setting('PROXY_TO_PTHREAD')
91439143
self.cflags.append('-pthread')
91449144
if self.is_optimizing():
9145-
expected = ['Aborted(stack overflow']
9145+
expected = ['stack overflow']
91469146
else:
9147-
expected = ['Aborted(stack overflow', '__handle_stack_overflow']
9147+
expected = ['stack overflow', '__handle_stack_overflow']
91489148
self.do_runf('core/test_safe_stack.c',
91499149
expected_output=expected,
91509150
assert_returncode=NON_ZERO, assert_all=True)
@@ -9153,9 +9153,9 @@ def test_safe_stack_alloca(self):
91539153
self.set_setting('STACK_OVERFLOW_CHECK', 2)
91549154
self.set_setting('STACK_SIZE', 65536)
91559155
if self.is_optimizing():
9156-
expected = ['Aborted(stack overflow']
9156+
expected = ['stack overflow']
91579157
else:
9158-
expected = ['Aborted(stack overflow', '__handle_stack_overflow']
9158+
expected = ['stack overflow', '__handle_stack_overflow']
91599159
self.do_runf('core/test_safe_stack_alloca.c',
91609160
expected_output=expected,
91619161
assert_returncode=NON_ZERO, assert_all=True)
@@ -9186,7 +9186,7 @@ def test_safe_stack_dylink(self):
91869186
void sidey() {
91879187
f(NULL);
91889188
}
9189-
''', ['Aborted(stack overflow', '__handle_stack_overflow'], assert_returncode=NON_ZERO, force_c=True)
9189+
''', ['stack overflow', '__handle_stack_overflow'], assert_returncode=NON_ZERO, force_c=True)
91909190

91919191
def test_fpic_static(self):
91929192
self.cflags.append('-fPIC')
@@ -9435,7 +9435,7 @@ def test_pthread_dlsym(self):
94359435
@node_pthreads
94369436
def test_pthread_dylink_tls(self):
94379437
if '-O2' in self.cflags and self.get_setting('STACK_OVERFLOW_CHECK') == 2:
9438-
self.skipTest('https://github.com/emscripten-core/emscripten/issues/24964: fails with Aborted(stack overflow (Attempt to set SP to 0x000114d0, with stack limits [0x00000000 - 0x00000000])')
9438+
self.skipTest('https://github.com/emscripten-core/emscripten/issues/24964: fails with stack overflow (Attempt to set SP to 0x000114d0, with stack limits [0x00000000 - 0x00000000])')
94399439

94409440
self.cflags += ['-Wno-experimental', '-pthread']
94419441
main = test_file('core/pthread/test_pthread_dylink_tls.c')
@@ -9716,7 +9716,7 @@ def test_promise_await(self):
97169716

97179717
def test_promise_await_error(self):
97189718
# Check that the API is not available when ASYNCIFY is not set
9719-
self.do_runf('core/test_promise_await.c', 'Aborted(emscripten_promise_await is only available with ASYNCIFY)',
9719+
self.do_runf('core/test_promise_await.c', 'emscripten_promise_await is only available with ASYNCIFY',
97209720
assert_returncode=NON_ZERO)
97219721

97229722
@no_modularize_instance('uses Module object directly')

0 commit comments

Comments
 (0)