about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-22 08:17:22 +0200
committerGitHub <noreply@github.com>2024-08-22 08:17:22 +0200
commitd24e6b7e61f5448acfc4e4d437c7c0f820be0589 (patch)
treee685e81f2dd02a0da96e27ef6105db1c23d7c452
parent28d4b8248e319cddb04f9c7ec0f8bdcbd642bb3f (diff)
parent34cdfc9b490c7d7cc284fcdaf2338976ee6329bf (diff)
downloadrust-d24e6b7e61f5448acfc4e4d437c7c0f820be0589.tar.gz
rust-d24e6b7e61f5448acfc4e4d437c7c0f820be0589.zip
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.
-rw-r--r--tests/run-make/debugger-visualizer-dep-info/foo.py1
-rw-r--r--tests/run-make/debugger-visualizer-dep-info/main.rs2
-rw-r--r--tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py6
-rw-r--r--tests/run-make/debugger-visualizer-dep-info/rmake.rs2
-rwxr-xr-xtests/run-make/libtest-junit/validate_junit.py10
5 files changed, 18 insertions, 3 deletions
diff --git a/tests/run-make/debugger-visualizer-dep-info/foo.py b/tests/run-make/debugger-visualizer-dep-info/foo.py
deleted file mode 100644
index 1bb8bf6d7fd..00000000000
--- a/tests/run-make/debugger-visualizer-dep-info/foo.py
+++ /dev/null
@@ -1 +0,0 @@
-# empty
diff --git a/tests/run-make/debugger-visualizer-dep-info/main.rs b/tests/run-make/debugger-visualizer-dep-info/main.rs
index 3aede2215ea..3539b305be3 100644
--- a/tests/run-make/debugger-visualizer-dep-info/main.rs
+++ b/tests/run-make/debugger-visualizer-dep-info/main.rs
@@ -1,4 +1,4 @@
-#![debugger_visualizer(gdb_script_file = "foo.py")]
+#![debugger_visualizer(gdb_script_file = "my_gdb_script.py")]
 
 fn main() {
     const _UNUSED: u32 = {
diff --git a/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py b/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py
new file mode 100644
index 00000000000..d319792657e
--- /dev/null
+++ b/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py
@@ -0,0 +1,6 @@
+# This is a Python script, but we don't actually run it.
+# So if you're trying to remove Python scripts from the test suite,
+# be aware that there's no value in trying to get rid of this one.
+#
+# It just needs to exist so that the compiler can embed it via
+# `#![debugger_visualizer(gdb_script_file = "...")]`.
diff --git a/tests/run-make/debugger-visualizer-dep-info/rmake.rs b/tests/run-make/debugger-visualizer-dep-info/rmake.rs
index 65ffb2373e7..f5cf39157ac 100644
--- a/tests/run-make/debugger-visualizer-dep-info/rmake.rs
+++ b/tests/run-make/debugger-visualizer-dep-info/rmake.rs
@@ -6,6 +6,6 @@ use run_make_support::{invalid_utf8_contains, rustc};
 
 fn main() {
     rustc().emit("dep-info").input("main.rs").run();
-    invalid_utf8_contains("main.d", "foo.py");
+    invalid_utf8_contains("main.d", "my_gdb_script.py");
     invalid_utf8_contains("main.d", "my_visualizers/bar.natvis");
 }
diff --git a/tests/run-make/libtest-junit/validate_junit.py b/tests/run-make/libtest-junit/validate_junit.py
index 0d9b34a3cf7..f92473751b0 100755
--- a/tests/run-make/libtest-junit/validate_junit.py
+++ b/tests/run-make/libtest-junit/validate_junit.py
@@ -1,5 +1,15 @@
 #!/usr/bin/env python
 
+# Trivial Python script that reads lines from stdin, and checks that each line
+# is a well-formed XML document.
+#
+# This takes advantage of the fact that Python has a built-in XML parser,
+# whereas doing the same check in Rust would require us to pull in an XML
+# crate just for this relatively-minor test.
+#
+# If you're trying to remove Python scripts from the test suite, think twice
+# before removing this one. You could do so, but it's probably not worth it.
+
 import sys
 import xml.etree.ElementTree as ET