Skip to content

Commit ce4b4a4

Browse files
authored
Add test for phthreads + dylink + exceptions (#16314)
The remaining issue with exceptions and this combination of features were fixed by https://reviews.llvm.org/D119630 and https://reviews.llvm.org/D119666. Fixes: #13398, #13447
1 parent d33328b commit ce4b4a4

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

src/preamble.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,31 +219,31 @@ function alignUp(x, multiple) {
219219
}
220220

221221
var HEAP,
222-
/** @type {ArrayBuffer} */
222+
/** @type {!ArrayBuffer} */
223223
buffer,
224-
/** @type {Int8Array} */
224+
/** @type {!Int8Array} */
225225
HEAP8,
226-
/** @type {Uint8Array} */
226+
/** @type {!Uint8Array} */
227227
HEAPU8,
228-
/** @type {Int16Array} */
228+
/** @type {!Int16Array} */
229229
HEAP16,
230-
/** @type {Uint16Array} */
230+
/** @type {!Uint16Array} */
231231
HEAPU16,
232-
/** @type {Int32Array} */
232+
/** @type {!Int32Array} */
233233
HEAP32,
234-
/** @type {Uint32Array} */
234+
/** @type {!Uint32Array} */
235235
HEAPU32,
236-
/** @type {Float32Array} */
236+
/** @type {!Float32Array} */
237237
HEAPF32,
238238
#if WASM_BIGINT
239239
/* BigInt64Array type is not correctly defined in closure
240-
/** not-@type {BigInt64Array} */
240+
/** not-@type {!BigInt64Array} */
241241
HEAP64,
242242
/* BigUInt64Array type is not correctly defined in closure
243-
/** not-t@type {BigUint64Array} */
243+
/** not-t@type {!BigUint64Array} */
244244
HEAPU64,
245245
#endif
246-
/** @type {Float64Array} */
246+
/** @type {!Float64Array} */
247247
HEAPF64;
248248

249249
#if SUPPORT_BIG_ENDIAN
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <stdio.h>
2+
3+
int get_value();
4+
5+
int main(void) {
6+
try {
7+
// throws 42
8+
get_value();
9+
} catch (int i) {
10+
printf("except: %d\n", i);
11+
}
12+
return 0;
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
except: 42
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int get_value() {
2+
throw 42;
3+
return 0;
4+
}

tests/test_core.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8756,6 +8756,15 @@ def test_pthread_dylink_entry_point(self, args):
87568756
main = test_file('core/pthread/test_pthread_dylink_entry_point.c')
87578757
self.dylink_testf(main, need_reverse=False, emcc_args=args)
87588758

8759+
@needs_dylink
8760+
@node_pthreads
8761+
def test_pthread_dylink_exceptions(self):
8762+
self.emcc_args.append('-Wno-experimental')
8763+
self.set_setting('EXIT_RUNTIME')
8764+
self.set_setting('USE_PTHREADS')
8765+
self.emcc_args.append('-fexceptions')
8766+
self.dylink_testf(test_file('core/pthread/test_pthread_dylink_exceptions.cpp'))
8767+
87598768
@needs_dylink
87608769
@node_pthreads
87618770
def test_pthread_dlopen(self):

0 commit comments

Comments
 (0)