#include <optional>
#include "include/v8config.h"
#if V8_OS_POSIX && !V8_OS_FUCHSIA
#include <signal.h>
#endif
#include "src/base/macros.h"
#include "src/flags/flags.h"
#include "src/wasm/code-space-access.h"
#include "src/wasm/module-compiler.h"
#include "src/wasm/module-decoder.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-features.h"
#include "src/wasm/wasm-opcodes.h"
#include "test/common/wasm/wasm-macro-gen.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
namespace v8::internal::wasm {
enum MemoryProtectionMode { … };
const char* MemoryProtectionModeToString(MemoryProtectionMode mode) { … }
class MemoryProtectionTest : public TestWithNativeContext { … };
class ParameterizedMemoryProtectionTest
: public MemoryProtectionTest,
public ::testing::WithParamInterface<MemoryProtectionMode> { … };
std::string PrintMemoryProtectionTestParam(
::testing::TestParamInfo<MemoryProtectionMode> info) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ParameterizedMemoryProtectionTest, CodeNotWritableAfterCompilation) { … }
TEST_P(ParameterizedMemoryProtectionTest, CodeWritableWithinScope) { … }
TEST_P(ParameterizedMemoryProtectionTest, CodeNotWritableAfterScope) { … }
#if V8_OS_POSIX && !V8_OS_FUCHSIA
class ParameterizedMemoryProtectionTestWithSignalHandling
: public MemoryProtectionTest,
public ::testing::WithParamInterface<
std::tuple<MemoryProtectionMode, bool, bool>> { … };
ParameterizedMemoryProtectionTestWithSignalHandling::SignalHandlerScope*
ParameterizedMemoryProtectionTestWithSignalHandling::SignalHandlerScope::
current_handler_scope_ = …;
std::string PrintMemoryProtectionAndSignalHandlingTestParam(
::testing::TestParamInfo<std::tuple<MemoryProtectionMode, bool, bool>>
info) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ParameterizedMemoryProtectionTestWithSignalHandling, TestSignalHandler) { … }
#endif
}