@@ -16,11 +16,8 @@ use std::{
1616
1717use enum_map:: { enum_map, Enum , EnumMap } ;
1818use once_cell:: sync:: Lazy ;
19- use tokio:: runtime:: Builder ;
2019use url:: Url ;
2120
22- use crate :: cli:: rustup_mode;
23- use crate :: currentprocess;
2421use crate :: test as rustup_test;
2522use crate :: test:: const_dist_dir;
2623use crate :: test:: this_host_triple;
@@ -679,13 +676,8 @@ impl Config {
679676 I : IntoIterator < Item = A > + Clone + Debug ,
680677 A : AsRef < OsStr > ,
681678 {
682- let inprocess = allow_inprocess ( name, args. clone ( ) ) ;
683679 let start = Instant :: now ( ) ;
684- let out = if inprocess {
685- self . run_inprocess ( name, args. clone ( ) , env)
686- } else {
687- self . run_subprocess ( name, args. clone ( ) , env)
688- } ;
680+ let out = self . run_subprocess ( name, args. clone ( ) , env) ;
689681 let duration = Instant :: now ( ) - start;
690682 let output = SanitizedOutput {
691683 ok : matches ! ( out. status, Some ( 0 ) ) ,
@@ -694,7 +686,6 @@ impl Config {
694686 } ;
695687
696688 println ! ( "ran: {} {:?}" , name, args) ;
697- println ! ( "inprocess: {inprocess}" ) ;
698689 println ! ( "status: {:?}" , out. status) ;
699690 println ! ( "duration: {:.3}s" , duration. as_secs_f32( ) ) ;
700691 println ! ( "stdout:\n ====\n {}\n ====\n " , output. stdout) ;
@@ -703,54 +694,6 @@ impl Config {
703694 output
704695 }
705696
706- #[ cfg_attr( feature = "otel" , tracing:: instrument( skip_all) ) ]
707- pub ( crate ) fn run_inprocess < I , A > ( & self , name : & str , args : I , env : & [ ( & str , & str ) ] ) -> Output
708- where
709- I : IntoIterator < Item = A > ,
710- A : AsRef < OsStr > ,
711- {
712- // should we use vars_os, or skip over non-stringable vars? This is test
713- // code after all...
714- let mut vars: HashMap < String , String > = HashMap :: default ( ) ;
715- self :: env ( self , & mut vars) ;
716- vars. extend ( env. iter ( ) . map ( |( k, v) | ( k. to_string ( ) , v. to_string ( ) ) ) ) ;
717- let mut arg_strings: Vec < Box < str > > = Vec :: new ( ) ;
718- arg_strings. push ( name. to_owned ( ) . into_boxed_str ( ) ) ;
719- for arg in args {
720- arg_strings. push (
721- arg. as_ref ( )
722- . to_os_string ( )
723- . into_string ( )
724- . unwrap ( )
725- . into_boxed_str ( ) ,
726- ) ;
727- }
728- let tp = currentprocess:: TestProcess :: new ( & * self . workdir . borrow ( ) , & arg_strings, vars, "" ) ;
729- let mut builder = Builder :: new_multi_thread ( ) ;
730- builder
731- . enable_all ( )
732- . worker_threads ( 2 )
733- . max_blocking_threads ( 2 ) ;
734- let process_res = currentprocess:: with_runtime (
735- tp. clone ( ) . into ( ) ,
736- builder,
737- rustup_mode:: main ( tp. cwd . clone ( ) ) ,
738- ) ;
739- // convert Err's into an ec
740- let ec = match process_res {
741- Ok ( process_res) => process_res,
742- Err ( e) => {
743- currentprocess:: with ( tp. clone ( ) . into ( ) , || crate :: cli:: common:: report_error ( & e) ) ;
744- utils:: ExitCode ( 1 )
745- }
746- } ;
747- Output {
748- status : Some ( ec. 0 ) ,
749- stderr : tp. get_stderr ( ) ,
750- stdout : tp. get_stdout ( ) ,
751- }
752- }
753-
754697 #[ track_caller]
755698 pub fn run_subprocess < I , A > ( & self , name : & str , args : I , env : & [ ( & str , & str ) ] ) -> Output
756699 where
@@ -854,43 +797,6 @@ pub fn env<E: rustup_test::Env>(config: &Config, cmd: &mut E) {
854797 config. env ( cmd)
855798}
856799
857- fn allow_inprocess < I , A > ( name : & str , args : I ) -> bool
858- where
859- I : IntoIterator < Item = A > ,
860- A : AsRef < OsStr > ,
861- {
862- // Only the rustup alias is currently ready for in-process testing:
863- // - -init performs self-update which monkey with global external state.
864- // - proxies themselves behave appropriately the proxied output needs to be
865- // collected for assertions to be made on it as our tests traverse layers.
866- // - self update executions cannot run in-process because on windows the
867- // process replacement dance would replace the test process.
868- // - any command with --version in it is testing to see something was
869- // installed properly, so we have to shell out to it to be sure
870- if name != "rustup" {
871- return false ;
872- }
873- let mut is_update = false ;
874- let mut no_self_update = false ;
875- let mut self_cmd = false ;
876- let mut run = false ;
877- let mut version = false ;
878- for arg in args {
879- if arg. as_ref ( ) == "update" {
880- is_update = true ;
881- } else if arg. as_ref ( ) == "--no-self-update" {
882- no_self_update = true ;
883- } else if arg. as_ref ( ) == "self" {
884- self_cmd = true ;
885- } else if arg. as_ref ( ) == "run" {
886- run = true ;
887- } else if arg. as_ref ( ) == "--version" {
888- version = true ;
889- }
890- }
891- !( run || self_cmd || version || ( is_update && !no_self_update) )
892- }
893-
894800#[ derive( Copy , Clone , Eq , PartialEq ) ]
895801enum RlsStatus {
896802 Available ,
0 commit comments