Skip to content

Commit e495231

Browse files
authored
Revert "[Utils] Add new --update-tests flag to llvm-lit" (#110772)
Reverts #108425
1 parent d214bec commit e495231

File tree

9 files changed

+3
-103
lines changed

9 files changed

+3
-103
lines changed

clang/test/lit.cfg.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,3 @@ def calculate_arch_features(arch_string):
362362
# possibly be present in system and user configuration files, so disable
363363
# default configs for the test runs.
364364
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
365-
366-
if lit_config.update_tests:
367-
import sys
368-
import os
369-
370-
utilspath = os.path.join(config.llvm_src_root, "utils")
371-
sys.path.append(utilspath)
372-
from update_any_test_checks import utc_lit_plugin
373-
374-
lit_config.test_updaters.append(utc_lit_plugin)

llvm/docs/CommandGuide/lit.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,6 @@ ADDITIONAL OPTIONS
313313

314314
List all of the discovered tests and exit.
315315

316-
.. option:: --update-tests
317-
318-
Pass failing tests to functions in the ``lit_config.update_tests`` list to
319-
check whether any of them know how to update the test to make it pass.
320-
321316
EXIT STATUS
322317
-----------
323318

llvm/test/lit.cfg.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,3 @@ def have_ld64_plugin_support():
630630

631631
if config.has_logf128:
632632
config.available_features.add("has_logf128")
633-
634-
if lit_config.update_tests:
635-
import sys
636-
import os
637-
638-
utilspath = os.path.join(config.llvm_src_root, "utils")
639-
sys.path.append(utilspath)
640-
from update_any_test_checks import utc_lit_plugin
641-
642-
lit_config.test_updaters.append(utc_lit_plugin)

llvm/utils/lit/lit/LitConfig.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def __init__(
3838
parallelism_groups={},
3939
per_test_coverage=False,
4040
gtest_sharding=True,
41-
update_tests=False,
4241
):
4342
# The name of the test runner.
4443
self.progname = progname
@@ -90,8 +89,6 @@ def __init__(
9089
self.parallelism_groups = parallelism_groups
9190
self.per_test_coverage = per_test_coverage
9291
self.gtest_sharding = bool(gtest_sharding)
93-
self.update_tests = update_tests
94-
self.test_updaters = []
9592

9693
@property
9794
def maxIndividualTestTime(self):

llvm/utils/lit/lit/TestRunner.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,18 +1190,6 @@ def executeScriptInternal(
11901190
str(result.timeoutReached),
11911191
)
11921192

1193-
if litConfig.update_tests:
1194-
for test_updater in litConfig.test_updaters:
1195-
try:
1196-
update_output = test_updater(result, test)
1197-
except Exception as e:
1198-
out += f"Exception occurred in test updater: {e}"
1199-
continue
1200-
if update_output:
1201-
for line in update_output.splitlines():
1202-
out += f"# {line}\n"
1203-
break
1204-
12051193
return out, err, exitCode, timeoutInfo
12061194

12071195

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ def parse_args():
204204
action="store_true",
205205
help="Exit with status zero even if some tests fail",
206206
)
207-
execution_group.add_argument(
208-
"--update-tests",
209-
dest="update_tests",
210-
action="store_true",
211-
help="Try to update regression tests to reflect current behavior, if possible",
212-
)
213207
execution_test_time_group = execution_group.add_mutually_exclusive_group()
214208
execution_test_time_group.add_argument(
215209
"--skip-test-time-recording",

llvm/utils/lit/lit/llvm/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,12 @@ def __init__(self, lit_config, config):
6464
self.with_environment("_TAG_REDIR_ERR", "TXT")
6565
self.with_environment("_CEE_RUNOPTS", "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)")
6666

67-
if lit_config.update_tests:
68-
self.use_lit_shell = True
69-
7067
# Choose between lit's internal shell pipeline runner and a real shell.
7168
# If LIT_USE_INTERNAL_SHELL is in the environment, we use that as an
7269
# override.
7370
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
7471
if lit_shell_env:
7572
self.use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
76-
if not self.use_lit_shell and lit_config.update_tests:
77-
print("note: --update-tests is not supported when using external shell")
7873

7974
if not self.use_lit_shell:
8075
features.add("shell")

llvm/utils/lit/lit/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def main(builtin_params={}):
4242
config_prefix=opts.configPrefix,
4343
per_test_coverage=opts.per_test_coverage,
4444
gtest_sharding=opts.gtest_sharding,
45-
update_tests=opts.update_tests,
4645
)
4746

4847
discovered_tests = lit.discovery.find_tests_for_inputs(

llvm/utils/update_any_test_checks.py

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ def find_utc_tool(search_path, utc_name):
3434
return None
3535

3636

37-
def run_utc_tool(utc_name, utc_tool, testname, environment):
37+
def run_utc_tool(utc_name, utc_tool, testname):
3838
result = subprocess.run(
39-
[utc_tool, testname],
40-
stdout=subprocess.PIPE,
41-
stderr=subprocess.PIPE,
42-
env=environment,
39+
[utc_tool, testname], stdout=subprocess.PIPE, stderr=subprocess.PIPE
4340
)
4441
return (result.returncode, result.stdout, result.stderr)
4542

@@ -63,42 +60,6 @@ def expand_listfile_args(arg_list):
6360
return exp_arg_list
6461

6562

66-
def utc_lit_plugin(result, test):
67-
testname = test.getFilePath()
68-
if not testname:
69-
return None
70-
71-
script_name = os.path.abspath(__file__)
72-
utc_search_path = os.path.join(os.path.dirname(script_name), os.path.pardir)
73-
74-
with open(testname, "r") as f:
75-
header = f.readline().strip()
76-
77-
m = RE_ASSERTIONS.search(header)
78-
if m is None:
79-
return None
80-
81-
utc_name = m.group(1)
82-
utc_tool = find_utc_tool([utc_search_path], utc_name)
83-
if not utc_tool:
84-
return f"update-utc-tests: {utc_name} not found"
85-
86-
return_code, stdout, stderr = run_utc_tool(
87-
utc_name, utc_tool, testname, test.config.environment
88-
)
89-
90-
stderr = stderr.decode(errors="replace")
91-
if return_code != 0:
92-
if stderr:
93-
return f"update-utc-tests: {utc_name} exited with return code {return_code}\n{stderr.rstrip()}"
94-
return f"update-utc-tests: {utc_name} exited with return code {return_code}"
95-
96-
stdout = stdout.decode(errors="replace")
97-
if stdout:
98-
return f"update-utc-tests: updated {testname}\n{stdout.rstrip()}"
99-
return f"update-utc-tests: updated {testname}"
100-
101-
10263
def main():
10364
from argparse import RawTextHelpFormatter
10465

@@ -117,11 +78,6 @@ def main():
11778
nargs="*",
11879
help="Additional directories to scan for update_*_test_checks scripts",
11980
)
120-
parser.add_argument(
121-
"--path",
122-
help="""Additional directories to scan for executables invoked by the update_*_test_checks scripts,
123-
separated by the platform path separator""",
124-
)
12581
parser.add_argument("tests", nargs="+")
12682
config = parser.parse_args()
12783

@@ -132,10 +88,6 @@ def main():
13288
script_name = os.path.abspath(__file__)
13389
utc_search_path.append(os.path.join(os.path.dirname(script_name), os.path.pardir))
13490

135-
local_env = os.environ.copy()
136-
if config.path:
137-
local_env["PATH"] = config.path + os.pathsep + local_env["PATH"]
138-
13991
not_autogenerated = []
14092
utc_tools = {}
14193
have_error = False
@@ -165,7 +117,7 @@ def main():
165117
continue
166118

167119
future = executor.submit(
168-
run_utc_tool, utc_name, utc_tools[utc_name], testname, local_env
120+
run_utc_tool, utc_name, utc_tools[utc_name], testname
169121
)
170122
jobs.append((testname, future))
171123

0 commit comments

Comments
 (0)