summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-01-15 13:01:21 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-15 13:03:58 -0800
commitf03144d886791afcdd37962388e9a6294a08c49f (patch)
tree0c23b8a254f9af076e2facb040cf06a1f22e3d9d /test/syscalls
parentf1420cf48418c01694eaf3110ac411915b217d36 (diff)
Support TEST_PREMATURE_EXIT_FILE in syscall tests
PiperOrigin-RevId: 352068182
Diffstat (limited to 'test/syscalls')
-rw-r--r--test/syscalls/linux/fault.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/syscalls/linux/fault.cc b/test/syscalls/linux/fault.cc
index a85750382..bd87d5e60 100644
--- a/test/syscalls/linux/fault.cc
+++ b/test/syscalls/linux/fault.cc
@@ -52,6 +52,13 @@ void sigact_handler(int sig, siginfo_t* siginfo, void* context) {
uintptr_t fault_addr = reinterpret_cast<uintptr_t>(&Fault);
EXPECT_GE(pc, fault_addr);
EXPECT_LT(pc, fault_addr + 64);
+
+ // The following file is used to detect tests that exit prematurely. Since
+ // we need to call exit() here, delete the file by hand.
+ const char* exit_file = getenv("TEST_PREMATURE_EXIT_FILE");
+ if (exit_file != nullptr) {
+ ASSERT_THAT(unlink(exit_file), SyscallSucceeds());
+ }
exit(0);
}
}