File tree Expand file tree Collapse file tree 5 files changed +51
-13
lines changed
tests/run-make/crate-data-smoke Expand file tree Collapse file tree 5 files changed +51
-13
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,13 @@ pub fn dynamic_lib_name(name: &str) -> String {
135135/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
136136/// path with `$TMPDIR` joined with the library name.
137137pub fn rust_lib ( name : & str ) -> PathBuf {
138- tmp_dir ( ) . join ( format ! ( "lib{name}.rlib" ) )
138+ tmp_dir ( ) . join ( rust_lib_name ( name) )
139+ }
140+
141+ /// Generate the name a rust library (rlib) would have. If you want the complete path, use
142+ /// [`rust_lib`] instead.
143+ pub fn rust_lib_name ( name : & str ) -> String {
144+ format ! ( "lib{name}.rlib" )
139145}
140146
141147/// Construct the binary name based on platform.
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ impl Rustc {
211211
212212 /// Get the [`Output`] of the finished process.
213213 #[ track_caller]
214- pub fn command_output ( & mut self ) -> :: std :: process :: Output {
214+ pub fn command_output ( & mut self ) -> Output {
215215 // let's make sure we piped all the input and outputs
216216 self . cmd . stdin ( Stdio :: piped ( ) ) ;
217217 self . cmd . stdout ( Stdio :: piped ( ) ) ;
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ run-make/compiler-lookup-paths/Makefile
2222run-make/compiler-rt-works-on-mingw/Makefile
2323run-make/compressed-debuginfo/Makefile
2424run-make/const_fn_mir/Makefile
25- run-make/crate-data-smoke/Makefile
2625run-make/crate-hash-rustc-version/Makefile
2726run-make/crate-name-priority/Makefile
2827run-make/cross-lang-lto-clang/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ use std:: process:: Output ;
2+
3+ use run_make_support:: { bin_name, rust_lib_name, rustc} ;
4+
5+ fn compare_stdout < S : AsRef < str > > ( output : Output , expected : S ) {
6+ assert_eq ! (
7+ String :: from_utf8( output. stdout) . unwrap( ) . trim( ) ,
8+ expected. as_ref( )
9+ ) ;
10+ }
11+
12+ fn main ( ) {
13+ compare_stdout ( rustc ( ) . print ( "crate-name" ) . input ( "crate.rs" ) . run ( ) , "foo" ) ;
14+ compare_stdout (
15+ rustc ( ) . print ( "file-names" ) . input ( "crate.rs" ) . run ( ) ,
16+ bin_name ( "foo" ) ,
17+ ) ;
18+ compare_stdout (
19+ rustc ( )
20+ . print ( "file-names" )
21+ . crate_type ( "lib" )
22+ . arg ( "--test" )
23+ . input ( "crate.rs" )
24+ . run ( ) ,
25+ bin_name ( "foo" ) ,
26+ ) ;
27+ compare_stdout (
28+ rustc ( )
29+ . print ( "file-names" )
30+ . arg ( "--test" )
31+ . input ( "lib.rs" )
32+ . run ( ) ,
33+ bin_name ( "mylib" ) ,
34+ ) ;
35+ compare_stdout (
36+ rustc ( ) . print ( "file-names" ) . input ( "lib.rs" ) . run ( ) ,
37+ rust_lib_name ( "mylib" ) ,
38+ ) ;
39+ compare_stdout (
40+ rustc ( ) . print ( "file-names" ) . input ( "rlib.rs" ) . run ( ) ,
41+ rust_lib_name ( "mylib" ) ,
42+ ) ;
43+ }
You can’t perform that action at this time.
0 commit comments