[libc-commits] [libc] 99a493e - [libc] Make hermetic test depend on the unit test if it exists.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Wed May 24 23:27:09 PDT 2023
Author: Siva Chandra Reddy
Date: 2023-05-25T06:27:00Z
New Revision: 99a493e3e3ee72ac18b8bffb9056f7fc5ddf11c6
URL: https://github.com/llvm/llvm-project/commit/99a493e3e3ee72ac18b8bffb9056f7fc5ddf11c6
DIFF: https://github.com/llvm/llvm-project/commit/99a493e3e3ee72ac18b8bffb9056f7fc5ddf11c6.diff
LOG: [libc] Make hermetic test depend on the unit test if it exists.
We want to do this so that build system like ninja don't end up running
the hermetic and unit tests in parallel. Running in parallel can cause
problems for tests which read/write disk files as the hermetic and unit
tests can end up stepping on each other.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D151291
Added:
Modified:
libc/cmake/modules/LLVMLibCTestRules.cmake
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 90ffef88ac333..9c94973a2f921 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -740,5 +740,12 @@ function(add_libc_test test_name)
endif()
if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
add_libc_hermetic_test(${test_name}.__hermetic__ ${LIBC_TEST_UNPARSED_ARGUMENTS})
+ get_fq_target_name(${test_name} fq_test_name)
+ if(TARGET ${fq_test_name}.__unit__)
+ # Tests like the file tests perform file operations on disk file. If we
+ # don't chain up the unit test and hermetic test, then those tests will
+ # step on each other's files.
+ add_dependencies(${fq_test_name}.__hermetic__ ${fq_test_name}.__unit__)
+ endif()
endif()
endfunction(add_libc_test)
More information about the libc-commits
mailing list