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.
This commit is contained in:
jyn 2023-06-04 12:16:49 -05:00
parent 7d2373e48f
commit 3508cde815
2 changed files with 9 additions and 14 deletions

View File

@ -1,4 +1,6 @@
"""Bootstrap tests"""
"""Bootstrap tests
Run these with `x test bootstrap`, or `python -m unittest bootstrap_test.py`."""
from __future__ import absolute_import, division, print_function
import os
@ -120,15 +122,3 @@ class GenerateAndParseConfig(unittest.TestCase):
build = self.serialize_and_parse(["--enable-full-tools"])
self.assertNotEqual(build.config_toml.find("codegen-backends = ['llvm']"), -1)
if __name__ == '__main__':
SUITE = unittest.TestSuite()
TEST_LOADER = unittest.TestLoader()
SUITE.addTest(doctest.DocTestSuite(bootstrap))
SUITE.addTests([
TEST_LOADER.loadTestsFromTestCase(VerifyTestCase),
TEST_LOADER.loadTestsFromTestCase(GenerateAndParseConfig),
TEST_LOADER.loadTestsFromTestCase(ProgramOutOfDate)])
RUNNER = unittest.TextTestRunner(stream=sys.stdout, verbosity=2)
result = RUNNER.run(SUITE)
sys.exit(0 if result.wasSuccessful() else 1)

View File

@ -2664,7 +2664,12 @@ impl Step for Bootstrap {
/// Tests the build system itself.
fn run(self, builder: &Builder<'_>) {
let mut check_bootstrap = Command::new(&builder.python());
check_bootstrap.arg("bootstrap_test.py").current_dir(builder.src.join("src/bootstrap/"));
check_bootstrap
.arg("-m")
.arg("unittest")
.arg("bootstrap_test.py")
.current_dir(builder.src.join("src/bootstrap/"))
.args(builder.config.test_args());
try_run(builder, &mut check_bootstrap).unwrap();
let host = builder.config.build;