Skip to content

Don't use process::exit in bootstrap tests #98830

Closed
@jyn514

Description

@jyn514

Bootstrap has a lot of places where it calls process::exit. This makes it hard to figure out why tests fail. We should use unique exit codes so it's easier to tell where something wrong (and maybe consider using resume_unwind instead? not sure).

$ rg exit'\(' src/bootstrap/*.rs
src/bootstrap/util.rs
338:        std::process::exit(1);
377:        std::process::exit(1);
467:    std::process::exit(1);

src/bootstrap/toolstate.rs
96:    std::process::exit(3);
111:            std::process::exit(1);
182:            std::process::exit(1);
228:            std::process::exit(1);

src/bootstrap/tool.rs
207:                exit(1);

src/bootstrap/setup.rs
97:        std::process::exit(1);
290:            std::process::exit(1);

src/bootstrap/sanity.rs
107:            std::process::exit(1);

src/bootstrap/test.rs
676:            std::process::exit(1);
1024:                std::process::exit(1);
1254:            std::process::exit(1);

src/bootstrap/lib.rs
719:            process::exit(1);
1617:                std::process::exit(1);

src/bootstrap/format.rs
35:            std::process::exit(1);
117:        std::process::exit(1);

src/bootstrap/flags.rs
257:                process::exit(exit_code);
343:            process::exit(exit_code);
375:            process::exit(1);
596:                        std::process::exit(1);
610:                process::exit(1);
800:            process::exit(1);

src/bootstrap/compile.rs
1380:        exit(1);

src/bootstrap/config.rs
820:                    process::exit(2);
1490:        exit(1);

src/bootstrap/builder.rs
350:            std::process::exit(1);
1010:            std::process::exit(1);
1439:                    std::process::exit(1);

Metadata

Metadata

Assignees

Labels

A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions