[PATCH] D28529: [test] Port clang tests to canonicalized booleans

2017-01-25 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293052: [test] Port clang tests to canonicalized booleans 
(authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D28529?vs=83852=85736#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28529

Files:
  cfe/trunk/CMakeLists.txt
  cfe/trunk/test/ARCMT/lit.local.cfg
  cfe/trunk/test/Analysis/lit.local.cfg
  cfe/trunk/test/CMakeLists.txt
  cfe/trunk/test/Rewriter/lit.local.cfg
  cfe/trunk/test/Tooling/lit.local.cfg
  cfe/trunk/test/lit.cfg
  cfe/trunk/test/lit.site.cfg.in

Index: cfe/trunk/test/Analysis/lit.local.cfg
===
--- cfe/trunk/test/Analysis/lit.local.cfg
+++ cfe/trunk/test/Analysis/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
 config.unsupported = True
Index: cfe/trunk/test/ARCMT/lit.local.cfg
===
--- cfe/trunk/test/ARCMT/lit.local.cfg
+++ cfe/trunk/test/ARCMT/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
 config.unsupported = True
Index: cfe/trunk/test/Rewriter/lit.local.cfg
===
--- cfe/trunk/test/Rewriter/lit.local.cfg
+++ cfe/trunk/test/Rewriter/lit.local.cfg
@@ -1,3 +1,3 @@
 # The Objective-C rewriters are currently grouped with ARCMT.
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
 config.unsupported = True
Index: cfe/trunk/test/lit.site.cfg.in
===
--- cfe/trunk/test/lit.site.cfg.in
+++ cfe/trunk/test/lit.site.cfg.in
@@ -14,13 +14,13 @@
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = "@HAVE_LIBZ@"
-config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.have_zlib = @HAVE_LIBZ@
+config.clang_arcmt = @CLANG_ENABLE_ARCMT@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
-config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
-config.clang_examples = @ENABLE_CLANG_EXAMPLES@
+config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
-config.enable_backtrace = "@ENABLE_BACKTRACES@"
+config.enable_backtrace = @ENABLE_BACKTRACES@
 config.host_arch = "@HOST_ARCH@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -202,7 +202,7 @@
 # Plugins (loadable modules)
 # TODO: This should be supplied by Makefile or autoconf.
 if sys.platform in ['win32', 'cygwin']:
-has_plugins = (config.enable_shared == 1)
+has_plugins = config.enable_shared
 else:
 has_plugins = True
 
@@ -353,7 +353,7 @@
 config.available_features.add('default-cxx-stdlib-set')
 
 # Enabled/disabled features
-if config.clang_staticanalyzer != 0:
+if config.clang_staticanalyzer:
 config.available_features.add("staticanalyzer")
 
 # As of 2011.08, crash-recovery tests still do not pass on FreeBSD.
@@ -474,10 +474,10 @@
 else:
 config.available_features.add("not_ubsan")
 
-if config.enable_backtrace == "1":
+if config.enable_backtrace:
 config.available_features.add("backtrace")
 
-if config.have_zlib == "1":
+if config.have_zlib:
 config.available_features.add("zlib")
 else:
 config.available_features.add("nozlib")
Index: cfe/trunk/test/CMakeLists.txt
===
--- cfe/trunk/test/CMakeLists.txt
+++ cfe/trunk/test/CMakeLists.txt
@@ -18,6 +18,12 @@
   endif()
 endif()
 
+llvm_canonicalize_cmake_booleans(
+  CLANG_BUILD_EXAMPLES
+  CLANG_ENABLE_ARCMT
+  CLANG_ENABLE_STATIC_ANALYZER
+  ENABLE_BACKTRACES)
+
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@@ -55,15 +61,15 @@
   )
 endif ()
 
-if (ENABLE_CLANG_EXAMPLES)
+if (CLANG_BUILD_EXAMPLES)
   list(APPEND CLANG_TEST_DEPS
 AnnotateFunctions
 clang-interpreter
 PrintFunctionNames
 )
 endif ()
 
-if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES)
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES)
   list(APPEND CLANG_TEST_DEPS
 SampleAnalyzerPlugin
 )
Index: cfe/trunk/test/Tooling/lit.local.cfg
===
--- cfe/trunk/test/Tooling/lit.local.cfg
+++ cfe/trunk/test/Tooling/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
 config.unsupported = True
Index: cfe/trunk/CMakeLists.txt
===
--- 

[PATCH] D28529: [test] Port clang tests to canonicalized booleans

2017-01-24 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

SGTM


https://reviews.llvm.org/D28529



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28529: [test] Port clang tests to canonicalized booleans

2017-01-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added a reviewer: beanz.
mgorny added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Use the new llvm_canonicalize_cmake_booleans() function to canonicalize
booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables
used to hold canonicalized values with in-place canonicalization. Use
implicit logic in Python code to avoid overrelying on exact 0/1 values.


https://reviews.llvm.org/D28529

Files:
  CMakeLists.txt
  test/ARCMT/lit.local.cfg
  test/Analysis/lit.local.cfg
  test/CMakeLists.txt
  test/Rewriter/lit.local.cfg
  test/Tooling/lit.local.cfg
  test/lit.cfg
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -14,13 +14,13 @@
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = "@HAVE_LIBZ@"
-config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.have_zlib = @HAVE_LIBZ@
+config.clang_arcmt = @CLANG_ENABLE_ARCMT@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
-config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
-config.clang_examples = @ENABLE_CLANG_EXAMPLES@
+config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
-config.enable_backtrace = "@ENABLE_BACKTRACES@"
+config.enable_backtrace = @ENABLE_BACKTRACES@
 config.host_arch = "@HOST_ARCH@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is
Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -202,7 +202,7 @@
 # Plugins (loadable modules)
 # TODO: This should be supplied by Makefile or autoconf.
 if sys.platform in ['win32', 'cygwin']:
-has_plugins = (config.enable_shared == 1)
+has_plugins = config.enable_shared
 else:
 has_plugins = True
 
@@ -353,7 +353,7 @@
 config.available_features.add('default-cxx-stdlib-set')
 
 # Enabled/disabled features
-if config.clang_staticanalyzer != 0:
+if config.clang_staticanalyzer:
 config.available_features.add("staticanalyzer")
 
 # As of 2011.08, crash-recovery tests still do not pass on FreeBSD.
@@ -474,10 +474,10 @@
 else:
 config.available_features.add("not_ubsan")
 
-if config.enable_backtrace == "1":
+if config.enable_backtrace:
 config.available_features.add("backtrace")
 
-if config.have_zlib == "1":
+if config.have_zlib:
 config.available_features.add("zlib")
 else:
 config.available_features.add("nozlib")
Index: test/Tooling/lit.local.cfg
===
--- test/Tooling/lit.local.cfg
+++ test/Tooling/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
 config.unsupported = True
Index: test/Rewriter/lit.local.cfg
===
--- test/Rewriter/lit.local.cfg
+++ test/Rewriter/lit.local.cfg
@@ -1,3 +1,3 @@
 # The Objective-C rewriters are currently grouped with ARCMT.
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
 config.unsupported = True
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -18,6 +18,12 @@
   endif()
 endif()
 
+llvm_canonicalize_cmake_booleans(
+  CLANG_BUILD_EXAMPLES
+  CLANG_ENABLE_ARCMT
+  CLANG_ENABLE_STATIC_ANALYZER
+  ENABLE_BACKTRACES)
+
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@@ -55,15 +61,15 @@
   )
 endif ()
 
-if (ENABLE_CLANG_EXAMPLES)
+if (CLANG_BUILD_EXAMPLES)
   list(APPEND CLANG_TEST_DEPS
 AnnotateFunctions
 clang-interpreter
 PrintFunctionNames
 )
 endif ()
 
-if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES)
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES)
   list(APPEND CLANG_TEST_DEPS
 SampleAnalyzerPlugin
 )
Index: test/Analysis/lit.local.cfg
===
--- test/Analysis/lit.local.cfg
+++ test/Analysis/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
 config.unsupported = True
Index: test/ARCMT/lit.local.cfg
===
--- test/ARCMT/lit.local.cfg
+++ test/ARCMT/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
 config.unsupported = True
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -364,18 +364,7 @@
   "Build the Clang tools. If OFF, just generate build targets." ON)
 
 option(CLANG_ENABLE_ARCMT "Build ARCMT."