Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate emit-to-stdout run-make test to rmake #128460

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
run-make/branch-protection-check-IBT/Makefile
run-make/cat-and-grep-sanity-check/Makefile
run-make/emit-to-stdout/Makefile
run-make/extern-fn-reachable/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
Expand Down
51 changes: 0 additions & 51 deletions tests/run-make/emit-to-stdout/Makefile

This file was deleted.

107 changes: 107 additions & 0 deletions tests/run-make/emit-to-stdout/rmake.rs
jieyouxu marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: rename this test to rustc-emit-to-stdout or something, since apparently there's a emit-shared-files test which is exercising rustdoc only (where I suggested to rename that test to rustdoc-emit-shared-files as well).

Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// If `-o -` or `--emit KIND=-` is provided, output should be written
// to stdout instead. Binary output (`obj`, `llvm-bc`, `link` and
// `metadata`) being written this way will result in an error unless
// stdout is not a tty. Multiple output types going to stdout will
// trigger an error too, as they will all be mixed together.
// See https://github.com/rust-lang/rust/pull/111626

use run_make_support::{diff, rfs, rustc};

fn main() {
rfs::create_dir("out");
test_asm();
test_llvm_ir();
test_dep_info();
test_mir();
test_llvm_bc();
test_obj();
test_metadata();
test_link();
test_multiple_types();
test_multiple_types_option_o();
}

fn test_asm() {
rustc().emit("asm=out/asm").input("test.rs").run();
let emit = rustc().emit("asm=-").input("test.rs").run().stdout_utf8();
diff().expected_file("out/asm").actual_text("actual", &emit).run();
}

fn test_llvm_ir() {
rustc().emit("llvm-ir=out/llvm-ir").input("test.rs").run();
let emit = rustc().emit("llvm-ir=-").input("test.rs").run().stdout_utf8();
diff().expected_file("out/llvm-ir").actual_text("actual", &emit).run();
}

fn test_dep_info() {
rustc()
.emit("dep-info=out/dep-info")
.input("test.rs")
.arg("-Zdep-info-omit-d-target=yes")
.run();
let emit = rustc().emit("dep-info=-").input("test.rs").run().stdout_utf8();
diff().expected_file("out/dep-info").actual_text("actual", &emit).run();
}

fn test_mir() {
rustc().emit("mir=out/mir").input("test.rs").run();
let emit = rustc().emit("mir=-").input("test.rs").run().stdout_utf8();
diff().expected_file("out/mir").actual_text("actual", &emit).run();
}

// FIXME: ptmx
fn test_llvm_bc() {
let emit = rustc().emit("llvm-bc=-").input("test.rs").run().stderr_utf8();
diff().expected_file("emit-llvm-bc.stderr").actual_text("actual", &emit).run();
}

// FIXME: ptmx
fn test_obj() {
let emit = rustc().emit("obj=-").input("test.rs").run().stderr_utf8();
diff().expected_file("emit-obj.stderr").actual_text("actual", &emit).run();
}

// FIXME: ptmx
fn test_metadata() {
let emit = rustc().emit("metadata=-").input("test.rs").run().stderr_utf8();
diff().expected_file("emit-metadata.stderr").actual_text("actual", &emit).run();
}

// FIXME: ptmx
fn test_link() {
let emit = rustc().emit("link=-").input("test.rs").run().stderr_utf8();
diff().expected_file("emit-link.stderr").actual_text("actual", &emit).run();
}

fn test_multiple_types() {
diff()
.expected_file("emit-multiple-types.stderr")
.actual_text(
"actual",
rustc()
.output("-")
.emit("asm=-")
.emit("llvm-ir=-")
.emit("dep-info=-")
.emit("mir=-")
.input("test.rs")
.run_fail()
.stderr_utf8(),
)
.run();
}

fn test_multiple_types_option_o() {
diff()
.expected_file("emit-multiple-types.stderr")
.actual_text(
"actual",
rustc()
.output("-")
.emit("asm,llvm-ir,dep-info,mir")
.input("test.rs")
.run_fail()
.stderr_utf8(),
)
.run();
}
Loading