Skip to content

Commit

Permalink
Unrolled build for rust-lang#129387
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#129387 - Zalathar:python-apologia, r=jieyouxu

Advise against removing the remaining Python scripts from `tests/run-make`

After some recent PRs (e.g. rust-lang#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.
  • Loading branch information
rust-timer authored Aug 22, 2024
2 parents 739b1fd + 34cdfc9 commit d884ad7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 0 additions & 1 deletion tests/run-make/debugger-visualizer-dep-info/foo.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/run-make/debugger-visualizer-dep-info/main.rs
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py
Original file line number Diff line number Diff line change
@@ -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 = "...")]`.
2 changes: 1 addition & 1 deletion tests/run-make/debugger-visualizer-dep-info/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
10 changes: 10 additions & 0 deletions tests/run-make/libtest-junit/validate_junit.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit d884ad7

Please sign in to comment.