On aarch64 when running tst-threadcomplete.cc on single cpu, OSv crashes with
the page fault when accessing 2nd cpu to pin some threads to.

Therefore this patch changes this test (just like tst-pin.cc) to disable
and warn the part exercising pinning cannot be run on single CPU.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 tests/tst-threadcomplete.cc | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/tst-threadcomplete.cc b/tests/tst-threadcomplete.cc
index 71c8af1f..67fb12ec 100644
--- a/tests/tst-threadcomplete.cc
+++ b/tests/tst-threadcomplete.cc
@@ -129,10 +129,16 @@ int main(int ac, char** av)
     do_test(true);
     std::cerr << "Starting join tests...\n";
     do_test(false);
-    std::cerr << "Starting thread-on-heap tests... (no load)\n";
-    do_heap_test(false);
-    std::cerr << "Starting thread-on-heap tests... (loaded)\n";
-    do_heap_test(true);
+    if (sched::cpus.size() >= 2) {
+        std::cerr << "Starting thread-on-heap tests... (no load)\n";
+        do_heap_test(false);
+        std::cerr << "Starting thread-on-heap tests... (loaded)\n";
+        do_heap_test(true);
+    } else {
+        // This test cannot be run on only one CPU, because we want to see
+        // the effect of pinning threads to different CPUs.
+        std::cout << "Cannot run the thread-on-heap tests with only one 
CPU.\n";
+    }
     std::cerr << "Passed\n";
 }
 
-- 
2.29.2

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20210203041449.945828-1-jwkozaczuk%40gmail.com.

Reply via email to