@@ -84,34 +84,38 @@ pub fn build(
84
84
if !qemu_path. is_dir ( ) {
85
85
println ! ( "cargo:warning=Qemu not found, cloning with git ({QEMU_REVISION})..." ) ;
86
86
fs:: create_dir_all ( & qemu_path) . unwrap ( ) ;
87
- Command :: new ( "git" )
87
+ assert ! ( Command :: new( "git" )
88
88
. current_dir( & qemu_path)
89
89
. arg( "init" )
90
90
. status( )
91
- . unwrap ( ) ;
92
- Command :: new ( "git" )
91
+ . unwrap( )
92
+ . success( ) ) ;
93
+ assert ! ( Command :: new( "git" )
93
94
. current_dir( & qemu_path)
94
95
. arg( "remote" )
95
96
. arg( "add" )
96
97
. arg( "origin" )
97
98
. arg( QEMU_URL )
98
99
. status( )
99
- . unwrap ( ) ;
100
- Command :: new ( "git" )
100
+ . unwrap( )
101
+ . success( ) ) ;
102
+ assert ! ( Command :: new( "git" )
101
103
. current_dir( & qemu_path)
102
104
. arg( "fetch" )
103
105
. arg( "--depth" )
104
106
. arg( "1" )
105
107
. arg( "origin" )
106
108
. arg( QEMU_REVISION )
107
109
. status( )
108
- . unwrap ( ) ;
109
- Command :: new ( "git" )
110
+ . unwrap( )
111
+ . success( ) ) ;
112
+ assert ! ( Command :: new( "git" )
110
113
. current_dir( & qemu_path)
111
114
. arg( "checkout" )
112
115
. arg( "FETCH_HEAD" )
113
116
. status( )
114
- . unwrap ( ) ;
117
+ . unwrap( )
118
+ . success( ) ) ;
115
119
fs:: write ( & qemu_rev, QEMU_REVISION ) . unwrap ( ) ;
116
120
}
117
121
@@ -290,22 +294,24 @@ pub fn build(
290
294
. arg ( "--disable-tests" ) ;
291
295
}
292
296
293
- cmd. status ( ) . expect ( "Configure failed" ) ;
297
+ assert ! (
298
+ cmd. status( ) . expect( "Invoking Configure failed" ) . success( ) ,
299
+ "Configure didn't finish successfully"
300
+ ) ;
301
+ let mut cmd = Command :: new ( "make" ) ;
302
+ cmd. current_dir ( & build_dir)
303
+ . env ( "__LIBAFL_QEMU_BUILD_OUT" , build_dir. join ( "linkinfo.json" ) )
304
+ . env ( "__LIBAFL_QEMU_BUILD_CC" , cc_compiler. path ( ) )
305
+ . env ( "__LIBAFL_QEMU_BUILD_CXX" , cpp_compiler. path ( ) )
306
+ . arg ( "-j" ) ;
307
+
294
308
if let Some ( j) = jobs {
295
- Command :: new ( "make" )
296
- . current_dir ( & build_dir)
297
- . arg ( "-j" )
298
- . arg ( & format ! ( "{j}" ) )
299
- . env ( "V" , "1" )
300
- . status ( )
301
- . expect ( "Make failed" ) ;
302
- } else {
303
- Command :: new ( "make" )
304
- . current_dir ( & build_dir)
305
- . arg ( "-j" )
306
- . status ( )
307
- . expect ( "Make failed" ) ;
309
+ cmd. arg ( & format ! ( "{j}" ) ) . env ( "V" , "1" ) ;
308
310
}
311
+ assert ! (
312
+ cmd. status( ) . expect( "Invoking Make Failed" ) . success( ) ,
313
+ "Make didn't finish successfully"
314
+ ) ;
309
315
}
310
316
311
317
/*
0 commit comments