Skip to content

Commit

Permalink
rewrite suspicious-library in rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed May 29, 2024
1 parent d553d5b commit db07d8b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
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
Expand Up @@ -246,7 +246,6 @@ run-make/static-pie/Makefile
run-make/staticlib-blank-lib/Makefile
run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile
run-make/suspicious-library/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile
Expand Down
16 changes: 7 additions & 9 deletions tests/run-make/incr-prev-body-beyond-eof/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,24 @@
// was hashed by rustc in addition to the span length, and the fix still
// works.

// FIXME: Ignore flags temporarily disabled for the test.
// ignore-none
// ignore-nvptx64-nvidia-cuda
//@ ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std`

use run_make_support::{rustc, target, tmp_dir};
use std::fs;

fn main() {
fs::create_dir(tmp_dir().join("src"));
fs::create_dir(tmp_dir().join("incr"));
fs::copy("a.rs", tmp_dir().join("main.rs"));
fs::create_dir(tmp_dir().join("src")).unwrap();
fs::create_dir(tmp_dir().join("incr")).unwrap();
fs::copy("a.rs", tmp_dir().join("src/main.rs")).unwrap();
rustc()
.incremental(tmp_dir().join("incr"))
.input(tmp_dir().join("src/main.rs"))
.target(target())
.target(&target())
.run();
fs::copy("b.rs", tmp_dir().join("main.rs"));
fs::copy("b.rs", tmp_dir().join("src/main.rs")).unwrap();
rustc()
.incremental(tmp_dir().join("incr"))
.input(tmp_dir().join("src/main.rs"))
.target(target())
.target(&target())
.run();
}
3 changes: 2 additions & 1 deletion tests/run-make/resolve-rename/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::fs;
fn main() {
rustc().extra_filename("-hash").input("foo.rs").run();
rustc().input("bar.rs").run();
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"));
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"))
.unwrap();
rustc().input("baz.rs").run();
}
8 changes: 0 additions & 8 deletions tests/run-make/suspicious-library/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions tests/run-make/suspicious-library/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test creates some fake dynamic libraries with nothing inside,
// and checks if rustc avoids them and successfully compiles as a result.

//@ ignore-cross-compile

use run_make_support::{dynamic_lib, rustc};
use std::fs::File;

fn main() {
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
File::create(dynamic_lib("foo-something-special")).unwrap();
File::create(dynamic_lib("foo-something-special2")).unwrap();
rustc().input("bar.rs").run();
}

0 comments on commit db07d8b

Please sign in to comment.