From 15a6a41cb87e48b963043e7c975cb6ebaea9f787 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Mon, 16 Dec 2024 22:21:13 -0800 Subject: [PATCH] Revert unintended modifications in last commit --- test/libc/intrin/pthread_mutex_lock_test.c | 43 +++++++++---------- test/libc/system/popen_test.c | 2 +- .../pthread_cancel_deferred_cond_test.c | 2 - test/posix/file_offset_exec_test.c | 3 -- test/posix/interprocess_signaling_test.c | 3 -- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/test/libc/intrin/pthread_mutex_lock_test.c b/test/libc/intrin/pthread_mutex_lock_test.c index ffecfe9f7b4..0a5514a983e 100644 --- a/test/libc/intrin/pthread_mutex_lock_test.c +++ b/test/libc/intrin/pthread_mutex_lock_test.c @@ -197,28 +197,27 @@ TEST(pthread_mutex_lock, rcontention) { EXPECT_EQ(0, pthread_mutex_destroy(&mylock)); } -/* TEST(pthread_mutex_lock, econtention) { */ -/* int i; */ -/* pthread_mutexattr_t attr; */ -/* pthread_mutexattr_init(&attr); */ -/* pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); */ -/* pthread_mutex_init(&mylock, &attr); */ -/* pthread_mutexattr_destroy(&attr); */ -/* count = 0; */ -/* started = 0; */ -/* finished = 0; */ -/* for (i = 0; i < THREADS; ++i) { */ -/* ASSERT_NE(-1, pthread_create(th + i, 0, MutexWorker, (void - * *)(intptr_t)i)); */ -/* } */ -/* for (i = 0; i < THREADS; ++i) { */ -/* pthread_join(th[i], 0); */ -/* } */ -/* EXPECT_EQ(THREADS, started); */ -/* EXPECT_EQ(THREADS, finished); */ -/* EXPECT_EQ(THREADS * ITERATIONS, count); */ -/* EXPECT_EQ(0, pthread_mutex_destroy(&mylock)); */ -/* } */ +TEST(pthread_mutex_lock, econtention) { + int i; + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); + pthread_mutex_init(&mylock, &attr); + pthread_mutexattr_destroy(&attr); + count = 0; + started = 0; + finished = 0; + for (i = 0; i < THREADS; ++i) { + ASSERT_NE(-1, pthread_create(th + i, 0, MutexWorker, (void *)(intptr_t)i)); + } + for (i = 0; i < THREADS; ++i) { + pthread_join(th[i], 0); + } + EXPECT_EQ(THREADS, started); + EXPECT_EQ(THREADS, finished); + EXPECT_EQ(THREADS * ITERATIONS, count); + EXPECT_EQ(0, pthread_mutex_destroy(&mylock)); +} void *SpinlockWorker(void *p) { int i; diff --git a/test/libc/system/popen_test.c b/test/libc/system/popen_test.c index ef37402b9a0..cf9a5d048c6 100644 --- a/test/libc/system/popen_test.c +++ b/test/libc/system/popen_test.c @@ -159,7 +159,7 @@ void *Worker(void *arg) { } TEST(popen, torture) { - int i, n = 40; + int i, n = 4; pthread_t *t = gc(malloc(sizeof(pthread_t) * n)); testlib_extract("/zip/echo", "echo", 0755); for (i = 0; i < n; ++i) diff --git a/test/libc/thread/pthread_cancel_deferred_cond_test.c b/test/libc/thread/pthread_cancel_deferred_cond_test.c index 90d00b02964..4bba81a1838 100644 --- a/test/libc/thread/pthread_cancel_deferred_cond_test.c +++ b/test/libc/thread/pthread_cancel_deferred_cond_test.c @@ -13,7 +13,6 @@ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include #include #include #include @@ -38,7 +37,6 @@ void* worker(void* arg) { } int main(int argc, char* argv[]) { - ShowCrashReports(); void* rc; pthread_t th; pthread_mutexattr_t at; diff --git a/test/posix/file_offset_exec_test.c b/test/posix/file_offset_exec_test.c index adbe1f6173a..aafc9061ae7 100644 --- a/test/posix/file_offset_exec_test.c +++ b/test/posix/file_offset_exec_test.c @@ -13,7 +13,6 @@ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include #include #include #include @@ -37,8 +36,6 @@ void on_unexpected_death(int sig) { } int main() { - GetSymbolTable(); - ShowCrashReports(); signal(SIGCHLD, on_unexpected_death); // extract test program diff --git a/test/posix/interprocess_signaling_test.c b/test/posix/interprocess_signaling_test.c index 08176da90df..d6372492e4a 100644 --- a/test/posix/interprocess_signaling_test.c +++ b/test/posix/interprocess_signaling_test.c @@ -13,7 +13,6 @@ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include #include #include #include @@ -27,8 +26,6 @@ void onsig(int sig) { int main(int argc, char *argv[]) { - ShowCrashReports(); - // create process shared memory got = mmap(0, 4, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (got == MAP_FAILED)