@@ -101,7 +101,8 @@ pub fn crossbuild_rust_tests(options: &CrossbuildOptions) -> CrossbuiltTests {
101101 . expect ( "Can't get a current toolchain" ) ;
102102
103103 let active_toolchain = String :: from_utf8_lossy ( & output. stdout ) ;
104- active_toolchain. trim ( ) . to_owned ( )
104+ let mut split = active_toolchain. split_whitespace ( ) ;
105+ split. next ( ) . expect ( "active toolchain missing" ) . trim ( ) . to_owned ( )
105106 } ;
106107
107108 let rustup_sysroot = {
@@ -120,9 +121,21 @@ pub fn crossbuild_rust_tests(options: &CrossbuildOptions) -> CrossbuiltTests {
120121 copy ( sysroot_rlib. absolute_path , format ! ( "{}/{}.o" , tests_deps_dir, sysroot_rlib. name. trim_right_matches( ".rlib" ) ) ) ;
121122 }
122123
123- let mut test_objects: Vec < String > = find_files ( & tests_deps_dir, |n| {
124+ let mut test_objects: Vec < _ > = find_files ( & tests_deps_dir, |n| {
124125 n. ends_with ( ".o" )
125- } ) . iter ( ) . cloned ( ) . map ( |f| f. absolute_path ) . collect ( ) ;
126+ } ) . iter ( ) . cloned ( ) . collect ( ) ;
127+
128+ test_objects. sort_by_key ( |f| {
129+ if f. name . contains ( "freertos_rs" ) { 0 }
130+ else if f. name . contains ( "lazy_static" ) { 1 }
131+ else if f. name . contains ( "liballoc" ) { 2 }
132+ else if f. name . contains ( "libcompiler_builtins" ) { 3 }
133+ else if f. name . contains ( "libcore" ) { 4 }
134+ else if f. name . contains ( "librustc_std_workspace_core" ) { 5 }
135+ else { 6 }
136+ } ) ;
137+
138+ let mut test_objects: Vec < _ > = test_objects. into_iter ( ) . map ( |f| f. absolute_path ) . collect ( ) ;
126139
127140 let mut objects = vec ! [ ] ;
128141 objects. append ( & mut test_objects) ;
0 commit comments