summaryrefslogtreecommitdiff
path: root/Tests/LibJS
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-12-18 09:07:15 -0700
committerAndreas Kling <kling@serenityos.org>2022-12-20 11:04:05 +0100
commitc0542ed40b3b38df25d143dd265454661aa79fef (patch)
tree75da242edd81dba1938e27acc543a0ab44554616 /Tests/LibJS
parent4ed5520e3e72e0e953533a0f76e1c5758a614b73 (diff)
downloadserenity-c0542ed40b3b38df25d143dd265454661aa79fef.zip
Meta+test262-runner: Check for signature of __assert_fail in CMake
Rather than trying to assume the only two C libraries on Linux are musl and glibc, this solution fixes musl builds by explicitly checking for the one C library function we are overwriting. That being said, we should find another solution to retrieving this error information from crashing tests. Possibly just overriding the SIGABRT handler would work. The full solution might require checking stderr as well as stdout in the test driver though.
Diffstat (limited to 'Tests/LibJS')
-rw-r--r--Tests/LibJS/test262-runner.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Tests/LibJS/test262-runner.cpp b/Tests/LibJS/test262-runner.cpp
index 84bc611ced..81d3a87c15 100644
--- a/Tests/LibJS/test262-runner.cpp
+++ b/Tests/LibJS/test262-runner.cpp
@@ -556,13 +556,16 @@ static bool g_in_assert = false;
exit(12);
}
+// FIXME: Use a SIGABRT handler here instead of overriding internal libc assertion handlers.
+// Fixing this will likely require updating the test driver as well to pull the assertion failure
+// message out of stderr rather than from the json object printed to stdout.
#ifdef AK_OS_SERENITY
void __assertion_failed(char const* assertion)
{
handle_failed_assert(assertion);
}
#else
-# ifdef AK_OS_EMSCRIPTEN
+# ifdef ASSERT_FAIL_HAS_INT /* Set by CMake */
extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, int line, char const* function)
# else
extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, unsigned int line, char const* function)