Skip to content

Commit 3508cde

Browse files
committed
Allow passing arguments to bootstrap_test.py
Previous, it used the built-in test runner, which doesn't support options unless they're manually passed in the script.
1 parent 7d2373e commit 3508cde

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/bootstrap/bootstrap_test.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"""Bootstrap tests"""
1+
"""Bootstrap tests
2+
3+
Run these with `x test bootstrap`, or `python -m unittest bootstrap_test.py`."""
24

35
from __future__ import absolute_import, division, print_function
46
import os
@@ -120,15 +122,3 @@ def test_set_codegen_backends(self):
120122
build = self.serialize_and_parse(["--enable-full-tools"])
121123
self.assertNotEqual(build.config_toml.find("codegen-backends = ['llvm']"), -1)
122124

123-
if __name__ == '__main__':
124-
SUITE = unittest.TestSuite()
125-
TEST_LOADER = unittest.TestLoader()
126-
SUITE.addTest(doctest.DocTestSuite(bootstrap))
127-
SUITE.addTests([
128-
TEST_LOADER.loadTestsFromTestCase(VerifyTestCase),
129-
TEST_LOADER.loadTestsFromTestCase(GenerateAndParseConfig),
130-
TEST_LOADER.loadTestsFromTestCase(ProgramOutOfDate)])
131-
132-
RUNNER = unittest.TextTestRunner(stream=sys.stdout, verbosity=2)
133-
result = RUNNER.run(SUITE)
134-
sys.exit(0 if result.wasSuccessful() else 1)

src/bootstrap/test.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,12 @@ impl Step for Bootstrap {
26642664
/// Tests the build system itself.
26652665
fn run(self, builder: &Builder<'_>) {
26662666
let mut check_bootstrap = Command::new(&builder.python());
2667-
check_bootstrap.arg("bootstrap_test.py").current_dir(builder.src.join("src/bootstrap/"));
2667+
check_bootstrap
2668+
.arg("-m")
2669+
.arg("unittest")
2670+
.arg("bootstrap_test.py")
2671+
.current_dir(builder.src.join("src/bootstrap/"))
2672+
.args(builder.config.test_args());
26682673
try_run(builder, &mut check_bootstrap).unwrap();
26692674

26702675
let host = builder.config.build;

0 commit comments

Comments
 (0)