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

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 17:12:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Kirill Stoimenov (kstoimenov)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/102987.diff


1 Files Affected:

- (modified) compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp (+7-9) 


``````````diff
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";

``````````

</details>


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


More information about the llvm-commits mailing list