@@ -323,6 +323,9 @@ pub fn krate(build: &Build,
323
323
if target. contains ( "android" ) {
324
324
build. run ( cargo. arg ( "--no-run" ) ) ;
325
325
krate_android ( build, compiler, target, mode) ;
326
+ } else if target. contains ( "asmjs" ) {
327
+ build. run ( cargo. arg ( "--no-run" ) ) ;
328
+ krate_asmjs ( build, compiler, target, mode) ;
326
329
} else {
327
330
cargo. args ( & build. flags . args ) ;
328
331
build. run ( & mut cargo) ;
@@ -371,6 +374,23 @@ fn krate_android(build: &Build,
371
374
}
372
375
}
373
376
377
+ fn krate_asmjs ( build : & Build ,
378
+ compiler : & Compiler ,
379
+ target : & str ,
380
+ mode : Mode ) {
381
+ let mut tests = Vec :: new ( ) ;
382
+ let out_dir = build. cargo_out ( compiler, mode, target) ;
383
+ find_tests ( & out_dir, target, & mut tests) ;
384
+ find_tests ( & out_dir. join ( "deps" ) , target, & mut tests) ;
385
+
386
+ for test in tests {
387
+ let test_file_name = test. to_string_lossy ( ) . into_owned ( ) ;
388
+ let output = output ( Command :: new ( "node" ) . arg ( & test_file_name) ) ;
389
+ println ! ( "{}" , output) ;
390
+ }
391
+ }
392
+
393
+
374
394
fn find_tests ( dir : & Path ,
375
395
target : & str ,
376
396
dst : & mut Vec < PathBuf > ) {
@@ -381,7 +401,8 @@ fn find_tests(dir: &Path,
381
401
}
382
402
let filename = e. file_name ( ) . into_string ( ) . unwrap ( ) ;
383
403
if ( target. contains ( "windows" ) && filename. ends_with ( ".exe" ) ) ||
384
- ( !target. contains ( "windows" ) && !filename. contains ( "." ) ) {
404
+ ( !target. contains ( "windows" ) && !filename. contains ( "." ) ) ||
405
+ ( target. contains ( "asmjs" ) && filename. contains ( ".js" ) ) {
385
406
dst. push ( e. path ( ) ) ;
386
407
}
387
408
}
0 commit comments