File tree 5 files changed +51
-13
lines changed
tests/run-make/crate-data-smoke
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 {
135
135
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
136
136
/// path with `$TMPDIR` joined with the library name.
137
137
pub 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" )
139
145
}
140
146
141
147
/// Construct the binary name based on platform.
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ impl Rustc {
211
211
212
212
/// Get the [`Output`] of the finished process.
213
213
#[ track_caller]
214
- pub fn command_output ( & mut self ) -> :: std :: process :: Output {
214
+ pub fn command_output ( & mut self ) -> Output {
215
215
// let's make sure we piped all the input and outputs
216
216
self . cmd . stdin ( Stdio :: piped ( ) ) ;
217
217
self . cmd . stdout ( Stdio :: piped ( ) ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
23
23
run-make/compressed-debuginfo/Makefile
24
24
run-make/const-prop-lint/Makefile
25
25
run-make/const_fn_mir/Makefile
26
- run-make/crate-data-smoke/Makefile
27
26
run-make/crate-hash-rustc-version/Makefile
28
27
run-make/crate-name-priority/Makefile
29
28
run-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