1
Fork 0

Support build-pass in codegen tests

This commit is contained in:
Jubilee Young 2023-07-11 19:07:14 -07:00
parent 571aac9fba
commit 81dc91efbd
2 changed files with 13 additions and 12 deletions

View file

@ -541,16 +541,15 @@ impl TestProps {
} }
fn update_pass_mode(&mut self, ln: &str, revision: Option<&str>, config: &Config) { fn update_pass_mode(&mut self, ln: &str, revision: Option<&str>, config: &Config) {
let check_no_run = |s| { let check_no_run = |s| match (config.mode, s) {
if config.mode != Mode::Ui && config.mode != Mode::Incremental { (Mode::Ui, _) => (),
panic!("`{}` header is only supported in UI and incremental tests", s); (Mode::Codegen, "build-pass") => (),
} (Mode::Incremental, _) => {
if config.mode == Mode::Incremental if revision.is_some() && !self.revisions.iter().all(|r| r.starts_with("cfail")) {
&& !revision.map_or(false, |r| r.starts_with("cfail")) panic!("`{s}` header is only supported in `cfail` incremental tests")
&& !self.revisions.iter().all(|r| r.starts_with("cfail")) }
{
panic!("`{}` header is only supported in `cfail` incremental tests", s);
} }
(mode, _) => panic!("`{s}` header is not supported in `{mode}` tests"),
}; };
let pass_mode = if config.parse_name_directive(ln, "check-pass") { let pass_mode = if config.parse_name_directive(ln, "check-pass") {
check_no_run("check-pass"); check_no_run("check-pass");
@ -559,9 +558,7 @@ impl TestProps {
check_no_run("build-pass"); check_no_run("build-pass");
Some(PassMode::Build) Some(PassMode::Build)
} else if config.parse_name_directive(ln, "run-pass") { } else if config.parse_name_directive(ln, "run-pass") {
if config.mode != Mode::Ui { check_no_run("run-pass");
panic!("`run-pass` header is only supported in UI tests")
}
Some(PassMode::Run) Some(PassMode::Run)
} else { } else {
None None

View file

@ -2752,6 +2752,10 @@ impl<'test> TestCx<'test> {
self.fatal_proc_rec("compilation failed!", &proc_res); self.fatal_proc_rec("compilation failed!", &proc_res);
} }
if let Some(PassMode::Build) = self.pass_mode() {
return;
}
let output_path = self.output_base_name().with_extension("ll"); let output_path = self.output_base_name().with_extension("ll");
let proc_res = self.verify_with_filecheck(&output_path); let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() { if !proc_res.status.success() {