[compiler-rt] Fix prctl test to execute all test cases if the first condition fails. (PR #102987)

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 17:12:11 PDT 2024


https://github.com/kstoimenov created https://github.com/llvm/llvm-project/pull/102987

None

>From e335e5bc3180903b6aa704f3cc3f94c7f2256ca5 Mon Sep 17 00:00:00 2001
From: Kirill Stoimenov <kstoimenov at google.com>
Date: Mon, 12 Aug 2024 23:59:47 +0000
Subject: [PATCH] Fix prctl test to execute all test cases if the first
 condition fails.

---
 .../sanitizer_common/TestCases/Linux/prctl.cpp   | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp
index d5d81280e0b44c..f33aa2004db79e 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp
@@ -25,20 +25,18 @@
 #endif
 
 int main() {
-
   int res;
   res = prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, 0, 0, 0);
   if (res < 0) {
     assert(errno == EINVAL || errno == ENODEV);
-    return 0;
-  }
-
-  uint64_t cookie = 0;
-  res = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 0, 0, &cookie);
-  if (res < 0) {
-    assert(errno == EINVAL);
   } else {
-    assert(cookie != 0);
+    uint64_t cookie = 0;
+    res = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 0, 0, &cookie);
+    if (res < 0) {
+      assert(errno == EINVAL);
+    } else {
+      assert(cookie != 0);
+    }
   }
 
   char invname[81], vlname[] = "prctl";



More information about the llvm-commits mailing list