diff options
author | Colin Cross <ccross@android.com> | 2021-07-28 11:18:11 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2021-08-12 11:13:11 -0700 |
commit | 7da20341e91a4ece30f628fb91fbc6056c9c8a7c (patch) | |
tree | 51db1cace0a75ac9e33aef1efb36e3f1d6832c67 /tests/time_test.cpp | |
parent | 4c92da431155174c6bfef91c227fe34becb340c0 (diff) |
Build bionic unit tests for musl
Modify bionic unit tests that are built for glibc so that they also
build against musl. They don't all pass though:
With glibc:
2 SLOW TESTS
4 TIMEOUT TESTS
313 FAILED TESTS
YOU HAVE 2 DISABLED TESTS
With musl:
11 SLOW TESTS
11 TIMEOUT TESTS
363 FAILED TESTS
YOU HAVE 2 DISABLED TESTS
Bug: 190084016
Test: m bionic-unit-tests-glibc with musl
Test: atest bionic-unit-tests-static
Test: atest --host bionic-unit-tests-glibc with glibc
Change-Id: I79b6eab04fed3cc4392450df5eef2579412edfe1
Diffstat (limited to 'tests/time_test.cpp')
-rw-r--r-- | tests/time_test.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/time_test.cpp b/tests/time_test.cpp index b16fe16bc..932af9ee0 100644 --- a/tests/time_test.cpp +++ b/tests/time_test.cpp @@ -282,6 +282,7 @@ TEST(time, strptime) { } TEST(time, strptime_l) { +#if !defined(MUSL) setenv("TZ", "UTC", 1); struct tm t; @@ -296,6 +297,9 @@ TEST(time, strptime_l) { strptime_l("09:41:53", "%T", &t, LC_GLOBAL_LOCALE); strftime_l(buf, sizeof(buf), "%H:%M:%S", &t, LC_GLOBAL_LOCALE); EXPECT_STREQ("09:41:53", buf); +#else + GTEST_SKIP() << "musl doesn't support strptime_l"; +#endif } TEST(time, strptime_F) { @@ -469,11 +473,11 @@ void SetTime(timer_t t, time_t value_s, time_t value_ns, time_t interval_s, time ASSERT_EQ(0, timer_settime(t, 0, &ts, nullptr)); } -static void NoOpNotifyFunction(sigval_t) { +static void NoOpNotifyFunction(sigval) { } TEST(time, timer_create) { - sigevent_t se; + sigevent se; memset(&se, 0, sizeof(se)); se.sigev_notify = SIGEV_THREAD; se.sigev_notify_function = NoOpNotifyFunction; @@ -502,7 +506,7 @@ static void timer_create_SIGEV_SIGNAL_signal_handler(int signal_number) { } TEST(time, timer_create_SIGEV_SIGNAL) { - sigevent_t se; + sigevent se; memset(&se, 0, sizeof(se)); se.sigev_notify = SIGEV_SIGNAL; se.sigev_signo = SIGUSR1; @@ -530,7 +534,7 @@ struct Counter { private: std::atomic<int> value; timer_t timer_id; - sigevent_t se; + sigevent se; bool timer_valid; void Create() { @@ -540,7 +544,7 @@ struct Counter { } public: - explicit Counter(void (*fn)(sigval_t)) : value(0), timer_valid(false) { + explicit Counter(void (*fn)(sigval)) : value(0), timer_valid(false) { memset(&se, 0, sizeof(se)); se.sigev_notify = SIGEV_THREAD; se.sigev_notify_function = fn; @@ -575,12 +579,12 @@ struct Counter { return current_value != value; } - static void CountNotifyFunction(sigval_t value) { + static void CountNotifyFunction(sigval value) { Counter* cd = reinterpret_cast<Counter*>(value.sival_ptr); ++cd->value; } - static void CountAndDisarmNotifyFunction(sigval_t value) { + static void CountAndDisarmNotifyFunction(sigval value) { Counter* cd = reinterpret_cast<Counter*>(value.sival_ptr); ++cd->value; @@ -644,7 +648,7 @@ TEST(time, timer_create_EINVAL) { ASSERT_EQ(EINVAL, errno); // A SIGEV_THREAD timer is more interesting because we have stuff to clean up. - sigevent_t se; + sigevent se; memset(&se, 0, sizeof(se)); se.sigev_notify = SIGEV_THREAD; se.sigev_notify_function = NoOpNotifyFunction; @@ -715,7 +719,7 @@ struct TimerDeleteData { volatile bool complete; }; -static void TimerDeleteCallback(sigval_t value) { +static void TimerDeleteCallback(sigval value) { TimerDeleteData* tdd = reinterpret_cast<TimerDeleteData*>(value.sival_ptr); tdd->tid = gettid(); @@ -725,7 +729,7 @@ static void TimerDeleteCallback(sigval_t value) { TEST(time, timer_delete_from_timer_thread) { TimerDeleteData tdd; - sigevent_t se; + sigevent se; memset(&se, 0, sizeof(se)); se.sigev_notify = SIGEV_THREAD; |