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

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: Fix tests to handle MINIMAL builds. 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..08c28a7ad6a760d1dbd956b0f9f5f3533f587d3b 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
jvoung (off chromium) 2014/10/15 21:57:06 Clarify "minimal Subzero... building ICE from PNaC
Karl 2014/10/16 16:51:48 I wanted to keep the usage simple, by not forcing
+# 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 ifatts import GetFileAttributes
# name: The name of this test suite.
config.name = 'subzero'
@@ -37,34 +49,40 @@ 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
- ])))
+llvm2icetoolatts = os.path.join(bin_root, 'llvm2ice.build_atts')
+
+# Add build attributes of llvm2ice tool to the set of available features.
+config.available_features.update(GetFileAttributes(llvm2icetoolatts))
+
+# Base command for testing build attributes
+if_atts_cmd = [os.path.join(pydir, 'ifatts.py'), llvm2icetoolatts]
+ifm_atts_cmd = if_atts_cmd + ['--att=minimal', '--att=p2i', '--command']
+ifp_atts_cmd = if_atts_cmd + ['--att=p2i', '--command']
+ifl_atts_cmd = if_atts_cmd + ['--att=l2i', '--command']
+iflc_atts_cmd = if_atts_cmd + ['--att=lc2i', '--command']
+
+# 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)))
jvoung (off chromium) 2014/10/15 21:57:06 a bit of bikeshedding here: m2i seems to indicate
Karl 2014/10/16 16:51:48 Correct. p2i runs in any case. Clearing this up by
+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')))

Powered by Google App Engine
This is Rietveld 408576698