From c01ef919d19d08004bee1c1357b83b5ea233d1b7 Mon Sep 17 00:00:00 2001 From: AhmedAlaa2024 Date: Thu, 16 Nov 2023 21:35:13 +0200 Subject: [PATCH] Skipping thead and address sanitiziers checks --- .../CMakeLists.txt | 5 ++ .../source/metacall_sandbox_plugin_test.cpp | 48 +++++++++---------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt index 36ad6e331..7ff00d8ca 100644 --- a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt @@ -12,6 +12,11 @@ endif() # Thread Sanitizer deadlocks with ASSERT_EXIT (TODO: Review this when fork safety is implemented in sandbox_plugin) if(OPTION_BUILD_THREAD_SANITIZER) + return() +endif() + +# TODO: Test if we can make it run properly with use_sigaltstack=1 (https://groups.google.com/a/chromium.org/g/chromium-reviews/c/xX4xDy21714/m/1yKX1JLE620J) +if(OPTION_BUILD_ADDRESS_SANITIZER) return() endif() diff --git a/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp b/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp index 79eb5f292..517103cd5 100644 --- a/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp +++ b/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp @@ -293,41 +293,41 @@ TEST_F(metacall_sandbox_plugin_test, DefaultConstructor) } /* [Note] This test blocks all the gtest context, so you should comment it to allow testing for other test cases */ -// TEST_F(metacall_sandbox_plugin_test, SANDBOX_IO_DISABLE_TEST) -// { -// ASSERT_EQ((int)0, (int)metacall_initialize()); +TEST_F(metacall_sandbox_plugin_test, SANDBOX_IO_DISABLE_TEST) +{ + ASSERT_EQ((int)0, (int)metacall_initialize()); -// void *sandbox_ctx, *handle = metacall_plugin_extension(); + void *sandbox_ctx, *handle = metacall_plugin_extension(); -// /* Initialize sandboxing */ -// { -// void *args[1] = { metacall_value_create_bool(1L) /* Allow */ }; + /* Initialize sandboxing */ + { + void *args[1] = { metacall_value_create_bool(1L) /* Allow */ }; -// sandbox_ctx = metacallhv_s(handle, "sandbox_initialize", args, 1); + sandbox_ctx = metacallhv_s(handle, "sandbox_initialize", args, 1); -// EXPECT_NE((void *)NULL, (void *)sandbox_ctx); -// EXPECT_NE((void *)metacall_value_to_ptr(sandbox_ctx), (void *)NULL); + EXPECT_NE((void *)NULL, (void *)sandbox_ctx); + EXPECT_NE((void *)metacall_value_to_ptr(sandbox_ctx), (void *)NULL); -// metacall_value_destroy(args[0]); -// } + metacall_value_destroy(args[0]); + } -// /* Generate a syscall exception when trying to execute fopen */ -// ASSERT_EXIT({ invalid_io_syscall(sandbox_ctx, handle); }, testing::KilledBySignal(SIGSYS), ""); + /* Generate a syscall exception when trying to execute fopen */ + ASSERT_EXIT({ invalid_io_syscall(sandbox_ctx, handle); }, testing::KilledBySignal(SIGSYS), ""); -// /* Destroy sandboxing */ -// { -// void *args[1] = { sandbox_ctx }; + /* Destroy sandboxing */ + { + void *args[1] = { sandbox_ctx }; -// void *ret = metacallhv_s(handle, "sandbox_destroy", args, 1); + void *ret = metacallhv_s(handle, "sandbox_destroy", args, 1); -// EXPECT_NE((void *)NULL, (void *)ret); -// EXPECT_EQ((int)metacall_value_to_int(ret), (int)0); + EXPECT_NE((void *)NULL, (void *)ret); + EXPECT_EQ((int)metacall_value_to_int(ret), (int)0); -// metacall_value_destroy(args[0]); -// } + metacall_value_destroy(args[0]); + } -// EXPECT_EQ((int)0, (int)metacall_destroy()); -// } + EXPECT_EQ((int)0, (int)metacall_destroy()); +} TEST_F(metacall_sandbox_plugin_test, SANDBOX_SOCKETS_DISABLE_TEST) {