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'

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
master
Zhao Zhili 1 month ago
parent 2dc55f5993
commit ea3d21c349
  1. 8
      tests/checkasm/checkasm.c
  2. 15
      tests/checkasm/checkasm.h

@ -363,6 +363,8 @@ static const struct {
#elif ARCH_LOONGARCH
{ "LSX", "lsx", AV_CPU_FLAG_LSX },
{ "LASX", "lasx", AV_CPU_FLAG_LASX },
#elif ARCH_WASM
{ "SIMD128", "simd128", AV_CPU_FLAG_SIMD128 },
#endif
{ NULL }
};
@ -770,6 +772,8 @@ static LONG NTAPI signal_handler(EXCEPTION_POINTERS *e) {
}
#endif
#else
#ifndef _WASI_EMULATED_SIGNAL
static void signal_handler(int s);
static const struct sigaction signal_handler_act = {
@ -784,6 +788,8 @@ static void signal_handler(int s) {
checkasm_load_context(s);
}
}
#endif // _WASI_EMULATED_SIGNAL
#endif
/* Compares a string with a wildcard pattern. */
@ -933,10 +939,12 @@ int main(int argc, char *argv[])
AddVectoredExceptionHandler(0, signal_handler);
#endif
#else
#ifndef _WASI_EMULATED_SIGNAL
sigaction(SIGBUS, &signal_handler_act, NULL);
sigaction(SIGFPE, &signal_handler_act, NULL);
sigaction(SIGILL, &signal_handler_act, NULL);
sigaction(SIGSEGV, &signal_handler_act, NULL);
#endif // _WASI_EMULATED_SIGNAL
#endif
#if HAVE_PRCTL && defined(PR_SET_UNALIGN)
prctl(PR_SET_UNALIGN, PR_UNALIGN_SIGBUS);

@ -66,12 +66,23 @@ typedef struct { CONTEXT c; int status; } checkasm_context;
#define checkasm_save_context() 0
#define checkasm_load_context() do {} while (0)
#endif
#else
#else // _WIN32
#ifdef _WASI_EMULATED_SIGNAL
#define checkasm_context void*
#define checkasm_save_context() 0
#define checkasm_load_context() do {} while (0)
#else // _WASI_EMULATED_SIGNAL
#include <setjmp.h>
typedef sigjmp_buf checkasm_context;
#define checkasm_save_context() checkasm_handle_signal(sigsetjmp(checkasm_context_buf, 1))
#define checkasm_load_context(s) siglongjmp(checkasm_context_buf, s)
#endif
#endif // _WASI_EMULATED_SIGNAL
#endif // _WIN32
void checkasm_check_aacencdsp(void);
void checkasm_check_aacpsdsp(void);

Loading…
Cancel
Save