Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Unified Diff: tests_lit/lit.cfg

Issue 659513005: Allow conditional lit tests in Subzero, based on build flags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests_lit/lit.cfg
diff --git a/tests_lit/lit.cfg b/tests_lit/lit.cfg
index 825f7d2b3051d4bc366080b71cdbb696fc540b91..d6000001e64ffee191a2f8ae660f41747e15a304 100644
--- a/tests_lit/lit.cfg
+++ b/tests_lit/lit.cfg
@@ -1,5 +1,16 @@
# Taken from utils/lit/tests in the LLVM tree and hacked together to support
# our tests.
+#
+# Note: For X2i and ifX commands, the following values are allowed for X
+# (i.e. compiler setup):
+#
+# m : Run when llvm2ice corresponds to minimal Subzero
+# p : Run when llvm2ice corresponds to Subzero building ICE from PNaCl
+# bitcode directly.
+# l : Run when llvm2ice corresponds to Subzero building ICE by reading
+# PNaCL bitcode into LLVM IR, and converting to ICE.
+# lc : Runwhen llvm2ice corresponds to Subzero parsing LLVM source into
+# LLVM IR, and converting to ICE.
# -*- Python -*-
@@ -11,6 +22,7 @@ import lit.formats
sys.path.insert(0, 'pydir')
from utils import FindBaseNaCl
+from buildatts import getBuildAttributes
# name: The name of this test suite.
config.name = 'subzero'
@@ -37,34 +49,39 @@ pydir = os.path.join(bin_root, 'pydir')
# the llvmbintools list.
llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH'))
-# Finding Subzero tools
+# Define the location of the llvm2ice tool.
llvm2icetool = os.path.join(bin_root, 'llvm2ice')
-# Convert LLVM source to PNaCl bitcode, read using the
-# Subzero bitcode reader, and then translate.
-config.substitutions.append(
- ('%p2i', ' '.join([os.path.join(pydir, 'run-llvm2ice.py'),
- '--llvm2ice', llvm2icetool,
- '--llvm-bin-path', llvmbinpath
- ])))
-
-# Convert LLVM source to PNaCl bitcode, read using the PNaCl bitcode reader,
-# convert to ICE using the ICE Converter, and then translate.
-# TODO(kschimpf) Deprecated, remove once p2i working.
-config.substitutions.append(
- ('%l2i', ' '.join([os.path.join(pydir, 'run-llvm2ice.py'),
- '--llvm', '--llvm2ice', llvm2icetool,
- '--llvm-bin-path', llvmbinpath
- ])))
-
-# Read LLVM source, convert to ICE using the ICE converter, and then translate.
-# Note: l2i is preferred over lc2i, since it uses PNaCl bitcode.
-# TODO(kschimpf) Deprecated, remove once p2i working.
-config.substitutions.append(
- ('%lc2i', ' '.join([os.path.join(pydir, 'run-llvm2ice.py'),
- '--llvm-source', '--llvm2ice', llvm2icetool,
- '--llvm-bin-path', llvmbinpath
- ])))
+# Add build attributes of llvm2ice tool to the set of available features.
+config.available_features.update(getBuildAttributes(llvm2icetool))
+
+# Base command for testing build attributes
+if_atts_cmd = [os.path.join(pydir, 'buildatts.py'), '--llvm2ice', llvm2icetool]
+ifm_atts_cmd = if_atts_cmd + ['--att=minimal', '--att=p2i']
+ifp_atts_cmd = if_atts_cmd + ['--att=p2i']
+ifl_atts_cmd = if_atts_cmd + ['--att=l2i']
+iflc_atts_cmd = if_atts_cmd + ['--att=lc2i']
+
+# Base command for running llvm2ice
+llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'),
+ '--llvm2ice', llvm2icetool,
+ '--llvm-bin-path', llvmbinpath]
+
+# Run commands only if corresponding build attributes apply, including
+# for each compiler setup.
+config.substitutions.append(('%ifm', ' '.join(ifm_atts_cmd)))
+config.substitutions.append(('%ifp', ' '.join(ifp_atts_cmd)))
+config.substitutions.append(('%iflc', ' '.join(iflc_atts_cmd)))
+config.substitutions.append(('%ifl', ' '.join(ifl_atts_cmd)))
+config.substitutions.append(('%if', ' '.join(if_atts_cmd)))
+
+# Translate LLVM source for each compiler setup.
+config.substitutions.append(('%m2i', ' '.join(ifm_atts_cmd + llvm2ice_cmd)))
+config.substitutions.append(('%p2i', ' '.join(ifp_atts_cmd + llvm2ice_cmd)))
+config.substitutions.append(('%l2i', ' '.join(ifl_atts_cmd + llvm2ice_cmd
+ + ['--llvm'])))
+config.substitutions.append(('%lc2i', ' '.join(iflc_atts_cmd + llvm2ice_cmd
+ + ['--llvm-source'])))
config.substitutions.append(('%llvm2ice', llvm2icetool))
config.substitutions.append(('%szdiff', os.path.join(pydir, 'szdiff.py')))
« pydir/buildatts.py ('K') | « pydir/buildatts.py ('k') | tests_lit/reader_tests/binops.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698