Skip to content

Commit

Permalink
chore: rename output in TestCase for more clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Wybxc committed Oct 22, 2024
1 parent 3b1d14e commit 1326ec1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bootstrap/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Run for TestCommand {
TestType::FileCheck => {
cprint!("File checking {}...", testcase.name);
testcase.build(manifest);
filechecker.run(&testcase.source, &testcase.output);
filechecker.run(&testcase.source, &testcase.output_file);
}
TestType::Compile => {
cprint!("Compiling {}...", testcase.name);
Expand Down Expand Up @@ -68,24 +68,24 @@ impl TestCommand {
TestCase {
name: "mini_core".into(),
source: case.clone(),
output: manifest.out_dir.join(Path::new(filename)),
output_file: manifest.out_dir.join(Path::new(filename)),
test: TestType::CompileLib,
},
);
continue;
}
let name = format!("examples/{}", filename.to_string_lossy());
let output = manifest.out_dir.join("examples").join(filename);
result.push(TestCase { name, source: case, output, test: TestType::Compile })
let output_file = manifest.out_dir.join("examples").join(filename);
result.push(TestCase { name, source: case, output_file, test: TestType::Compile })
}

// Codegen tests
for case in glob("tests/codegen/*.rs").unwrap() {
let case = case.unwrap();
let filename = case.file_stem().unwrap();
let name = format!("codegen/{}", filename.to_string_lossy());
let output = manifest.out_dir.join("tests/codegen").join(filename);
result.push(TestCase { name, source: case, output, test: TestType::FileCheck })
let output_file = manifest.out_dir.join("tests/codegen").join(filename);
result.push(TestCase { name, source: case, output_file, test: TestType::FileCheck })
}

result
Expand All @@ -104,27 +104,27 @@ pub enum TestType {
pub struct TestCase {
pub name: String,
pub source: PathBuf,
pub output: PathBuf,
pub output_file: PathBuf,
pub test: TestType,
}

impl TestCase {
pub fn build(&self, manifest: &Manifest) {
let output_dir = self.output.parent().unwrap();
let output_dir = self.output_file.parent().unwrap();
std::fs::create_dir_all(output_dir).unwrap();
let mut command = manifest.rustc();
command
.args(["--crate-type", "bin"])
.arg("-O")
.arg(&self.source)
.arg("-o")
.arg(&self.output);
.arg(&self.output_file);
log::debug!("running {:?}", command);
command.status().unwrap();
}

pub fn build_lib(&self, manifest: &Manifest) {
let output_dir = self.output.parent().unwrap();
let output_dir = self.output_file.parent().unwrap();
std::fs::create_dir_all(output_dir).unwrap();
let mut command = manifest.rustc();
command
Expand Down

0 comments on commit 1326ec1

Please sign in to comment.