Rollup merge of #126386 - GuillaumeGomez:migrate-run-make-allow-non-lint-warnings-cmdline, r=jieyouxu
Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? ```@jieyouxu```
This commit is contained in:
commit
edd4c97b81
5 changed files with 23 additions and 15 deletions
|
@ -6,7 +6,7 @@ use std::path::Path;
|
||||||
use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
|
use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
|
||||||
|
|
||||||
use crate::drop_bomb::DropBomb;
|
use crate::drop_bomb::DropBomb;
|
||||||
use crate::{assert_not_contains, handle_failed_output};
|
use crate::{assert_contains, assert_not_contains, handle_failed_output};
|
||||||
|
|
||||||
/// This is a custom command wrapper that simplifies working with commands and makes it easier to
|
/// This is a custom command wrapper that simplifies working with commands and makes it easier to
|
||||||
/// ensure that we check the exit status of executed processes.
|
/// ensure that we check the exit status of executed processes.
|
||||||
|
@ -170,6 +170,12 @@ impl CompletedProcess {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
|
pub fn assert_stdout_contains<S: AsRef<str>>(self, needle: S) -> Self {
|
||||||
|
assert_contains(&self.stdout_utf8(), needle.as_ref());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn assert_stdout_not_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
|
pub fn assert_stdout_not_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
|
||||||
assert_not_contains(&self.stdout_utf8(), needle.as_ref());
|
assert_not_contains(&self.stdout_utf8(), needle.as_ref());
|
||||||
|
@ -185,7 +191,7 @@ impl CompletedProcess {
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn assert_stderr_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
|
pub fn assert_stderr_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
|
||||||
assert!(self.stderr_utf8().contains(needle.as_ref()));
|
assert_contains(&self.stderr_utf8(), needle.as_ref());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,18 @@ pub fn read_dir<F: Fn(&Path)>(dir: impl AsRef<Path>, callback: F) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check that `haystack` contains `needle`. Panic otherwise.
|
||||||
|
#[track_caller]
|
||||||
|
pub fn assert_contains(haystack: &str, needle: &str) {
|
||||||
|
if !haystack.contains(needle) {
|
||||||
|
eprintln!("=== HAYSTACK ===");
|
||||||
|
eprintln!("{}", haystack);
|
||||||
|
eprintln!("=== NEEDLE ===");
|
||||||
|
eprintln!("{}", needle);
|
||||||
|
panic!("needle was not found in haystack");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Check that `haystack` does not contain `needle`. Panic otherwise.
|
/// Check that `haystack` does not contain `needle`. Panic otherwise.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn assert_not_contains(haystack: &str, needle: &str) {
|
pub fn assert_not_contains(haystack: &str, needle: &str) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
run-make/allocator-shim-circular-deps/Makefile
|
run-make/allocator-shim-circular-deps/Makefile
|
||||||
run-make/allow-non-lint-warnings-cmdline/Makefile
|
|
||||||
run-make/archive-duplicate-names/Makefile
|
run-make/archive-duplicate-names/Makefile
|
||||||
run-make/atomic-lock-free/Makefile
|
run-make/atomic-lock-free/Makefile
|
||||||
run-make/branch-protection-check-IBT/Makefile
|
run-make/branch-protection-check-IBT/Makefile
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
# ignore-cross-compile
|
|
||||||
include ../tools.mk
|
|
||||||
|
|
||||||
# Test that -A warnings makes the 'empty trait list for derive' warning go away
|
|
||||||
OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" )
|
|
||||||
|
|
||||||
all: foo
|
|
||||||
test -z '$(OUT)'
|
|
||||||
|
|
||||||
# This is just to make sure the above command actually succeeds
|
|
||||||
foo:
|
|
||||||
$(RUSTC) foo.rs -A warnings
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
//@ compile-flags: -Awarnings
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
#[derive()]
|
#[derive()]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Foo;
|
pub struct Foo;
|
Loading…
Add table
Add a link
Reference in a new issue