[LNT] r263185 - Allow the user to specificy a test-suite cmake cache
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 18:15:07 PST 2016
Author: cmatthews
Date: Thu Mar 10 20:15:07 2016
New Revision: 263185
URL: http://llvm.org/viewvc/llvm-project?rev=263185&view=rev
Log:
Allow the user to specificy a test-suite cmake cache
I think cmake caches are a good way to represent common configurations.
This change allow the user to give a cmake cache on the command line,
and LNT will change the cmake command accordingly.
Modified:
lnt/trunk/lnt/tests/test_suite.py
lnt/trunk/tests/runtest/Inputs/test-suite-cmake/fake-cmake
lnt/trunk/tests/runtest/test_suite.py
Modified: lnt/trunk/lnt/tests/test_suite.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/test_suite.py?rev=263185&r1=263184&r2=263185&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/test_suite.py (original)
+++ lnt/trunk/lnt/tests/test_suite.py Thu Mar 10 20:15:07 2016
@@ -55,8 +55,11 @@ class TestSuiteTest(BuiltinTest):
help=("Defines to pass to cmake. These do not require the "
"-D prefix and can be given multiple times. e.g.: "
"--cmake-define A=B => -DA=B"))
+ group.add_option("-C", "--cmake-cache", dest="cmake_cache",
+ help=("Use one of the test-suite's cmake configurations."
+ " Ex: Release, Debug"))
parser.add_option_group(group)
-
+
group = OptionGroup(parser, "Test compiler")
group.add_option("", "--cc", dest="cc", metavar="CC",
type=str, default=None,
@@ -365,10 +368,21 @@ class TestSuiteTest(BuiltinTest):
for k,v in sorted(defs.items()):
lines.append(" %s: '%s'" % (k,v))
lines.append('}')
+
+ # Prepare cmake cache if requested:
+ cache = []
+ if self.opts.cmake_cache:
+ cache_path = os.path.join(self._test_suite_dir(),
+ "cmake/caches/", self.opts.cmake_cache + ".cmake")
+ if os.path.exists(cache_path):
+ cache = ['-C', cache_path]
+ else:
+ fatal("Could not find CMake cache file: " +
+ self.opts.cmake_cache + " in " + cache_path)
for l in lines:
note(l)
- self._check_call([cmake_cmd, self._test_suite_dir()] +
+ self._check_call([cmake_cmd] + cache + [self._test_suite_dir()] +
['-D%s=%s' % (k,v) for k,v in defs.items()],
cwd=path)
Modified: lnt/trunk/tests/runtest/Inputs/test-suite-cmake/fake-cmake
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/Inputs/test-suite-cmake/fake-cmake?rev=263185&r1=263184&r2=263185&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/Inputs/test-suite-cmake/fake-cmake (original)
+++ lnt/trunk/tests/runtest/Inputs/test-suite-cmake/fake-cmake Thu Mar 10 20:15:07 2016
@@ -1,5 +1,11 @@
#!/bin/bash
+# If we passed a cache, just drop it and look like cmake.
+if [[ $1 == "-C" ]]; then
+ echo "Cmake Cache $2"
+ shift
+ shift
+fi
if [[ ! -f $1/CMakeLists.txt ]]; then
exit 1
else
Modified: lnt/trunk/tests/runtest/test_suite.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/test_suite.py?rev=263185&r1=263184&r2=263185&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/test_suite.py (original)
+++ lnt/trunk/tests/runtest/test_suite.py Thu Mar 10 20:15:07 2016
@@ -300,3 +300,33 @@
# RUN: --run-order=123 > %t.log 2> %t.err
# RUN: FileCheck --check-prefix CHECK-RESULTS-FAIL < %t.SANDBOX/build/report.json %s
# CHECK-RESULTS-FAIL: "run_order": "123"
+
+# Check a run of test-suite using a cmake cache
+# RUN: lnt runtest test-suite \
+# RUN: --sandbox %t.SANDBOX \
+# RUN: --no-timestamp \
+# RUN: --test-suite %S/Inputs/test-suite-cmake \
+# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN: --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
+# RUN: --use-make %S/Inputs/test-suite-cmake/fake-make \
+# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
+# RUN: --cmake-cache Release \
+# RUN: &> %t.cmake-cache.log
+# RUN: FileCheck --check-prefix CHECK-CACHE < %t.cmake-cache.log %s
+# CHECK-CACHE: Cmake Cache
+# CHECK-CACHE: Release
+
+
+# Check a run of test-suite using a invalid cmake cache
+# RUN: lnt runtest test-suite \
+# RUN: --sandbox %t.SANDBOX \
+# RUN: --no-timestamp \
+# RUN: --test-suite %S/Inputs/test-suite-cmake \
+# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN: --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
+# RUN: --use-make %S/Inputs/test-suite-cmake/fake-make \
+# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
+# RUN: --cmake-cache Debug \
+# RUN: &> %t.cmake-cache2.err || true
+# RUN: FileCheck --check-prefix CHECK-CACHE2 < %t.cmake-cache2.err %s
+# CHECK-CACHE2: Could not find CMake cache file
More information about the llvm-commits
mailing list