Skip to content

Commit 41002ba

Browse files
committed
remove redundant if lit_config.debug, and add help test detail
Checking lit_config.debug is redundant now, since calling lit_config.dbg does the same check behind the scenes. lit_config.debug is kept around for now to avoid breaking downstream users.
1 parent cf067d9 commit 41002ba

File tree

6 files changed

+22
-29
lines changed

6 files changed

+22
-29
lines changed

compiler-rt/test/lit.common.cfg.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,14 @@ def push_dynamic_library_lookup_path(config, new_path):
195195
# Normalize the path for comparison
196196
if test_cc_resource_dir is not None:
197197
test_cc_resource_dir = os.path.realpath(test_cc_resource_dir)
198-
if lit_config.debug:
199-
lit_config.dbg(f"Resource dir for {config.clang} is {test_cc_resource_dir}")
198+
lit_config.dbg(f"Resource dir for {config.clang} is {test_cc_resource_dir}")
200199
local_build_resource_dir = os.path.realpath(config.compiler_rt_output_dir)
201200
if test_cc_resource_dir != local_build_resource_dir and config.test_standalone_build_libs:
202201
if config.compiler_id == "Clang":
203-
if lit_config.debug:
204-
lit_config.dbg(
205-
f"Overriding test compiler resource dir to use "
206-
f'libraries in "{config.compiler_rt_libdir}"'
207-
)
202+
lit_config.dbg(
203+
f"Overriding test compiler resource dir to use "
204+
f'libraries in "{config.compiler_rt_libdir}"'
205+
)
208206
# Ensure that we use the just-built static libraries when linking by
209207
# overriding the Clang resource directory. Additionally, we want to use
210208
# the builtin headers shipped with clang (e.g. stdint.h), so we

libcxx/utils/libcxx/test/config.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,23 @@ def configure(parameters, features, config, lit_config):
3232
actions = param.getActions(config, lit_config.params)
3333
for action in actions:
3434
action.applyTo(config)
35-
if lit_config.debug:
36-
debug(
37-
"Applied '{}' as a result of parameter '{}'".format(
38-
action.pretty(config, lit_config.params),
39-
param.pretty(config, lit_config.params),
40-
)
35+
debug(
36+
"Applied '{}' as a result of parameter '{}'".format(
37+
action.pretty(config, lit_config.params),
38+
param.pretty(config, lit_config.params),
4139
)
40+
)
4241

4342
# Then, apply the automatically-detected features.
4443
for feature in features:
4544
actions = feature.getActions(config)
4645
for action in actions:
4746
action.applyTo(config)
48-
if lit_config.debug:
49-
debug(
50-
"Applied '{}' as a result of implicitly detected feature '{}'".format(
51-
action.pretty(config, lit_config.params), feature.pretty(config)
52-
)
47+
debug(
48+
"Applied '{}' as a result of implicitly detected feature '{}'".format(
49+
action.pretty(config, lit_config.params), feature.pretty(config)
5350
)
51+
)
5452

5553
# Print the basic substitutions
5654
for sub in ("%{cxx}", "%{flags}", "%{compile_flags}", "%{link_flags}", "%{benchmark_flags}", "%{exec}"):

llvm/utils/lit/lit/TestingConfig.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ def load_from_path(self, path, litConfig):
143143
cfg_globals["__file__"] = path
144144
try:
145145
exec(compile(data, path, "exec"), cfg_globals, None)
146-
if litConfig.debug:
147-
litConfig.dbg("... loaded config %r" % path)
146+
litConfig.dbg("... loaded config %r" % path)
148147
except SystemExit:
149148
e = sys.exc_info()[1]
150149
# We allow normal system exit inside a config file to just

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@ def parse_args():
110110
format_group = parser.add_argument_group("Output Format")
111111
format_group.add_argument(
112112
"--test-output",
113-
help="Control whether the executed commands and their outputs are printed after each test has executed (default off)",
113+
help="Control whether the executed commands and their outputs are printed after each test has executed (default off). "
114+
"If --print-result-after is set lower than the level given to --test-output, --print-result-after is raised to match.",
114115
choices=["off", "failed", "all"],
115116
default="off",
116117
action=TestOutputAction,
117118
)
118119
format_group.add_argument(
119120
"--print-result-after",
120-
help="Control which the executed test names and results are printed after each test has executed (default all)",
121+
help="Control which the executed test names and results are printed after each test has executed (default all). "
122+
"If --test-output is set higher than the level given to --print-result-after, --test-output is lowered to match.",
121123
choices=["off", "failed", "all"],
122124
default="all",
123125
action=TestOutputAction,

llvm/utils/lit/lit/discovery.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def search1(path):
6262
cfgpath = target
6363

6464
# We found a test suite, create a new config for it and load it.
65-
if litConfig.debug:
66-
litConfig.dbg("loading suite config %r" % cfgpath)
65+
litConfig.dbg("loading suite config %r" % cfgpath)
6766

6867
cfg = TestingConfig.fromdefaults(litConfig)
6968
cfg.load_from_path(cfgpath, litConfig)
@@ -115,8 +114,7 @@ def search1(path_in_suite):
115114
# Otherwise, copy the current config and load the local configuration
116115
# file into it.
117116
config = copy.deepcopy(parent)
118-
if litConfig.debug:
119-
litConfig.dbg("loading local config %r" % cfgpath)
117+
litConfig.dbg("loading local config %r" % cfgpath)
120118
config.load_from_path(cfgpath, litConfig)
121119
return config
122120

@@ -137,8 +135,7 @@ def getTests(path, litConfig, testSuiteCache, localConfigCache):
137135
litConfig.warning("unable to find test suite for %r" % path)
138136
return (), ()
139137

140-
if litConfig.debug:
141-
litConfig.dbg("resolved input %r to %r::%r" % (path, ts.name, path_in_suite))
138+
litConfig.dbg("resolved input %r to %r::%r" % (path, ts.name, path_in_suite))
142139

143140
return ts, getTestsInSuite(
144141
ts,

llvm/utils/lit/tests/Inputs/verbosity/lit.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ config.test_exec_root = None
99
lit_config.dbg("this is a debug log")
1010
lit_config.note("this is a note")
1111
lit_config.warning("this is a warning")
12-
#lit_config.error("this is an error")

0 commit comments

Comments
 (0)