Make the clang-tidy-diff.py test conditional on the presence of Python 2.7. Use the...
authorAlexander Kornienko <alexfh@google.com>
Thu, 26 Jun 2014 16:32:26 +0000 (16:32 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 26 Jun 2014 16:32:26 +0000 (16:32 +0000)
llvm-svn: 211789

clang-tools-extra/test/Makefile
clang-tools-extra/test/clang-tidy/clang-tidy-diff.cpp
clang-tools-extra/test/lit.cfg
clang-tools-extra/test/lit.site.cfg.in

index 6e39837..1dcf7cd 100644 (file)
@@ -52,6 +52,7 @@ lit.site.cfg: FORCE
        @$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
        @$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
        @$(ECHOPATH) s=@CLANG_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
+       @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
        @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
        @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
        @-rm -f lit.tmp
index ab0b0f1..159431d 100644 (file)
@@ -1,6 +1,7 @@
+// REQUIRES: python27
 // RUN: sed 's/placeholder_for_f/f/' %s > %t.cpp
 // RUN: clang-tidy -checks=-*,misc-use-override %t.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
-// R_U_N: not diff -U0 %s %t.cpp | python %S/../../clang-tidy/tool/clang-tidy-diff.py -checks=-*,misc-use-override -- -std=c++11 2>&1 | FileCheck %s
+// RUN: not diff -U0 %s %t.cpp | %python %S/../../clang-tidy/tool/clang-tidy-diff.py -checks=-*,misc-use-override -- -std=c++11 2>&1 | FileCheck %s
 struct A {
   virtual void f() {}
   virtual void g() {}
index 41a17cb..c58f54e 100644 (file)
@@ -174,3 +174,10 @@ if platform.system() not in ['Windows'] or lit_config.getBashPath() != '':
 # ANSI escape sequences in non-dumb terminal
 if platform.system() not in ['Windows']:
     config.available_features.add('ansi-escape-sequences')
+
+config.substitutions.append( ('%python', config.python_executable) )
+
+import sys
+# Scripts using argparse need Python 2.7.
+if sys.version_info >= (2, 7):
+  config.available_features.add('python27')
index 277f648..35f8516 100644 (file)
@@ -7,6 +7,7 @@ config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is