File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ mod build;
5
5
mod config;
6
6
mod prepare;
7
7
mod rustc_info;
8
+ mod test;
8
9
mod utils;
9
10
10
11
macro_rules! arg_error {
@@ -23,13 +24,15 @@ Available commands for build_system:
23
24
24
25
prepare : Run prepare command
25
26
build : Run build command
27
+ test : Run test command
26
28
--help : Show this message"
27
29
) ;
28
30
}
29
31
30
32
pub enum Command {
31
33
Prepare ,
32
34
Build ,
35
+ Test ,
33
36
}
34
37
35
38
fn main ( ) {
@@ -40,6 +43,7 @@ fn main() {
40
43
let command = match env:: args ( ) . nth ( 1 ) . as_deref ( ) {
41
44
Some ( "prepare" ) => Command :: Prepare ,
42
45
Some ( "build" ) => Command :: Build ,
46
+ Some ( "test" ) => Command :: Test ,
43
47
Some ( "--help" ) => {
44
48
usage ( ) ;
45
49
process:: exit ( 0 ) ;
@@ -55,6 +59,7 @@ fn main() {
55
59
if let Err ( e) = match command {
56
60
Command :: Prepare => prepare:: run ( ) ,
57
61
Command :: Build => build:: run ( ) ,
62
+ Command :: Test => test:: run ( ) ,
58
63
} {
59
64
eprintln ! ( "Command failed to run: {e:?}" ) ;
60
65
process:: exit ( 1 ) ;
Original file line number Diff line number Diff line change
1
+ use crate :: utils:: run_command_with_output;
2
+
3
+ fn get_args < ' a > ( args : & mut Vec < & ' a dyn AsRef < std:: ffi:: OsStr > > , extra_args : & ' a Vec < String > ) {
4
+ for extra_arg in extra_args {
5
+ args. push ( extra_arg) ;
6
+ }
7
+ }
8
+
9
+ pub fn run ( ) -> Result < ( ) , String > {
10
+ let mut args: Vec < & dyn AsRef < std:: ffi:: OsStr > > = vec ! [ & "bash" , & "test.sh" ] ;
11
+ let extra_args = std:: env:: args ( ) . skip ( 2 ) . collect :: < Vec < _ > > ( ) ;
12
+ get_args ( & mut args, & extra_args) ;
13
+ let current_dir = std:: env:: current_dir ( ) . map_err ( |error| format ! ( "`current_dir` failed: {:?}" , error) ) ?;
14
+ run_command_with_output ( args. as_slice ( ) , Some ( & current_dir) )
15
+ }
You can’t perform that action at this time.
0 commit comments