This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ mod build;
55mod config;
66mod prepare;
77mod rustc_info;
8+ mod test;
89mod utils;
910
1011macro_rules! arg_error {
@@ -23,13 +24,15 @@ Available commands for build_system:
2324
2425 prepare : Run prepare command
2526 build : Run build command
27+ test : Run test command
2628 --help : Show this message"
2729 ) ;
2830}
2931
3032pub enum Command {
3133 Prepare ,
3234 Build ,
35+ Test ,
3336}
3437
3538fn main ( ) {
@@ -40,6 +43,7 @@ fn main() {
4043 let command = match env:: args ( ) . nth ( 1 ) . as_deref ( ) {
4144 Some ( "prepare" ) => Command :: Prepare ,
4245 Some ( "build" ) => Command :: Build ,
46+ Some ( "test" ) => Command :: Test ,
4347 Some ( "--help" ) => {
4448 usage ( ) ;
4549 process:: exit ( 0 ) ;
@@ -55,6 +59,7 @@ fn main() {
5559 if let Err ( e) = match command {
5660 Command :: Prepare => prepare:: run ( ) ,
5761 Command :: Build => build:: run ( ) ,
62+ Command :: Test => test:: run ( ) ,
5863 } {
5964 eprintln ! ( "Command failed to run: {e:?}" ) ;
6065 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