Skip to content

Commit d24e6b7

Browse files
authored
Rollup merge of #129387 - Zalathar:python-apologia, r=jieyouxu
Advise against removing the remaining Python scripts from `tests/run-make` After some recent PRs (e.g. #129185), there are only two Python scripts left in `tests/run-make`. Having come so far, it's tempting to try to get rid of the remaining ones. But after trying that myself, I've come to the conclusion that it's not worth the extra hassle, especially if it means pulling in an XML-parsing crate just for one test. This PR therefore leaves behind a few signpost comments to explain why getting rid of these particular scripts has low value.
2 parents 28d4b82 + 34cdfc9 commit d24e6b7

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

tests/run-make/debugger-visualizer-dep-info/foo.py

-1
This file was deleted.

tests/run-make/debugger-visualizer-dep-info/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![debugger_visualizer(gdb_script_file = "foo.py")]
1+
#![debugger_visualizer(gdb_script_file = "my_gdb_script.py")]
22

33
fn main() {
44
const _UNUSED: u32 = {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is a Python script, but we don't actually run it.
2+
# So if you're trying to remove Python scripts from the test suite,
3+
# be aware that there's no value in trying to get rid of this one.
4+
#
5+
# It just needs to exist so that the compiler can embed it via
6+
# `#![debugger_visualizer(gdb_script_file = "...")]`.

tests/run-make/debugger-visualizer-dep-info/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ use run_make_support::{invalid_utf8_contains, rustc};
66

77
fn main() {
88
rustc().emit("dep-info").input("main.rs").run();
9-
invalid_utf8_contains("main.d", "foo.py");
9+
invalid_utf8_contains("main.d", "my_gdb_script.py");
1010
invalid_utf8_contains("main.d", "my_visualizers/bar.natvis");
1111
}

tests/run-make/libtest-junit/validate_junit.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/usr/bin/env python
22

3+
# Trivial Python script that reads lines from stdin, and checks that each line
4+
# is a well-formed XML document.
5+
#
6+
# This takes advantage of the fact that Python has a built-in XML parser,
7+
# whereas doing the same check in Rust would require us to pull in an XML
8+
# crate just for this relatively-minor test.
9+
#
10+
# If you're trying to remove Python scripts from the test suite, think twice
11+
# before removing this one. You could do so, but it's probably not worth it.
12+
313
import sys
414
import xml.etree.ElementTree as ET
515

0 commit comments

Comments
 (0)