Fix up failing glibc tests.
There is a known bug running clone with the CLONE_VM flag, so for host
create an empty test.
Change the expected output of the stdio test for a glibc difference.
Change the pause test to use ScopedSignalHandler to setup/restore the SIGALRM
handler.
After this, running bionic-unit-tests-glibc passes for all tests.
Bug: 11389824
Change-Id: Ib304eae4164115835a54991dfdca5821ecc3db5e
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 7705e2c..a7e5b9a 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -19,6 +19,8 @@
#include <errno.h>
#include <signal.h>
+#include "ScopedSignalHandler.h"
+
static size_t SIGNAL_MIN() {
return 1; // Signals start at 1 (SIGHUP), not 0.
}
@@ -85,25 +87,6 @@
ASSERT_EQ(0, errno);
}
-class ScopedSignalHandler {
- public:
- ScopedSignalHandler(int signal_number, void (*handler)(int)) : signal_number_(signal_number) {
- sigemptyset(&action_.sa_mask);
- action_.sa_flags = 0;
- action_.sa_handler = handler;
- sigaction(signal_number_, &action_, &old_action_);
- }
-
- ~ScopedSignalHandler() {
- sigaction(signal_number_, &old_action_, NULL);
- }
-
- private:
- struct sigaction action_;
- struct sigaction old_action_;
- const int signal_number_;
-};
-
TEST(signal, sigismember_invalid) {
TestSigSet2(sigismember);
}