Skip to content

Commit 865f1bf

Browse files
gottesmmfinagolfin
authored andcommitted
[build-script] Add test for --skip-build-* options and a lit variable for cmake
This was backported from a313f62 with all the --infer and --install-all work there left out, bringing back a single test and the lit variable for cmake that it used. One note describing that from the original commit: 2. I added %cmake as a lit variable. I did this so I could specify in my build-system unit tests that on Linux they should use the just built cmake (if we built cmake due to an old cmake being on the system). Otherwise, the build system unit tests took way too long. These are meant to be dry-runs, so building this cmake again is just wasteful and doesn't make sense.
1 parent a176d64 commit 865f1bf

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

test/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ config.test_source_root = os.path.dirname(__file__)
199199
# test_exec_root: The root path where tests should be run.
200200
swift_obj_root = getattr(config, 'swift_obj_root', None)
201201

202+
# cmake. The path to the cmake executable we used to configure swift.
203+
assert(config.cmake)
204+
config.substitutions.append( ('%cmake', config.cmake) )
205+
lit_config.note('Using cmake: ' + config.cmake)
206+
202207
# Set llvm_{src,obj}_root for use by others.
203208
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
204209
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)

test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import os
1414
import platform
1515
import sys
1616

17+
config.cmake = "@CMAKE_COMMAND@"
1718
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1819
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
1920
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

utils/swift_build_support/swift_build_support/cmake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def check_cmake_version(self, source_root, build_root):
272272
cmake_binary = 'cmake'
273273

274274
installed_ver = self.installed_cmake_version(cmake_binary)
275-
if installed_ver > self.cmake_source_version(cmake_source_dir):
275+
if installed_ver >= self.cmake_source_version(cmake_source_dir):
276276
return
277277
else:
278278
# Build CMake from source and return the path to the executable.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: %empty-directory(%t)
2+
# RUN: mkdir -p %t
3+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-cmark 2>&1 | %FileCheck --check-prefix=SKIP-CMARK-CHECK %s
4+
5+
# RUN: %empty-directory(%t)
6+
# RUN: mkdir -p %t
7+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-llvm 2>&1 | %FileCheck --check-prefix=SKIP-LLVM-CHECK %s
8+
9+
# RUN: %empty-directory(%t)
10+
# RUN: mkdir -p %t
11+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-swift 2>&1 | %FileCheck --check-prefix=SKIP-SWIFT-CHECK %s
12+
13+
# SKIP-CMARK-CHECK-NOT: cmake --build {{.*}}cmark-
14+
# SKIP-CMARK-CHECK: cmake --build {{.*}}llvm-
15+
# SKIP-CMARK-CHECK: cmake --build {{.*}}swift-
16+
17+
# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark-
18+
# SKIP-LLVM-CHECK-NOT: cmake --build {{.*}}llvm-
19+
# SKIP-LLVM-CHECK: cmake --build {{.*}}swift-
20+
21+
# SKIP-SWIFT-CHECK: cmake --build {{.*}}cmark-
22+
# SKIP-SWIFT-CHECK: cmake --build {{.*}}llvm-
23+
# SKIP-SWIFT-CHECK-NOT: cmake --build {{.*}}swift-
24+

validation-test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sys
1414
import platform
1515

16+
config.cmake = "@CMAKE_COMMAND@"
1617
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1718
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
1819
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

0 commit comments

Comments
 (0)