@@ -48,11 +48,16 @@ impl TestCtx {
4848pub struct ConfigBuilder {
4949 args : Vec < String > ,
5050 directory : PathBuf ,
51+ override_download_ci_llvm : bool ,
5152}
5253
5354impl ConfigBuilder {
5455 fn from_args ( args : & [ & str ] , directory : PathBuf ) -> Self {
55- Self { args : args. iter ( ) . copied ( ) . map ( String :: from) . collect ( ) , directory }
56+ Self {
57+ args : args. iter ( ) . copied ( ) . map ( String :: from) . collect ( ) ,
58+ directory,
59+ override_download_ci_llvm : true ,
60+ }
5661 }
5762
5863 pub fn path ( mut self , path : & str ) -> Self {
@@ -106,34 +111,26 @@ impl ConfigBuilder {
106111 self
107112 }
108113
109- pub fn create_config ( mut self ) -> Config {
110- // Run in dry-check, otherwise the test would be too slow
111- self . args . push ( "--dry-run" . to_string ( ) ) ;
112-
113- // Ignore submodules
114- self . args . push ( "--set" . to_string ( ) ) ;
115- self . args . push ( "build.submodules=false" . to_string ( ) ) ;
116-
117- // Override any external LLVM set and inhibit CI LLVM; pretend that we're always building
118- // in-tree LLVM from sources.
119- self . args . push ( "--set" . to_string ( ) ) ;
120- self . args . push ( "llvm.download-ci-llvm=false" . to_string ( ) ) ;
121-
122- // Do not mess with the local rustc checkout build directory
123- self . args . push ( "--build-dir" . to_string ( ) ) ;
124- self . args . push ( self . directory . join ( "build" ) . display ( ) . to_string ( ) ) ;
125-
126- Config :: parse ( Flags :: parse ( & self . args ) )
114+ pub fn no_override_download_ci_llvm ( mut self ) -> Self {
115+ self . override_download_ci_llvm = false ;
116+ self
127117 }
128118
129- pub fn create_config_without_ci_llvm_override ( mut self ) -> Config {
119+ pub fn create_config ( mut self ) -> Config {
130120 // Run in dry-check, otherwise the test would be too slow
131121 self . args . push ( "--dry-run" . to_string ( ) ) ;
132122
133123 // Ignore submodules
134124 self . args . push ( "--set" . to_string ( ) ) ;
135125 self . args . push ( "build.submodules=false" . to_string ( ) ) ;
136126
127+ if self . override_download_ci_llvm {
128+ // Override any external LLVM set and inhibit CI LLVM; pretend that we're always building
129+ // in-tree LLVM from sources.
130+ self . args . push ( "--set" . to_string ( ) ) ;
131+ self . args . push ( "llvm.download-ci-llvm=false" . to_string ( ) ) ;
132+ }
133+
137134 // Do not mess with the local rustc checkout build directory
138135 self . args . push ( "--build-dir" . to_string ( ) ) ;
139136 self . args . push ( self . directory . join ( "build" ) . display ( ) . to_string ( ) ) ;
0 commit comments