aboutsummaryrefslogtreecommitdiff
path: root/tests/emscripten_log/emscripten_log.cpp
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-12-19 23:32:26 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-12-20 11:49:34 +0200
commit55660c394d5f3db2d57984256dd6c3cce088e4c5 (patch)
tree20099712556194717acfdb9815bf5695f32c49a1 /tests/emscripten_log/emscripten_log.cpp
parent184a425ce07a95e882f3f60b87c1c5037cbffec5 (diff)
Update emscripten_log to work with the handwritten JS demangler. Update tests.
Diffstat (limited to 'tests/emscripten_log/emscripten_log.cpp')
-rw-r--r--tests/emscripten_log/emscripten_log.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/emscripten_log/emscripten_log.cpp b/tests/emscripten_log/emscripten_log.cpp
index 0cd77467..a5bb8432 100644
--- a/tests/emscripten_log/emscripten_log.cpp
+++ b/tests/emscripten_log/emscripten_log.cpp
@@ -2,8 +2,6 @@
#include <stdio.h>
#include <cstring>
-#include <../lib/libcxxabi/include/cxxabi.h>
-
#define STRINGIZE_HELPER(x) #x
#define STRINGIZE(x) STRINGIZE_HELPER(x)
@@ -23,7 +21,7 @@ int result = 1; // If 1, this test succeeded.
} \
} while(0)
-void kitten()
+void __attribute__((noinline)) kitten()
{
// Log to Emscripten Module.
emscripten_log(EM_LOG_NO_PATHS, "Print a log message: int: %d, string: %s.", 42, "hello");
@@ -49,7 +47,7 @@ void kitten()
emscripten_log(EM_LOG_NO_PATHS | EM_LOG_ERROR | EM_LOG_C_STACK | EM_LOG_JS_STACK | EM_LOG_DEMANGLE);
}
-void bar(int = 0, char * = 0, double = 0) // Arbitrary function signature to add some content to callstack.
+void __attribute__((noinline)) bar(int = 0, char * = 0, double = 0) // Arbitrary function signature to add some content to callstack.
{
if (1 == 2)
MYASSERT(2 == 1, "World falls apart!");
@@ -114,22 +112,15 @@ void bar(int = 0, char * = 0, double = 0) // Arbitrary function signature to add
MYASSERT(!!strstr(str, "at __Z3bariPcd (src.cpp"), "Callstack was %s!", str);
MYASSERT(!!strstr(str, "at __Z3FooIiEvv (src.cpp"), "Callstack was %s!", str);
#else
- MYASSERT(!!strstr(str, "at __Z3bariPcd (page.html"), "Callstack was %s!", str);
- MYASSERT(!!strstr(str, "at __Z3FooIiEvv (page.html"), "Callstack was %s!", str);
+ MYASSERT(!!strstr(str, "at __Z3bariPcd (page.js"), "Callstack was %s!", str);
+ MYASSERT(!!strstr(str, "at __Z3FooIiEvv (page.js"), "Callstack was %s!", str);
#endif
}
template<typename T>
-void Foo() // Arbitrary function signature to add some content to callstack.
+void __attribute__((noinline)) Foo() // Arbitrary function signature to add some content to callstack.
{
bar();
-
- // Test cxa_demangle.
- int stat;
- char* demangled = abi::__cxa_demangle("_Z3foov", NULL, NULL, &stat);
- if (stat == 0 && demangled) {
- printf("Demangled name is '%s'.", demangled);
- }
}
int main()
@@ -138,5 +129,8 @@ int main()
#ifndef RUN_FROM_JS_SHELL
REPORT_RESULT();
return 0;
+#else
+ if (result)
+ printf("Success!\n");
#endif
}