[compiler-rt] eb5c0a9 - [dfsan] Test IGN and DFL for sigaction
Jianzhou Zhao via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 10:47:05 PST 2021
Author: Jianzhou Zhao
Date: 2021-02-03T18:46:49Z
New Revision: eb5c0a90e7d96325cfc537629bef769448eb9b71
URL: https://github.com/llvm/llvm-project/commit/eb5c0a90e7d96325cfc537629bef769448eb9b71
DIFF: https://github.com/llvm/llvm-project/commit/eb5c0a90e7d96325cfc537629bef769448eb9b71.diff
LOG: [dfsan] Test IGN and DFL for sigaction
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D95957
Added:
Modified:
compiler-rt/test/dfsan/custom.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/dfsan/custom.cpp b/compiler-rt/test/dfsan/custom.cpp
index 94ca7a82a825..9129eff72bae 100644
--- a/compiler-rt/test/dfsan/custom.cpp
+++ b/compiler-rt/test/dfsan/custom.cpp
@@ -847,10 +847,23 @@ void test_sigaction() {
struct sigaction oldact;
assert(0 == sigaction(SIGUSR1, &newact_with_sighandler, &oldact));
assert(oldact.sa_sigaction == SignalAction);
+ assert(oldact.sa_flags & SA_SIGINFO);
+
+ // Set SIG_IGN or SIG_DFL, and check the previous one is expected.
+ newact_with_sighandler.sa_handler = SIG_IGN;
+ assert(0 == sigaction(SIGUSR1, &newact_with_sighandler, &oldact));
+ assert(oldact.sa_handler == SignalHandler);
+ assert((oldact.sa_flags & SA_SIGINFO) == 0);
+
+ newact_with_sighandler.sa_handler = SIG_DFL;
+ assert(0 == sigaction(SIGUSR1, &newact_with_sighandler, &oldact));
+ assert(oldact.sa_handler == SIG_IGN);
+ assert((oldact.sa_flags & SA_SIGINFO) == 0);
// Restore sigaction to the orginal setting, check the last one is SignalHandler
assert(0 == sigaction(SIGUSR1, &origin_act, &oldact));
- assert(oldact.sa_handler == SignalHandler);
+ assert(oldact.sa_handler == SIG_DFL);
+ assert((oldact.sa_flags & SA_SIGINFO) == 0);
}
void test_signal() {
More information about the llvm-commits
mailing list