@@ -31,13 +31,20 @@ pub struct Step {
31
31
}
32
32
33
33
impl Step {
34
- fn run ( & self , target : Target , dir : & Path , target_dir : & Path ) -> Result < ( ) > {
34
+ fn run (
35
+ & self ,
36
+ target : Target ,
37
+ cwd : & Path ,
38
+ env : Vec < ( & str , & str ) > ,
39
+ target_dir : & Path ,
40
+ ) -> Result < ( ) > {
35
41
ok_output ( "Running" , format ! ( "'{}'" , & self . command) ) ;
36
42
let output = match target {
37
43
Target :: Unix => Command :: new ( "/bin/sh" )
38
44
. arg ( "-c" )
39
45
. arg ( & self . command )
40
- . current_dir ( dir)
46
+ . envs ( env. into_iter ( ) )
47
+ . current_dir ( cwd)
41
48
. output ( ) ?,
42
49
Target :: Windows => {
43
50
// Write the command into a script
@@ -49,7 +56,8 @@ impl Step {
49
56
. args ( POWERSHELL_OPTS )
50
57
. arg ( "-Command" )
51
58
. arg ( format ! ( "&'{}'" , & script. canonicalize( ) ?. to_string_lossy( ) ) )
52
- . current_dir ( dir)
59
+ . envs ( env. into_iter ( ) )
60
+ . current_dir ( cwd)
53
61
. output ( ) ?
54
62
}
55
63
} ;
@@ -95,21 +103,29 @@ pub struct TestCase {
95
103
impl TestCase {
96
104
pub fn setup ( & self , dir : & Path , target_dir : & Path ) -> Result < ( ) > {
97
105
for s in & self . setup {
98
- s. run ( self . target , dir, target_dir) ?;
106
+ s. run ( self . target , dir, vec ! [ ] , target_dir) ?;
99
107
}
100
108
Ok ( ( ) )
101
109
}
102
110
103
- pub fn check ( & self , dir : & Path , target_dir : & Path ) -> Result < ( ) > {
111
+ pub fn check ( & self , dir : & Path , reports_file : & Path , target_dir : & Path ) -> Result < ( ) > {
104
112
for s in & self . check {
105
- s. run ( self . target , dir, target_dir) ?;
113
+ s. run (
114
+ self . target ,
115
+ dir,
116
+ vec ! [ (
117
+ "REPORTS_FILE" ,
118
+ & reports_file. canonicalize( ) . unwrap( ) . to_string_lossy( ) ,
119
+ ) ] ,
120
+ target_dir,
121
+ ) ?;
106
122
}
107
123
Ok ( ( ) )
108
124
}
109
125
110
126
pub fn cleanup ( & self , dir : & Path , target_dir : & Path ) -> Result < ( ) > {
111
127
for s in & self . cleanup {
112
- s. run ( self . target , dir, target_dir) ?;
128
+ s. run ( self . target , dir, vec ! [ ] , target_dir) ?;
113
129
}
114
130
Ok ( ( ) )
115
131
}
0 commit comments