Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jan 24, 2025
1 parent c970dfd commit 0558ffc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions tests/integration/pgo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,16 @@ rustflags = ["-Ctarget-cpu=native"]
),
);

eprintln!("{}", &format!(
r#"
[target.{}]
rustflags = ["-Ctarget-cpu=native"]
"#,
target
));
let output = project.cmd(&["build", "--", "-v"]).run()?;
println!("{}", output.stderr());
assert!(output.stderr().contains("-Ctarget-cpu=native"));
assert!(output.stderr().contains("-Cprofile-generate"));
output.assert_stderr_contains("-Ctarget-cpu=native");
output.assert_stderr_contains("-Cprofile-generate");
output.assert_ok();

Ok(())
Expand Down
9 changes: 9 additions & 0 deletions tests/integration/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ pub trait OutputExt {
fn assert_ok(self) -> Self;
fn assert_error(self) -> Self;

fn assert_stderr_contains(&self, needle: &str);

fn stdout(&self) -> String;
fn stderr(&self) -> String;
}
Expand All @@ -190,6 +192,13 @@ impl OutputExt for Output {
self
}

fn assert_stderr_contains(&self, needle: &str) {
let stderr = self.stderr();
if !stderr.contains(needle) {
panic!("STDERR\n{stderr}\nDOES NOT CONTAIN\n{needle}");
}
}

fn stdout(&self) -> String {
String::from_utf8_lossy(&self.stdout).to_string()
}
Expand Down

0 comments on commit 0558ffc

Please sign in to comment.