History

tests/checkasm: Add partial support for wasm

WASI mssing signal and siglongjmp support. This patch workaround build error and add simd128 flag. Please note that many tests use large array on stack, so you need to increase the stack size when build checkasm, e.g., --extra-ldflags='-Wl,-z,stack-size=10485760'

Zhao Zhili committed 1 year ago

Commit ea3d21c1 parent 2dc55f52 files · +21 −2Browse files

Unified · Split

2 files
  1. tests/checkasm/checkasm.c +8 −0
  2. tests/checkasm/checkasm.h +13 −2
tests/checkasm/checkasm.c+8−0
@@ -363,6 +363,8 @@ static const struct { · 362 unmodified lines
363363 #elif ARCH_LOONGARCH
364364 { "LSX", "lsx", AV_CPU_FLAG_LSX },
365365 { "LASX", "lasx", AV_CPU_FLAG_LASX },
366+#elif ARCH_WASM
367+ { "SIMD128", "simd128", AV_CPU_FLAG_SIMD128 },
366368 #endif
367369 { NULL }
368370 };
@@ -770,6 +772,8 @@ static LONG NTAPI signal_handler(EXCEPTION_POINTERS *e) { · 401 unmodified lines
770772 }
771773 #endif
772774 #else
775+
776+#ifndef _WASI_EMULATED_SIGNAL
773777 static void signal_handler(int s);
774778
775779 static const struct sigaction signal_handler_act = {
@@ -784,6 +788,8 @@ static void signal_handler(int s) { · 8 unmodified lines
784788 checkasm_load_context(s);
785789 }
786790 }
791+#endif // _WASI_EMULATED_SIGNAL
792+
787793 #endif
788794
789795 /* Compares a string with a wildcard pattern. */
@@ -933,10 +939,12 @@ int main(int argc, char *argv[]) · 143 unmodified lines
933939 AddVectoredExceptionHandler(0, signal_handler);
934940 #endif
935941 #else
942+#ifndef _WASI_EMULATED_SIGNAL
936943 sigaction(SIGBUS, &signal_handler_act, NULL);
937944 sigaction(SIGFPE, &signal_handler_act, NULL);
938945 sigaction(SIGILL, &signal_handler_act, NULL);
939946 sigaction(SIGSEGV, &signal_handler_act, NULL);
947+#endif // _WASI_EMULATED_SIGNAL
940948 #endif
941949 #if HAVE_PRCTL && defined(PR_SET_UNALIGN)
942950 prctl(PR_SET_UNALIGN, PR_UNALIGN_SIGBUS);
tests/checkasm/checkasm.h+13−2
@@ -66,12 +66,23 @@ typedef struct { CONTEXT c; int status; } checkasm_context; · 65 unmodified lines
6666 #define checkasm_save_context() 0
6767 #define checkasm_load_context() do {} while (0)
6868 #endif
69−#else
69+#else // _WIN32
70+
71+#ifdef _WASI_EMULATED_SIGNAL
72+
73+#define checkasm_context void*
74+#define checkasm_save_context() 0
75+#define checkasm_load_context() do {} while (0)
76+
77+#else // _WASI_EMULATED_SIGNAL
78+
7079 #include <setjmp.h>
7180 typedef sigjmp_buf checkasm_context;
7281 #define checkasm_save_context() checkasm_handle_signal(sigsetjmp(checkasm_context_buf, 1))
7382 #define checkasm_load_context(s) siglongjmp(checkasm_context_buf, s)
74−#endif
83+#endif // _WASI_EMULATED_SIGNAL
84+
85+#endif // _WIN32
7586
7687 void checkasm_check_aacencdsp(void);
7788 void checkasm_check_aacpsdsp(void);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t