fix some bugs
- fix tests when `--build` is set - don't leak `config.example.toml` fd - don't crash if `config.toml` doesn't exist yet
This commit is contained in:
parent
24e67d51a0
commit
1e7f03718b
4 changed files with 7 additions and 1 deletions
|
@ -1046,6 +1046,8 @@ def bootstrap(args):
|
||||||
if not using_default_path or os.path.exists(toml_path):
|
if not using_default_path or os.path.exists(toml_path):
|
||||||
with open(toml_path) as config:
|
with open(toml_path) as config:
|
||||||
config_toml = config.read()
|
config_toml = config.read()
|
||||||
|
else:
|
||||||
|
config_toml = ''
|
||||||
|
|
||||||
profile = RustBuild.get_toml_static(config_toml, 'profile')
|
profile = RustBuild.get_toml_static(config_toml, 'profile')
|
||||||
if profile is not None:
|
if profile is not None:
|
||||||
|
|
|
@ -132,6 +132,7 @@ class BuildBootstrap(unittest.TestCase):
|
||||||
parsed = bootstrap.parse_args(args)
|
parsed = bootstrap.parse_args(args)
|
||||||
build = serialize_and_parse(configure_args, parsed)
|
build = serialize_and_parse(configure_args, parsed)
|
||||||
build.build_dir = os.environ["BUILD_DIR"]
|
build.build_dir = os.environ["BUILD_DIR"]
|
||||||
|
build.build = os.environ["BUILD_PLATFORM"]
|
||||||
return build.build_bootstrap_cmd(env), env
|
return build.build_bootstrap_cmd(env), env
|
||||||
|
|
||||||
def test_cargoflags(self):
|
def test_cargoflags(self):
|
||||||
|
|
|
@ -400,7 +400,9 @@ def parse_example_config(known_args, config):
|
||||||
targets = {}
|
targets = {}
|
||||||
top_level_keys = []
|
top_level_keys = []
|
||||||
|
|
||||||
for line in open(rust_dir + '/config.example.toml').read().split("\n"):
|
with open(rust_dir + '/config.example.toml') as example_config:
|
||||||
|
example_lines = example_config.read().split("\n")
|
||||||
|
for line in example_lines:
|
||||||
if cur_section is None:
|
if cur_section is None:
|
||||||
if line.count('=') == 1:
|
if line.count('=') == 1:
|
||||||
top_level_key = line.split('=')[0]
|
top_level_key = line.split('=')[0]
|
||||||
|
|
|
@ -2667,6 +2667,7 @@ impl Step for Bootstrap {
|
||||||
check_bootstrap
|
check_bootstrap
|
||||||
.args(["-m", "unittest", "bootstrap_test.py"])
|
.args(["-m", "unittest", "bootstrap_test.py"])
|
||||||
.env("BUILD_DIR", &builder.out)
|
.env("BUILD_DIR", &builder.out)
|
||||||
|
.env("BUILD_PLATFORM", &builder.build.build.triple)
|
||||||
.current_dir(builder.src.join("src/bootstrap/"))
|
.current_dir(builder.src.join("src/bootstrap/"))
|
||||||
.args(builder.config.test_args());
|
.args(builder.config.test_args());
|
||||||
try_run(builder, &mut check_bootstrap).unwrap();
|
try_run(builder, &mut check_bootstrap).unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue