Skip to content

Commit

Permalink
Skipping thead and address sanitiziers checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedAlaa2024 committed Nov 16, 2023
1 parent 7aea7d1 commit c01ef91
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
5 changes: 5 additions & 0 deletions source/tests/metacall_sandbox_plugin_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit c01ef91

Please sign in to comment.