Skip to content

Commit 0a8f96a

Browse files
committed
CI fixes.
1 parent e7d6eca commit 0a8f96a

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

libcxx/test/libcxx/thread/thread.barrier/assert.arrive.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// UNSUPPORTED: no-threads
99
// UNSUPPORTED: c++03, c++11, c++14, c++17
1010
// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
11+
// Without the assertion, the test will most likely time out.
12+
// UNSUPPORTED: libcpp-assertion-semantic={{ignore|observe}}
1113

1214
// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
1315

libcxx/test/libcxx/thread/thread.latch/assert.arrive_and_wait.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
// REQUIRES: has-unix-headers
2020
// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
21+
// Without the assertion, the test will most likely time out.
22+
// UNSUPPORTED: libcpp-assertion-semantic={{ignore|observe}}
2123
// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
2224

2325
#include <latch>

libcxx/test/support/check_assertion.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ enum class DeathCause {
111111
// semantics).
112112
DidNotDie,
113113
Segfault,
114+
ArithmeticError,
114115
// Always invalid causes.
115116
SetupFailure,
116117
Unknown
@@ -152,6 +153,8 @@ std::string ToString(DeathCause cause) {
152153
return "<invalid cause (child did not die)>";
153154
case DeathCause::Segfault:
154155
return "<invalid cause (segmentation fault)>";
156+
case DeathCause::ArithmeticError:
157+
return "<invalid cause (fatal arithmetic error)>";
155158
case DeathCause::SetupFailure:
156159
return "<test setup error (child failed to set up test environment)>";
157160
case DeathCause::Unknown:
@@ -379,6 +382,9 @@ class DeathTest {
379382
if (exit_code_ == SIGSEGV) {
380383
return DeathCause::Segfault;
381384
}
385+
if (exit_code_ == SIGFPE) {
386+
return DeathCause::ArithmeticError;
387+
}
382388
}
383389

384390
return DeathCause::Unknown;

libcxx/test/support/test.support/test_check_assertion.pass.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ DeathCause assertion_death_cause = DeathCause::Trap;
7676
#endif
7777

7878
int main(int, char**) {
79-
auto fail_assert = [] { _LIBCPP_ASSERT(false, "Some message"); };
80-
Matcher good_matcher = MakeAssertionMessageMatcher("Some message");
81-
Matcher bad_matcher = MakeAssertionMessageMatcher("Bad expected message");
79+
[[maybe_unused]] auto fail_assert = [] { _LIBCPP_ASSERT(false, "Some message"); };
80+
Matcher good_matcher = MakeAssertionMessageMatcher("Some message");
81+
Matcher bad_matcher = MakeAssertionMessageMatcher("Bad expected message");
8282

8383
// Test the implementation of death tests. We're bypassing the assertions added by the actual `EXPECT_DEATH` macros
8484
// which allows us to test failure cases (where the assertion would fail) as well.
@@ -89,16 +89,22 @@ int main(int, char**) {
8989
// Success -- trapping.
9090
TEST_DEATH_TEST(Outcome::Success, DeathCause::Trap, __builtin_trap());
9191

92+
// `_LIBCPP_ASSERT` does not terminate the program if the `observe` semantic is used, so these tests would fail with
93+
// `DidNotDie` cause.
94+
#if _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
95+
9296
// Success -- assertion failure with any matcher.
9397
TEST_DEATH_TEST_MATCHES(Outcome::Success, assertion_death_cause, MakeAnyMatcher(), fail_assert());
9498

9599
// Success -- assertion failure with a specific matcher.
96100
TEST_DEATH_TEST_MATCHES(Outcome::Success, assertion_death_cause, good_matcher, fail_assert());
97101

98-
#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
102+
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
99103
// Failure -- error message doesn't match.
100104
TEST_DEATH_TEST_MATCHES(Outcome::UnexpectedErrorMessage, assertion_death_cause, bad_matcher, fail_assert());
101-
#endif
105+
# endif
106+
107+
#endif // _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
102108

103109
// Invalid cause -- child did not die.
104110
TEST_DEATH_TEST(Outcome::InvalidCause, DeathCause::DidNotDie, ((void)0));
@@ -125,7 +131,9 @@ int main(int, char**) {
125131
EXPECT_DEATH_MATCHES(simple_matcher, invoke_verbose_abort());
126132
EXPECT_STD_ABORT(invoke_abort());
127133
EXPECT_STD_TERMINATE([] { std::terminate(); });
134+
#if _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
128135
TEST_LIBCPP_ASSERT_FAILURE(fail_assert(), "Some message");
136+
#endif
129137
}
130138

131139
return 0;

0 commit comments

Comments
 (0)