Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasks: switch to passing parameters to lit with "--param" #114

Merged
merged 3 commits into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ def run_lit_tests(c, filecheck_exec, llvm_only):
cwd = os.getcwd()

command = formatted_command("""
CURRENT_DIR={cwd}
REAL_ONLY={llvm_only_value} \
FILECHECK_EXEC={filecheck_exec}
PATH={cwd}/tests/integration/tools/FileCheck:{cwd}/tests/integration/tools:$PATH
lit
-vv
lit
--param REAL_ONLY={llvm_only_value}
--param FILECHECK_EXEC={filecheck_exec}
-v
{cwd}/tests/integration
""").format(cwd=cwd, filecheck_exec=filecheck_exec, llvm_only_value=llvm_only_value)

Expand Down
13 changes: 8 additions & 5 deletions tests/integration/lit.cfg
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import os

import lit.formats

config.name = "FileCheck.py integration tests"
config.test_format = lit.formats.ShTest("0")

current_dir = os.getcwd()

# LLVM LIT: Is it possible to pass user defined parameter into a test script?
# https://stackoverflow.com/a/39861848/598057
current_dir = os.environ.get('CURRENT_DIR', '')
filecheck_exec = os.environ.get('FILECHECK_EXEC', '')
real_only = os.environ.get('REAL_ONLY', '')
filecheck_exec = lit_config.params['FILECHECK_EXEC']
assert(filecheck_exec)

real_only = lit_config.params['REAL_ONLY']

config.substitutions.append(('%CURRENT_DIR', current_dir))
config.substitutions.append(('%FILECHECK_EXEC', filecheck_exec))
config.substitutions.append(('%COMPARE_EXEC', "{}/tests/integration/tools/compare_dirs".format(current_dir)))
config.substitutions.append(('%FILECHECK_TESTER_EXEC', "{}/tests/integration/tools/FileCheck/FileCheck".format(current_dir)))

if real_only:
Expand Down