@@ -70,7 +70,36 @@ fn get_output(props: &TestProps, proc_res: &ProcRes) -> String {
70
70
}
71
71
}
72
72
73
+
74
+ fn for_each_revision < OP > ( config : & Config , props : & TestProps , testpaths : & TestPaths ,
75
+ mut op : OP )
76
+ where OP : FnMut ( & Config , & TestProps , & TestPaths , Option < & str > )
77
+ {
78
+ if props. revisions . is_empty ( ) {
79
+ op ( config, props, testpaths, None )
80
+ } else {
81
+ for revision in & props. revisions {
82
+ let mut revision_props = props. clone ( ) ;
83
+ header:: load_props_into ( & mut revision_props,
84
+ & testpaths. file ,
85
+ Some ( & revision) ) ;
86
+ revision_props. compile_flags . extend ( vec ! [
87
+ format!( "--cfg" ) ,
88
+ format!( "{}" , revision) ,
89
+ ] ) ;
90
+ op ( config, & revision_props, testpaths, Some ( revision) ) ;
91
+ }
92
+ }
93
+ }
94
+
73
95
fn run_cfail_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
96
+ for_each_revision ( config, props, testpaths, run_cfail_test_revision) ;
97
+ }
98
+
99
+ fn run_cfail_test_revision ( config : & Config ,
100
+ props : & TestProps ,
101
+ testpaths : & TestPaths ,
102
+ revision : Option < & str > ) {
74
103
let proc_res = compile_test ( config, props, testpaths) ;
75
104
76
105
if proc_res. status . success ( ) {
@@ -85,7 +114,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
85
114
}
86
115
87
116
let output_to_check = get_output ( props, & proc_res) ;
88
- let expected_errors = errors:: load_errors ( & testpaths. file , & props . revision ) ;
117
+ let expected_errors = errors:: load_errors ( & testpaths. file , revision) ;
89
118
if !expected_errors. is_empty ( ) {
90
119
if !props. error_patterns . is_empty ( ) {
91
120
fatal ( "both error pattern and expected errors specified" ) ;
@@ -99,6 +128,13 @@ fn run_cfail_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
99
128
}
100
129
101
130
fn run_rfail_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
131
+ for_each_revision ( config, props, testpaths, run_rfail_test_revision) ;
132
+ }
133
+
134
+ fn run_rfail_test_revision ( config : & Config ,
135
+ props : & TestProps ,
136
+ testpaths : & TestPaths ,
137
+ _revision : Option < & str > ) {
102
138
let proc_res = compile_test ( config, props, testpaths) ;
103
139
104
140
if !proc_res. status . success ( ) {
@@ -130,6 +166,13 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
130
166
}
131
167
132
168
fn run_rpass_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
169
+ for_each_revision ( config, props, testpaths, run_rpass_test_revision) ;
170
+ }
171
+
172
+ fn run_rpass_test_revision ( config : & Config ,
173
+ props : & TestProps ,
174
+ testpaths : & TestPaths ,
175
+ _revision : Option < & str > ) {
133
176
let proc_res = compile_test ( config, props, testpaths) ;
134
177
135
178
if !proc_res. status . success ( ) {
@@ -144,6 +187,8 @@ fn run_rpass_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
144
187
}
145
188
146
189
fn run_valgrind_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
190
+ assert ! ( props. revisions. is_empty( ) , "revisions not relevant to rpass tests" ) ;
191
+
147
192
if config. valgrind_path . is_none ( ) {
148
193
assert ! ( !config. force_valgrind) ;
149
194
return run_rpass_test ( config, props, testpaths) ;
@@ -1804,6 +1849,8 @@ fn run_rustdoc_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
1804
1849
}
1805
1850
1806
1851
fn run_codegen_units_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
1852
+ assert ! ( props. revisions. is_empty( ) , "revisions not relevant to codegen units" ) ;
1853
+
1807
1854
let proc_res = compile_test ( config, props, testpaths) ;
1808
1855
1809
1856
if !proc_res. status . success ( ) {
@@ -1821,7 +1868,7 @@ fn run_codegen_units_test(config: &Config, props: &TestProps, testpaths: &TestPa
1821
1868
. map ( |s| ( & s[ prefix. len ( ) ..] ) . to_string ( ) )
1822
1869
. collect ( ) ;
1823
1870
1824
- let expected: HashSet < String > = errors:: load_errors ( & testpaths. file , & props . revision )
1871
+ let expected: HashSet < String > = errors:: load_errors ( & testpaths. file , None )
1825
1872
. iter ( )
1826
1873
. map ( |e| e. msg . trim ( ) . to_string ( ) )
1827
1874
. collect ( ) ;
0 commit comments