@@ -28,7 +28,8 @@ static Program()
2828 private const string TaskTest = "test" ;
2929 private const string TaskBench = "bench" ;
3030
31- private static bool _verbose = false ;
31+ private static bool s_verbose = false ;
32+ private static CpuInfo s_cpuInfo ;
3233
3334 /// <summary>
3435 /// Main function
@@ -65,8 +66,10 @@ public static async Task Main(
6566 string [ ] problems = null ,
6667 string [ ] environments = null )
6768 {
69+ s_cpuInfo = await CpuInfo . LsCpuAsync ( ) . ConfigureAwait ( false ) ;
70+
6871 Stopwatch timer = Stopwatch . StartNew ( ) ;
69- _verbose = verbose ;
72+ s_verbose = verbose ;
7073 config . EnsureFileExists ( ) ;
7174 algorithm . EnsureDirectoryExists ( ) ;
7275 include . EnsureDirectoryExists ( ) ;
@@ -101,11 +104,10 @@ public static async Task Main(
101104 HashSet < string > includedOsEnvironments = new HashSet < string > ( environments ?? new string [ ] { } , StringComparer . OrdinalIgnoreCase ) ;
102105 HashSet < string > includedProblems = new HashSet < string > ( problems ?? new string [ ] { } , StringComparer . OrdinalIgnoreCase ) ;
103106
104- CpuInfo cpuInfo = await CpuInfo . LsCpuAsync ( ) . ConfigureAwait ( false ) ;
105- if ( cpuInfo != null )
107+ if ( s_cpuInfo != null )
106108 {
107- Logger . Info ( cpuInfo . ToString ( ) ) ;
108- if ( GithubActionUtils . IsGithubBuild && task == TaskBench && cpuInfo . Model < 79 )
109+ Logger . Info ( $ "CPU: { s_cpuInfo } " ) ;
110+ if ( GithubActionUtils . IsGithubBuild && task == TaskBench && s_cpuInfo . Model < 79 )
109111 {
110112 // To print cpu features, use
111113 // either: 'rustc +nightly --print=cfg -C target-cpu=broadwell' (features like avx512 are missing from stable)
@@ -119,6 +121,10 @@ public static async Task Main(
119121 HashSet < string > SetupDockerProvidedRuntimeDedupContext = new HashSet < string > ( ) ;
120122 foreach ( YamlLangConfig c in langConfigs . OrderBy ( i => i . Lang ) )
121123 {
124+ if ( ! c . Enabled )
125+ {
126+ continue ;
127+ }
122128 if ( includedLanguages . Count > 0
123129 && ! includedLanguages . Contains ( c . Lang ) )
124130 {
@@ -130,7 +136,11 @@ public static async Task Main(
130136
131137 foreach ( YamlLangEnvironmentConfig env in c . Environments ?? Enumerable . Empty < YamlLangEnvironmentConfig > ( ) )
132138 {
133- if ( includedOsEnvironments . Count > 0
139+ if ( ! env . Enabled )
140+ {
141+ continue ;
142+ }
143+ if ( includedOsEnvironments . Count > 0
134144 && ! includedOsEnvironments . Contains ( env . Os ) )
135145 {
136146 continue ;
@@ -294,7 +304,7 @@ private static async Task BuildAsync(
294304 Logger . Debug ( $ "Copying { srcCodePath } to { srcCodeDestPath } ") ;
295305 //File.Copy(srcCodePath, srcCodeDestPath, overwrite: true);
296306 await File . WriteAllTextAsync ( path : srcCodeDestPath , await File . ReadAllTextAsync ( srcCodePath ) . ConfigureAwait ( false ) ) . ConfigureAwait ( false ) ;
297- if ( _verbose )
307+ if ( s_verbose )
298308 {
299309 await ProcessUtils . RunCommandAsync ( $ "ls -al \" { tmpDir . FullPath } \" ", asyncRead : false ) . ConfigureAwait ( false ) ;
300310 }
@@ -445,7 +455,7 @@ await ProcessUtils.RunCommandsAsync(
445455
446456 await buildOutputJson . SaveAsync ( buildOutput ) . ConfigureAwait ( false ) ;
447457
448- if ( _verbose )
458+ if ( s_verbose )
449459 {
450460 await ProcessUtils . RunCommandAsync ( $ "ls -al { buildOutput } ", asyncRead : false ) . ConfigureAwait ( false ) ;
451461 }
@@ -521,7 +531,7 @@ await ProcessUtils.RunCommandAsync(
521531 asyncRead : false ,
522532 out string stdOut ,
523533 out string stdErr ,
524- env : null ,
534+ env : langEnvConfig . RunCmdEnv ,
525535 default ) ;
526536 if ( StringComparer . Ordinal . Equals ( expectedOutput . TrimEnd ( ) , stdOut . TrimEnd ( ) ) )
527537 {
@@ -631,7 +641,12 @@ private static async Task BenchAsync(
631641 {
632642 try
633643 {
634- ProcessMeasurement measurement = await ProcessUtils . MeasureAsync ( runPsi , forceCheckChildProcesses : langEnvConfig . ForceCheckChildProcesses , timeoutSeconds : test . TimeoutSeconds ) . ConfigureAwait ( false ) ;
644+ ProcessMeasurement measurement = await ProcessUtils . MeasureAsync (
645+ runPsi ,
646+ forceCheckChildProcesses : langEnvConfig . ForceCheckChildProcesses ,
647+ timeoutSeconds : test . TimeoutSeconds ,
648+ env : langEnvConfig . RunCmdEnv ) . ConfigureAwait ( false ) ;
649+
635650 if ( measurement != null && measurement . Elapsed . TotalMilliseconds > 0 )
636651 {
637652 Logger . Debug ( $ "({ buildId } ){ langConfig . Lang } :{ problem . Name } :{ test . Input } { measurement } ") ;
@@ -679,6 +694,7 @@ private static async Task BenchAsync(
679694 string benchResultJsonPath = Path . Combine ( benchResultDir , $ "{ buildId } _{ test . Input } .json") ;
680695 await File . WriteAllTextAsync ( benchResultJsonPath , JsonConvert . SerializeObject ( new
681696 {
697+ cpuInfo = s_cpuInfo ? . ToString ( ) ,
682698 lang = langConfig . Lang ,
683699 os = langEnvConfig . Os ,
684700 compiler = langEnvConfig . Compiler ,
0 commit comments