Skip to content

Commit d52e617

Browse files
author
Thomas Preud'homme
committed
[LNT] Python 3 support: don't assume order of cmake args
Summary: runtest/test_suite-cache.shtest test assumes the order of cmake arguments but some of these are stored in the same dictionary which does not guarantee any specific ordering. This causes the test to fail on Python 3. In particular, CMAKE_C_COMPILER and CMAKE_CXX_COMPILER must come first but can be in any particular order between each other, then cmake cache option is expected to come next followed by other option in any particular order. Since there is no good reason to have arguments in a given group of option sorted, this commit adapts the testcase to accept any order by testing each group of argument in a separate FileCheck invocation. Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls, leandron, PrzemekWirkus, rogfer01 Reviewed By: rogfer01 Subscribers: rogfer01, llvm-commits Differential Revision: https://reviews.llvm.org/D68863
1 parent c57e3b0 commit d52e617

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tests/runtest/test_suite-cache.shtest

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,23 @@
1414
# RUN: --cmake-define FOO=BAR \
1515
# RUN: -D BAR=BAZ \
1616
# RUN: &> %t.cmake-cache.log
17-
# RUN: FileCheck --check-prefix CHECK-CACHE < %t.cmake-cache.log %s
18-
# CHECK-CACHE: Execute: {{.*}}cmake -DCMAKE_CXX_COMPILER:FILEPATH={{.*}}/FakeCompilers/clang++-r154331 -DCMAKE_C_COMPILER:FILEPATH={{.*}}FakeCompilers/clang-r154331 -C {{.*}}/Release.cmake {{.*}}-DFOO=BAR{{.*}}-DBAR=BAZ
17+
18+
# Check CMAKE_C_COMPILER and CMAKE_CXX_COMPILER comes first, followed by cmake
19+
# options. This is verified by checking that:
20+
# 1) there's 2 cmake compiler definition followed by the -C option
21+
# 2) each of the cmake compiler definition only accepts the other cmake
22+
# compiler definition between cmake and itself
23+
# RUN: FileCheck --check-prefix CHECK-CACHE1 < %t.cmake-cache.log %s
24+
# CHECK-CACHE1: Execute: {{.*}}cmake -DCMAKE_C{{(XX)?}}_COMPILER:FILEPATH={{.*}}/FakeCompilers/clang{{(\+\+)?}}-r154331 -DCMAKE_C{{(XX)?}}_COMPILER:FILEPATH={{.*}}/FakeCompilers/clang{{(\+\+)?}}-r154331 -C {{.*}}/Release.cmake
25+
# RUN: FileCheck --check-prefix CHECK-CACHE2 < %t.cmake-cache.log %s
26+
# CHECK-CACHE2: Execute: {{.*}}cmake {{(-DCMAKE_CXX_COMPILER:FILEPATH=.*/FakeCompilers/clang\+\+-r154331 )?}}-DCMAKE_C_COMPILER:FILEPATH={{.*}}/FakeCompilers/clang-r154331
27+
# RUN: FileCheck --check-prefix CHECK-CACHE3 < %t.cmake-cache.log %s
28+
# CHECK-CACHE3: Execute: {{.*}}cmake {{(-DCMAKE_C_COMPILER:FILEPATH=.*/FakeCompilers/clang-r154331 )?}}-DCMAKE_CXX_COMPILER:FILEPATH={{.*}}/FakeCompilers/clang++-r154331
29+
30+
# RUN: FileCheck --check-prefix CHECK-CACHE4 < %t.cmake-cache.log %s
31+
# CHECK-CACHE4: Execute: {{.*}}cmake {{(.+ )?}}-DFOO=BAR
32+
# RUN: FileCheck --check-prefix CHECK-CACHE5 < %t.cmake-cache.log %s
33+
# CHECK-CACHE5: Execute: {{.*}}cmake {{(.+ )?}}-DBAR=BAZ
1934

2035
# RUN: rm -rf %t.SANDBOX
2136
# Check a run of test-suite using a invalid cmake cache
@@ -29,5 +44,5 @@
2944
# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
3045
# RUN: --cmake-cache Debug \
3146
# RUN: &> %t.cmake-cache2.err || true
32-
# RUN: FileCheck --check-prefix CHECK-CACHE2 < %t.cmake-cache2.err %s
33-
# CHECK-CACHE2: Could not find CMake cache file
47+
# RUN: FileCheck --check-prefix CHECK-CACHE6 < %t.cmake-cache2.err %s
48+
# CHECK-CACHE6: Could not find CMake cache file

0 commit comments

Comments
 (0)