@@ -27,6 +27,27 @@ pub struct Environment {
27
27
shared_llvm : bool ,
28
28
run_tests : bool ,
29
29
fast_try_build : bool ,
30
+ /// Additional configuration that bootstrap needs to know only when running tests.
31
+ #[ builder( default ) ]
32
+ test_config : TestConfig ,
33
+ }
34
+
35
+ /// Builds have optional components, and their presence/absence can enable/disable a subset of
36
+ /// tests. When testing the optimized artifacts, bootstrap needs to know about these enabled
37
+ /// components to run the expected subset. This structure holds the known components where this
38
+ /// matters: currently only whether the build to test is using debug assertions.
39
+ ///
40
+ /// FIXME: ultimately, this is a temporary band-aid, and opt-dist should be more transparent to the
41
+ /// CI config and bootstrap optional components: bootstrap has default values, combinations of flags
42
+ /// that cascade into others, etc logic that we'd have to duplicate here otherwise. It's more
43
+ /// sensible for opt-dist to never know about the config apart from the minimal set of paths
44
+ /// required to configure stage0 tests.
45
+ #[ derive( Builder , Default , Clone , Debug ) ]
46
+ pub struct TestConfig {
47
+ /// Whether the build under test is explicitly using `--enable-debug-assertions`.
48
+ /// Note that this flag can be implied from others, like `rust.debug`, and we do not handle any
49
+ /// of these subtleties and defaults here, as per the FIXME above.
50
+ pub enable_debug_assertions : bool ,
30
51
}
31
52
32
53
impl Environment {
@@ -111,6 +132,21 @@ impl Environment {
111
132
pub fn is_fast_try_build ( & self ) -> bool {
112
133
self . fast_try_build
113
134
}
135
+
136
+ pub fn test_config ( & self ) -> & TestConfig {
137
+ & self . test_config
138
+ }
139
+ }
140
+
141
+ impl TestConfig {
142
+ /// Returns the test config matching the given `RUST_CONFIGURE_ARGS` for the known optional
143
+ /// components for tests. This is obviously extremely fragile and we'd rather opt-dist not
144
+ /// handle any optional components.
145
+ pub fn from_configure_args ( configure_args : & str ) -> TestConfig {
146
+ let enable_debug_assertions =
147
+ configure_args. split ( " " ) . find ( |part| * part == "--enable-debug-assertions" ) . is_some ( ) ;
148
+ TestConfig { enable_debug_assertions }
149
+ }
114
150
}
115
151
116
152
/// What is the extension of binary executables on this platform?
0 commit comments