File tree Expand file tree Collapse file tree 3 files changed +56
-20
lines changed
tests/run-make/print-native-static-libs Expand file tree Collapse file tree 3 files changed +56
-20
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,6 @@ run-make/pretty-print-to-file/Makefile
221221run-make/pretty-print-with-dep-file/Makefile
222222run-make/print-calling-conventions/Makefile
223223run-make/print-cfg/Makefile
224- run-make/print-native-static-libs/Makefile
225224run-make/print-target-list/Makefile
226225run-make/profile/Makefile
227226run-make/prune-link-args/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ //! This checks the output of `--print=native-static-libs`
2+
3+ //@ ignore-cross-compile
4+ //@ ignore-wasm
5+
6+ extern crate run_make_support;
7+
8+ use std:: io:: BufRead ;
9+
10+ use run_make_support:: rustc;
11+
12+ fn main ( ) {
13+ // build supporting crate
14+ rustc ( )
15+ . input ( "bar.rs" )
16+ . arg ( "--crate-type" )
17+ . arg ( "rlib" )
18+ . arg ( "-lbar_cli" )
19+ . run ( ) ;
20+
21+ // build main crate as staticlib
22+ let output = rustc ( )
23+ . input ( "foo.rs" )
24+ . arg ( "--crate-type" )
25+ . arg ( "staticlib" )
26+ . arg ( "-lfoo_cli" )
27+ . arg ( "-lfoo_cli" ) // 2nd time
28+ . arg ( "--print=native-static-libs" )
29+ . run ( ) ;
30+
31+ let mut found_note = false ;
32+ for l in output. stderr . lines ( ) {
33+ let l = l. expect ( "utf-8 string" ) ;
34+
35+ let Some ( args) = l. strip_prefix ( "note: native-static-libs:" ) else { continue ; } ;
36+ assert ! ( !found_note) ;
37+ found_note = true ;
38+
39+ let args: Vec < & str > = args. trim ( ) . split_ascii_whitespace ( ) . collect ( ) ;
40+
41+ assert ! ( args. contains( & "-lglib-2.0" ) ) ; // in bar.rs
42+ assert ! ( args. contains( & "-lsystemd" ) ) ; // in foo.rs
43+ assert ! ( args. contains( & "-lbar_cli" ) ) ;
44+ assert ! ( args. contains( & "-lfoo_cli" ) ) ;
45+
46+ // make sure that no args are consecutively present
47+ let dedup_args: Vec < & str > = {
48+ let mut args = args. clone ( ) ;
49+ args. dedup ( ) ;
50+ args
51+ } ;
52+ assert_eq ! ( args, dedup_args) ;
53+ }
54+
55+ assert ! ( found_note) ;
56+ }
You can’t perform that action at this time.
0 commit comments