From a277170c9a9f775e6ef51f052cf971c7f1772575 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 13 Nov 2022 14:26:19 -0800 Subject: [PATCH] Make kprintf_test resistant to limbo --- test/libc/intrin/kprintf_test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/libc/intrin/kprintf_test.c b/test/libc/intrin/kprintf_test.c index ab6c64a11..aed2c997b 100644 --- a/test/libc/intrin/kprintf_test.c +++ b/test/libc/intrin/kprintf_test.c @@ -245,13 +245,16 @@ TEST(ksnprintf, fuzzTheUnbreakable) { TEST(kprintf, testFailure_wontClobberErrnoAndBypassesSystemCallSupport) { int n; + const char *s = 0; ASSERT_EQ(0, errno); EXPECT_SYS(0, 3, dup(2)); - EXPECT_SYS(0, 0, close(2)); + // + if (close(2)) _Exit(200); n = __syscount; - EXPECT_EQ(n, __syscount); - EXPECT_EQ(0, errno); - EXPECT_SYS(0, 2, dup2(3, 2)); + if (__syscount != n) _Exit(201); + if (errno != 0) _Exit(202); + if (dup2(3, 2) != 2) _Exit(203); + // EXPECT_SYS(0, 0, close(3)); }