[compiler-rt] 8feeba6 - [scudo] Allow using a different test main.

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 11:03:33 PDT 2023


Author: Christopher Ferris
Date: 2023-09-12T11:03:18-07:00
New Revision: 8feeba643d25747a0a4b850539e38b1ef8228264

URL: https://github.com/llvm/llvm-project/commit/8feeba643d25747a0a4b850539e38b1ef8228264
DIFF: https://github.com/llvm/llvm-project/commit/8feeba643d25747a0a4b850539e38b1ef8228264.diff

LOG: [scudo] Allow using a different test main.

Fuchsia already uses a different main function for tests, so allow
anybody to use this mechanism.

Specifically, Android has a test main that allows tests to be run
in isolation and in parallel which speeds up the unit test runs
from ~14 seconds to ~4 seconds.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D159501

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
    compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
index 1665fa87e5f20e4..4283416435ba0cf 100644
--- a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
+++ b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
@@ -45,4 +45,10 @@ using Test = ::testing::Test;
 #define SKIP_NO_DEBUG(T) DISABLED_##T
 #endif
 
+#if SCUDO_FUCHSIA
+// The zxtest library provides a default main function that does the same thing
+// for Fuchsia builds.
+#define SCUDO_NO_TEST_MAIN
+#endif
+
 extern bool UseQuarantine;

diff  --git a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp
index fbfefa5c93d5490..881e0265bb3419c 100644
--- a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test_main.cpp
@@ -45,9 +45,7 @@ __scudo_default_options() {
          "dealloc_type_mismatch=" DEALLOC_TYPE_MISMATCH;
 }
 
-// The zxtest library provides a default main function that does the same thing
-// for Fuchsia builds.
-#if !SCUDO_FUCHSIA
+#if !defined(SCUDO_NO_TEST_MAIN)
 int main(int argc, char **argv) {
   EnableMemoryTaggingIfSupported();
   testing::InitGoogleTest(&argc, argv);


        


More information about the llvm-commits mailing list