@@ -58,157 +58,144 @@ pub fn parse_config(args: Vec<String>) -> Config {
58
58
}
59
59
60
60
let mut opts = Options :: new ( ) ;
61
- opts. reqopt ( "" , "compile-lib-path" , "path to host shared libraries" , "PATH" )
62
- . reqopt ( "" , "run-lib-path" , "path to target shared libraries" , "PATH" )
63
- . reqopt ( "" , "rustc-path" , "path to rustc to use for compiling" , "PATH" )
64
- . optopt ( "" , "cargo-path" , "path to cargo to use for compiling" , "PATH" )
65
- . optopt (
66
- "" ,
67
- "stage0-rustc-path" ,
68
- "path to rustc to use for compiling run-make recipes" ,
69
- "PATH" ,
70
- )
71
- . optopt ( "" , "rustdoc-path" , "path to rustdoc to use for compiling" , "PATH" )
72
- . optopt ( "" , "coverage-dump-path" , "path to coverage-dump to use in tests" , "PATH" )
73
- . reqopt ( "" , "python" , "path to python to use for doc tests" , "PATH" )
74
- . optopt ( "" , "jsondocck-path" , "path to jsondocck to use for doc tests" , "PATH" )
75
- . optopt ( "" , "jsondoclint-path" , "path to jsondoclint to use for doc tests" , "PATH" )
76
- . optopt ( "" , "run-clang-based-tests-with" , "path to Clang executable" , "PATH" )
77
- . optopt ( "" , "llvm-filecheck" , "path to LLVM's FileCheck binary" , "DIR" )
78
- . reqopt ( "" , "src-root" , "directory containing sources" , "PATH" )
79
- . reqopt ( "" , "src-test-suite-root" , "directory containing test suite sources" , "PATH" )
80
- . reqopt ( "" , "build-root" , "path to root build directory" , "PATH" )
81
- . reqopt ( "" , "build-test-suite-root" , "path to test suite specific build directory" , "PATH" )
82
- . reqopt ( "" , "sysroot-base" , "directory containing the compiler sysroot" , "PATH" )
83
- . reqopt ( "" , "stage" , "stage number under test" , "N" )
84
- . reqopt ( "" , "stage-id" , "the target-stage identifier" , "stageN-TARGET" )
85
- . reqopt (
86
- "" ,
87
- "mode" ,
88
- "which sort of compile tests to run" ,
89
- "pretty | debug-info | codegen | rustdoc \
61
+ opts. reqopt (
62
+ "" ,
63
+ "rust-version" ,
64
+ "rust version info (e.g. `1.89.0-beta.1 (88b80702e 2025-06-23)`)" ,
65
+ "VERSION STRING" ,
66
+ )
67
+ . reqopt ( "" , "compile-lib-path" , "path to host shared libraries" , "PATH" )
68
+ . reqopt ( "" , "run-lib-path" , "path to target shared libraries" , "PATH" )
69
+ . reqopt ( "" , "rustc-path" , "path to rustc to use for compiling" , "PATH" )
70
+ . optopt ( "" , "cargo-path" , "path to cargo to use for compiling" , "PATH" )
71
+ . optopt ( "" , "stage0-rustc-path" , "path to rustc to use for compiling run-make recipes" , "PATH" )
72
+ . optopt ( "" , "rustdoc-path" , "path to rustdoc to use for compiling" , "PATH" )
73
+ . optopt ( "" , "coverage-dump-path" , "path to coverage-dump to use in tests" , "PATH" )
74
+ . reqopt ( "" , "python" , "path to python to use for doc tests" , "PATH" )
75
+ . optopt ( "" , "jsondocck-path" , "path to jsondocck to use for doc tests" , "PATH" )
76
+ . optopt ( "" , "jsondoclint-path" , "path to jsondoclint to use for doc tests" , "PATH" )
77
+ . optopt ( "" , "run-clang-based-tests-with" , "path to Clang executable" , "PATH" )
78
+ . optopt ( "" , "llvm-filecheck" , "path to LLVM's FileCheck binary" , "DIR" )
79
+ . reqopt ( "" , "src-root" , "directory containing sources" , "PATH" )
80
+ . reqopt ( "" , "src-test-suite-root" , "directory containing test suite sources" , "PATH" )
81
+ . reqopt ( "" , "build-root" , "path to root build directory" , "PATH" )
82
+ . reqopt ( "" , "build-test-suite-root" , "path to test suite specific build directory" , "PATH" )
83
+ . reqopt ( "" , "sysroot-base" , "directory containing the compiler sysroot" , "PATH" )
84
+ . reqopt ( "" , "stage" , "stage number under test" , "N" )
85
+ . reqopt ( "" , "stage-id" , "the target-stage identifier" , "stageN-TARGET" )
86
+ . reqopt (
87
+ "" ,
88
+ "mode" ,
89
+ "which sort of compile tests to run" ,
90
+ "pretty | debug-info | codegen | rustdoc \
90
91
| rustdoc-json | codegen-units | incremental | run-make | ui \
91
92
| rustdoc-js | mir-opt | assembly | crashes",
92
- )
93
- . reqopt (
94
- "" ,
95
- "suite" ,
96
- "which suite of compile tests to run. used for nicer error reporting." ,
97
- "SUITE" ,
98
- )
99
- . optopt (
100
- "" ,
101
- "pass" ,
102
- "force {check,build,run}-pass tests to this mode." ,
103
- "check | build | run" ,
104
- )
105
- . optopt ( "" , "run" , "whether to execute run-* tests" , "auto | always | never" )
106
- . optflag ( "" , "ignored" , "run tests marked as ignored" )
107
- . optflag ( "" , "has-enzyme" , "run tests that require enzyme" )
108
- . optflag ( "" , "with-rustc-debug-assertions" , "whether rustc was built with debug assertions" )
109
- . optflag ( "" , "with-std-debug-assertions" , "whether std was built with debug assertions" )
110
- . optmulti (
111
- "" ,
112
- "skip" ,
113
- "skip tests matching SUBSTRING. Can be passed multiple times" ,
114
- "SUBSTRING" ,
115
- )
116
- . optflag ( "" , "exact" , "filters match exactly" )
117
- . optopt (
118
- "" ,
119
- "runner" ,
120
- "supervisor program to run tests under \
93
+ )
94
+ . reqopt (
95
+ "" ,
96
+ "suite" ,
97
+ "which suite of compile tests to run. used for nicer error reporting." ,
98
+ "SUITE" ,
99
+ )
100
+ . optopt ( "" , "pass" , "force {check,build,run}-pass tests to this mode." , "check | build | run" )
101
+ . optopt ( "" , "run" , "whether to execute run-* tests" , "auto | always | never" )
102
+ . optflag ( "" , "ignored" , "run tests marked as ignored" )
103
+ . optflag ( "" , "has-enzyme" , "run tests that require enzyme" )
104
+ . optflag ( "" , "with-rustc-debug-assertions" , "whether rustc was built with debug assertions" )
105
+ . optflag ( "" , "with-std-debug-assertions" , "whether std was built with debug assertions" )
106
+ . optmulti (
107
+ "" ,
108
+ "skip" ,
109
+ "skip tests matching SUBSTRING. Can be passed multiple times" ,
110
+ "SUBSTRING" ,
111
+ )
112
+ . optflag ( "" , "exact" , "filters match exactly" )
113
+ . optopt (
114
+ "" ,
115
+ "runner" ,
116
+ "supervisor program to run tests under \
121
117
(eg. emulator, valgrind)",
122
- "PROGRAM" ,
123
- )
124
- . optmulti ( "" , "host-rustcflags" , "flags to pass to rustc for host" , "FLAGS" )
125
- . optmulti ( "" , "target-rustcflags" , "flags to pass to rustc for target" , "FLAGS" )
126
- . optflag (
127
- "" ,
128
- "rust-randomized-layout" ,
129
- "set this when rustc/stdlib were compiled with randomized layouts" ,
130
- )
131
- . optflag ( "" , "optimize-tests" , "run tests with optimizations enabled" )
132
- . optflag ( "" , "verbose" , "run tests verbosely, showing all output" )
133
- . optflag (
134
- "" ,
135
- "bless" ,
136
- "overwrite stderr/stdout files instead of complaining about a mismatch" ,
137
- )
138
- . optflag ( "" , "fail-fast" , "stop as soon as possible after any test fails" )
139
- . optflag ( "" , "quiet" , "print one character per test instead of one line" )
140
- . optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
141
- . optflag ( "" , "json" , "emit json output instead of plaintext output" )
142
- . optopt ( "" , "target" , "the target to build for" , "TARGET" )
143
- . optopt ( "" , "host" , "the host to build for" , "HOST" )
144
- . optopt ( "" , "cdb" , "path to CDB to use for CDB debuginfo tests" , "PATH" )
145
- . optopt ( "" , "gdb" , "path to GDB to use for GDB debuginfo tests" , "PATH" )
146
- . optopt ( "" , "lldb-version" , "the version of LLDB used" , "VERSION STRING" )
147
- . optopt ( "" , "llvm-version" , "the version of LLVM used" , "VERSION STRING" )
148
- . optflag ( "" , "system-llvm" , "is LLVM the system LLVM" )
149
- . optopt ( "" , "android-cross-path" , "Android NDK standalone path" , "PATH" )
150
- . optopt ( "" , "adb-path" , "path to the android debugger" , "PATH" )
151
- . optopt ( "" , "adb-test-dir" , "path to tests for the android debugger" , "PATH" )
152
- . optopt ( "" , "lldb-python-dir" , "directory containing LLDB's python module" , "PATH" )
153
- . reqopt ( "" , "cc" , "path to a C compiler" , "PATH" )
154
- . reqopt ( "" , "cxx" , "path to a C++ compiler" , "PATH" )
155
- . reqopt ( "" , "cflags" , "flags for the C compiler" , "FLAGS" )
156
- . reqopt ( "" , "cxxflags" , "flags for the CXX compiler" , "FLAGS" )
157
- . optopt ( "" , "ar" , "path to an archiver" , "PATH" )
158
- . optopt ( "" , "target-linker" , "path to a linker for the target" , "PATH" )
159
- . optopt ( "" , "host-linker" , "path to a linker for the host" , "PATH" )
160
- . reqopt ( "" , "llvm-components" , "list of LLVM components built in" , "LIST" )
161
- . optopt ( "" , "llvm-bin-dir" , "Path to LLVM's `bin` directory" , "PATH" )
162
- . optopt ( "" , "nodejs" , "the name of nodejs" , "PATH" )
163
- . optopt ( "" , "npm" , "the name of npm" , "PATH" )
164
- . optopt ( "" , "remote-test-client" , "path to the remote test client" , "PATH" )
165
- . optopt (
166
- "" ,
167
- "compare-mode" ,
168
- "mode describing what file the actual ui output will be compared to" ,
169
- "COMPARE MODE" ,
170
- )
171
- . optflag (
172
- "" ,
173
- "rustfix-coverage" ,
174
- "enable this to generate a Rustfix coverage file, which is saved in \
118
+ "PROGRAM" ,
119
+ )
120
+ . optmulti ( "" , "host-rustcflags" , "flags to pass to rustc for host" , "FLAGS" )
121
+ . optmulti ( "" , "target-rustcflags" , "flags to pass to rustc for target" , "FLAGS" )
122
+ . optflag (
123
+ "" ,
124
+ "rust-randomized-layout" ,
125
+ "set this when rustc/stdlib were compiled with randomized layouts" ,
126
+ )
127
+ . optflag ( "" , "optimize-tests" , "run tests with optimizations enabled" )
128
+ . optflag ( "" , "verbose" , "run tests verbosely, showing all output" )
129
+ . optflag ( "" , "bless" , "overwrite stderr/stdout files instead of complaining about a mismatch" )
130
+ . optflag ( "" , "fail-fast" , "stop as soon as possible after any test fails" )
131
+ . optflag ( "" , "quiet" , "print one character per test instead of one line" )
132
+ . optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
133
+ . optflag ( "" , "json" , "emit json output instead of plaintext output" )
134
+ . optopt ( "" , "target" , "the target to build for" , "TARGET" )
135
+ . optopt ( "" , "host" , "the host to build for" , "HOST" )
136
+ . optopt ( "" , "cdb" , "path to CDB to use for CDB debuginfo tests" , "PATH" )
137
+ . optopt ( "" , "gdb" , "path to GDB to use for GDB debuginfo tests" , "PATH" )
138
+ . optopt ( "" , "lldb-version" , "the version of LLDB used" , "VERSION STRING" )
139
+ . optopt ( "" , "llvm-version" , "the version of LLVM used" , "VERSION STRING" )
140
+ . optflag ( "" , "system-llvm" , "is LLVM the system LLVM" )
141
+ . optopt ( "" , "android-cross-path" , "Android NDK standalone path" , "PATH" )
142
+ . optopt ( "" , "adb-path" , "path to the android debugger" , "PATH" )
143
+ . optopt ( "" , "adb-test-dir" , "path to tests for the android debugger" , "PATH" )
144
+ . optopt ( "" , "lldb-python-dir" , "directory containing LLDB's python module" , "PATH" )
145
+ . reqopt ( "" , "cc" , "path to a C compiler" , "PATH" )
146
+ . reqopt ( "" , "cxx" , "path to a C++ compiler" , "PATH" )
147
+ . reqopt ( "" , "cflags" , "flags for the C compiler" , "FLAGS" )
148
+ . reqopt ( "" , "cxxflags" , "flags for the CXX compiler" , "FLAGS" )
149
+ . optopt ( "" , "ar" , "path to an archiver" , "PATH" )
150
+ . optopt ( "" , "target-linker" , "path to a linker for the target" , "PATH" )
151
+ . optopt ( "" , "host-linker" , "path to a linker for the host" , "PATH" )
152
+ . reqopt ( "" , "llvm-components" , "list of LLVM components built in" , "LIST" )
153
+ . optopt ( "" , "llvm-bin-dir" , "Path to LLVM's `bin` directory" , "PATH" )
154
+ . optopt ( "" , "nodejs" , "the name of nodejs" , "PATH" )
155
+ . optopt ( "" , "npm" , "the name of npm" , "PATH" )
156
+ . optopt ( "" , "remote-test-client" , "path to the remote test client" , "PATH" )
157
+ . optopt (
158
+ "" ,
159
+ "compare-mode" ,
160
+ "mode describing what file the actual ui output will be compared to" ,
161
+ "COMPARE MODE" ,
162
+ )
163
+ . optflag (
164
+ "" ,
165
+ "rustfix-coverage" ,
166
+ "enable this to generate a Rustfix coverage file, which is saved in \
175
167
`./<build_test_suite_root>/rustfix_missing_coverage.txt`",
176
- )
177
- . optflag ( "" , "force-rerun" , "rerun tests even if the inputs are unchanged" )
178
- . optflag ( "" , "only-modified" , "only run tests that result been modified" )
179
- // FIXME: Temporarily retained so we can point users to `--no-capture`
180
- . optflag ( "" , "nocapture" , "" )
181
- . optflag ( "" , "no-capture" , "don't capture stdout/stderr of tests" )
182
- . optflag ( "" , "profiler-runtime" , "is the profiler runtime enabled for this target" )
183
- . optflag ( "h" , "help" , "show this message" )
184
- . reqopt ( "" , "channel" , "current Rust channel" , "CHANNEL" )
185
- . optflag (
186
- "" ,
187
- "git-hash" ,
188
- "run tests which rely on commit version being compiled into the binaries" ,
189
- )
190
- . optopt ( "" , "edition" , "default Rust edition" , "EDITION" )
191
- . reqopt ( "" , "nightly-branch" , "name of the git branch for nightly" , "BRANCH" )
192
- . reqopt (
193
- "" ,
194
- "git-merge-commit-email" ,
195
- "email address used for finding merge commits" ,
196
- "EMAIL" ,
197
- )
198
- . optopt (
199
- "" ,
200
- "compiletest-diff-tool" ,
201
- "What custom diff tool to use for displaying compiletest tests." ,
202
- "COMMAND" ,
203
- )
204
- . reqopt ( "" , "minicore-path" , "path to minicore aux library" , "PATH" )
205
- . optflag ( "N" , "no-new-executor" , "disables the new test executor, and uses libtest instead" )
206
- . optopt (
207
- "" ,
208
- "debugger" ,
209
- "only test a specific debugger in debuginfo tests" ,
210
- "gdb | lldb | cdb" ,
211
- ) ;
168
+ )
169
+ . optflag ( "" , "force-rerun" , "rerun tests even if the inputs are unchanged" )
170
+ . optflag ( "" , "only-modified" , "only run tests that result been modified" )
171
+ // FIXME: Temporarily retained so we can point users to `--no-capture`
172
+ . optflag ( "" , "nocapture" , "" )
173
+ . optflag ( "" , "no-capture" , "don't capture stdout/stderr of tests" )
174
+ . optflag ( "" , "profiler-runtime" , "is the profiler runtime enabled for this target" )
175
+ . optflag ( "h" , "help" , "show this message" )
176
+ . reqopt ( "" , "channel" , "current Rust channel" , "CHANNEL" )
177
+ . optflag (
178
+ "" ,
179
+ "git-hash" ,
180
+ "run tests which rely on commit version being compiled into the binaries" ,
181
+ )
182
+ . optopt ( "" , "edition" , "default Rust edition" , "EDITION" )
183
+ . reqopt ( "" , "nightly-branch" , "name of the git branch for nightly" , "BRANCH" )
184
+ . reqopt ( "" , "git-merge-commit-email" , "email address used for finding merge commits" , "EMAIL" )
185
+ . optopt (
186
+ "" ,
187
+ "compiletest-diff-tool" ,
188
+ "What custom diff tool to use for displaying compiletest tests." ,
189
+ "COMMAND" ,
190
+ )
191
+ . reqopt ( "" , "minicore-path" , "path to minicore aux library" , "PATH" )
192
+ . optflag ( "N" , "no-new-executor" , "disables the new test executor, and uses libtest instead" )
193
+ . optopt (
194
+ "" ,
195
+ "debugger" ,
196
+ "only test a specific debugger in debuginfo tests" ,
197
+ "gdb | lldb | cdb" ,
198
+ ) ;
212
199
213
200
let ( argv0, args_) = args. split_first ( ) . unwrap ( ) ;
214
201
if args. len ( ) == 1 || args[ 1 ] == "-h" || args[ 1 ] == "--help" {
@@ -245,6 +232,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
245
232
}
246
233
}
247
234
235
+ let rust_version = opt_str2 ( matches. opt_str ( "rust-version" ) ) ;
248
236
let target = opt_str2 ( matches. opt_str ( "target" ) ) ;
249
237
let android_cross_path = opt_path ( matches, "android-cross-path" ) ;
250
238
let ( cdb, cdb_version) = debuggers:: analyze_cdb ( matches. opt_str ( "cdb" ) , & target) ;
@@ -333,6 +321,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
333
321
fail_fast : matches. opt_present ( "fail-fast" )
334
322
|| env:: var_os ( "RUSTC_TEST_FAIL_FAST" ) . is_some ( ) ,
335
323
324
+ rust_version,
336
325
compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
337
326
run_lib_path : make_absolute ( opt_path ( matches, "run-lib-path" ) ) ,
338
327
rustc_path : opt_path ( matches, "rustc-path" ) ,
@@ -453,6 +442,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
453
442
pub fn log_config ( config : & Config ) {
454
443
let c = config;
455
444
logv ( c, "configuration:" . to_string ( ) ) ;
445
+
446
+ logv ( c, format ! ( "rust_version: {}" , config. rust_version) ) ;
456
447
logv ( c, format ! ( "compile_lib_path: {}" , config. compile_lib_path) ) ;
457
448
logv ( c, format ! ( "run_lib_path: {}" , config. run_lib_path) ) ;
458
449
logv ( c, format ! ( "rustc_path: {}" , config. rustc_path) ) ;
0 commit comments