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.
This commit is contained in:
Matthias Krüger 2024-08-22 08:17:22 +02:00 committed by GitHub
commit d24e6b7e61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 3 deletions

View File

@ -1 +0,0 @@
# empty

View File

@ -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 = {

View File

@ -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 = "...")]`.

View File

@ -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");
}

View File

@ -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