@@ -30,7 +30,9 @@ use collector::compile::execute::profiler::{ProfileProcessor, Profiler};
30
30
use collector:: runtime:: {
31
31
bench_runtime, runtime_benchmark_dir, BenchmarkFilter , CargoIsolationMode ,
32
32
} ;
33
- use collector:: toolchain:: { get_local_toolchain, Sysroot , Toolchain } ;
33
+ use collector:: toolchain:: {
34
+ create_toolchain_from_published_version, get_local_toolchain, Sysroot , Toolchain ,
35
+ } ;
34
36
35
37
fn n_normal_benchmarks_remaining ( n : usize ) -> String {
36
38
let suffix = if n == 1 { "" } else { "s" } ;
@@ -827,13 +829,8 @@ fn main_result() -> anyhow::Result<i32> {
827
829
828
830
match next {
829
831
NextArtifact :: Release ( tag) => {
830
- bench_published_artifact (
831
- tag,
832
- pool,
833
- & mut rt,
834
- & target_triple,
835
- & compile_benchmark_dir,
836
- ) ?;
832
+ let toolchain = create_toolchain_from_published_version ( & tag, & target_triple) ?;
833
+ bench_published_artifact ( & toolchain, pool, & mut rt, & compile_benchmark_dir) ?;
837
834
838
835
client. post ( format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
839
836
}
@@ -885,13 +882,8 @@ fn main_result() -> anyhow::Result<i32> {
885
882
886
883
Commands :: BenchPublished { toolchain, db } => {
887
884
let pool = database:: Pool :: open ( & db. db ) ;
888
- bench_published_artifact (
889
- toolchain,
890
- pool,
891
- & mut rt,
892
- & target_triple,
893
- & compile_benchmark_dir,
894
- ) ?;
885
+ let toolchain = create_toolchain_from_published_version ( & toolchain, & target_triple) ?;
886
+ bench_published_artifact ( & toolchain, pool, & mut rt, & compile_benchmark_dir) ?;
895
887
Ok ( 0 )
896
888
}
897
889
@@ -1052,53 +1044,27 @@ async fn init_compile_collector(
1052
1044
}
1053
1045
1054
1046
fn bench_published_artifact (
1055
- toolchain : String ,
1047
+ toolchain : & Toolchain ,
1056
1048
pool : Pool ,
1057
1049
rt : & mut Runtime ,
1058
- target_triple : & str ,
1059
1050
benchmark_dir : & Path ,
1060
1051
) -> anyhow:: Result < ( ) > {
1061
- let status = Command :: new ( "rustup" )
1062
- . args ( [ "install" , "--profile=minimal" , & toolchain] )
1063
- . status ( )
1064
- . context ( "rustup install" ) ?;
1065
- if !status. success ( ) {
1066
- anyhow:: bail!( "failed to install toolchain for {}" , toolchain) ;
1067
- }
1068
-
1069
- let profiles = if collector:: version_supports_doc ( & toolchain) {
1052
+ let profiles = if collector:: version_supports_doc ( & toolchain. id ) {
1070
1053
Profile :: all ( )
1071
1054
} else {
1072
1055
Profile :: all_non_doc ( )
1073
1056
} ;
1074
- let scenarios = if collector:: version_supports_incremental ( & toolchain) {
1057
+ let scenarios = if collector:: version_supports_incremental ( & toolchain. id ) {
1075
1058
Scenario :: all ( )
1076
1059
} else {
1077
1060
Scenario :: all_non_incr ( )
1078
1061
} ;
1079
1062
1080
- let which = |tool| {
1081
- String :: from_utf8 (
1082
- Command :: new ( "rustup" )
1083
- . arg ( "which" )
1084
- . arg ( "--toolchain" )
1085
- . arg ( & toolchain)
1086
- . arg ( tool)
1087
- . output ( )
1088
- . context ( format ! ( "rustup which {}" , tool) ) ?
1089
- . stdout ,
1090
- )
1091
- . context ( "utf8" )
1092
- } ;
1093
- let rustc = which ( "rustc" ) ?;
1094
- let rustdoc = which ( "rustdoc" ) ?;
1095
- let cargo = which ( "cargo" ) ?;
1096
-
1097
1063
// Exclude benchmarks that don't work with a stable compiler.
1098
1064
let mut benchmarks = get_compile_benchmarks ( benchmark_dir, None , None , None ) ?;
1099
1065
benchmarks. retain ( |b| b. category ( ) . is_stable ( ) ) ;
1100
1066
1101
- let artifact_id = ArtifactId :: Tag ( toolchain. clone ( ) ) ;
1067
+ let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
1102
1068
let ( conn, collector) = rt. block_on ( init_compile_collector (
1103
1069
& pool,
1104
1070
& benchmarks,
@@ -1110,13 +1076,7 @@ fn bench_published_artifact(
1110
1076
conn,
1111
1077
& profiles,
1112
1078
& scenarios,
1113
- & Toolchain {
1114
- rustc : PathBuf :: from ( rustc. trim ( ) ) ,
1115
- rustdoc : Some ( PathBuf :: from ( rustdoc. trim ( ) ) ) ,
1116
- cargo : PathBuf :: from ( cargo. trim ( ) ) ,
1117
- id : toolchain,
1118
- triple : target_triple. to_string ( ) ,
1119
- } ,
1079
+ toolchain,
1120
1080
& benchmarks,
1121
1081
Some ( 3 ) ,
1122
1082
/* is_self_profile */ false ,
0 commit comments