Skip to content

Commit cf4bc34

Browse files
author
Alexander Regueiro
committed
tools: comments
1 parent bc52e15 commit cf4bc34

File tree

9 files changed

+149
-144
lines changed

9 files changed

+149
-144
lines changed

src/tools/compiletest/src/common.rs

+31-31
Original file line numberDiff line numberDiff line change
@@ -145,101 +145,101 @@ pub struct Config {
145145
pub force_valgrind: bool,
146146

147147
/// The path to the Clang executable to run Clang-based tests with. If
148-
/// `None` then these tests will be ignored.
148+
/// `None`, then these tests will be ignored.
149149
pub run_clang_based_tests_with: Option<String>,
150150

151-
/// The directory containing the tests to run
151+
/// The directory containing the tests to run.
152152
pub src_base: PathBuf,
153153

154-
/// The directory where programs should be built
154+
/// The directory where programs should be built.
155155
pub build_base: PathBuf,
156156

157-
/// The name of the stage being built (stage1, etc)
157+
/// The name of the stage being built (stage1, etc.)
158158
pub stage_id: String,
159159

160-
/// The test mode, compile-fail, run-fail, run-pass
160+
/// The test mode, compile-fail, run-fail, run-pass.
161161
pub mode: Mode,
162162

163-
/// Run ignored tests
163+
/// Run ignored tests.
164164
pub run_ignored: bool,
165165

166-
/// Only run tests that match this filter
166+
/// Only run tests that match this filter.
167167
pub filter: Option<String>,
168168

169-
/// Exactly match the filter, rather than a substring
169+
/// Exactly match the filter, rather than a substring.
170170
pub filter_exact: bool,
171171

172-
/// Write out a parseable log of tests that were run
172+
/// Write out a parseable log of tests that were run.
173173
pub logfile: Option<PathBuf>,
174174

175175
/// A command line to prefix program execution with,
176-
/// for running under valgrind
176+
/// for running under valgrind.
177177
pub runtool: Option<String>,
178178

179179
/// Flags to pass to the compiler when building for the host
180180
pub host_rustcflags: Option<String>,
181181

182-
/// Flags to pass to the compiler when building for the target
182+
/// Flags to pass to the compiler when building for the target.
183183
pub target_rustcflags: Option<String>,
184184

185-
/// Target system to be tested
185+
/// Target system to be tested.
186186
pub target: String,
187187

188-
/// Host triple for the compiler being invoked
188+
/// Host triple for the compiler being invoked.
189189
pub host: String,
190190

191-
/// Path to / name of the GDB executable
191+
/// Path to / name of the GDB executable.
192192
pub gdb: Option<String>,
193193

194-
/// Version of GDB, encoded as ((major * 1000) + minor) * 1000 + patch
194+
/// Version of GDB, encoded as `((major * 1000) + minor) * 1000 + patch`.
195195
pub gdb_version: Option<u32>,
196196

197-
/// Whether GDB has native rust support
197+
/// Whether GDB has native rust support.
198198
pub gdb_native_rust: bool,
199199

200-
/// Version of LLDB
200+
/// Version of LLDB.
201201
pub lldb_version: Option<String>,
202202

203-
/// Whether LLDB has native rust support
203+
/// `true` if LLDB has native rust support.
204204
pub lldb_native_rust: bool,
205205

206-
/// Version of LLVM
206+
/// Version of LLVM.
207207
pub llvm_version: Option<String>,
208208

209-
/// Is LLVM a system LLVM
209+
/// `true` if LLVM is system LLVM.
210210
pub system_llvm: bool,
211211

212-
/// Path to the android tools
212+
/// Path to the Android tools.
213213
pub android_cross_path: PathBuf,
214214

215-
/// Extra parameter to run adb on arm-linux-androideabi
215+
/// Extra parameter to run adb on arm-linux-androideabi.
216216
pub adb_path: String,
217217

218-
/// Extra parameter to run test suite on arm-linux-androideabi
218+
/// Extra parameter to run test suite on arm-linux-androideabi.
219219
pub adb_test_dir: String,
220220

221-
/// status whether android device available or not
221+
/// Status whether android device available or not.
222222
pub adb_device_status: bool,
223223

224-
/// the path containing LLDB's Python module
224+
/// Path containing LLDB's Python module.
225225
pub lldb_python_dir: Option<String>,
226226

227-
/// Explain what's going on
227+
/// `true` to enable verbose output.
228228
pub verbose: bool,
229229

230-
/// Print one character per test instead of one line
230+
/// Print one character per test instead of one line.
231231
pub quiet: bool,
232232

233-
/// Whether to use colors in test.
233+
/// `true` to use colors in test.
234234
pub color: ColorConfig,
235235

236-
/// where to find the remote test client process, if we're using it
236+
/// Where to find the remote test client process, if we're using it.
237237
pub remote_test_client: Option<PathBuf>,
238238

239-
/// mode describing what file the actual ui output will be compared to
239+
/// Mode describing what file the actual ui output will be compared to.
240240
pub compare_mode: Option<CompareMode>,
241241

242-
// Configuration for various run-make tests frobbing things like C compilers
242+
// Configuration for various run-make tests-frobbing things like C compilers,
243243
// or querying about various LLVM component information.
244244
pub cc: String,
245245
pub cxx: String,

src/tools/compiletest/src/header.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub struct TestProps {
304304
pub dont_check_compiler_stderr: bool,
305305
// Don't force a --crate-type=dylib flag on the command line
306306
pub no_prefer_dynamic: bool,
307-
// Run --pretty expanded when running pretty printing tests
307+
// Run --pretty expanded when running pretty-printing tests
308308
pub pretty_expanded: bool,
309309
// Which pretty mode are we testing with, default to 'normal'
310310
pub pretty_mode: String,
@@ -314,7 +314,7 @@ pub struct TestProps {
314314
pub forbid_output: Vec<String>,
315315
// Revisions to test for incremental compilation.
316316
pub revisions: Vec<String>,
317-
// Directory (if any) to use for incremental compilation. This is
317+
// Directory (if any) to use for incremental compilation. This is
318318
// not set by end-users; rather it is set by the incremental
319319
// testing harness and used when generating compilation
320320
// arguments. (In particular, it propagates to the aux-builds.)
@@ -678,7 +678,7 @@ impl Config {
678678

679679
fn parse_env(&self, line: &str, name: &str) -> Option<(String, String)> {
680680
self.parse_name_value_directive(line, name).map(|nv| {
681-
// nv is either FOO or FOO=BAR
681+
// `nv` is either `"FOO"` or `"FOO=BAR"`.
682682
let mut strs: Vec<String> = nv.splitn(2, '=').map(str::to_owned).collect();
683683

684684
match strs.len() {
@@ -867,7 +867,7 @@ fn expand_variables(mut value: String, config: &Config) -> String {
867867
/// assert_eq!(s, " -> \"something ($WORD bits)\".");
868868
/// ```
869869
fn parse_normalization_string(line: &mut &str) -> Option<String> {
870-
// FIXME support escapes in strings.
870+
// FIXME: support escapes in strings.
871871
let begin = line.find('"')? + 1;
872872
let end = line[begin..].find('"')? + begin;
873873
let result = line[begin..end].to_owned();

src/tools/compiletest/src/json.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec<Er
9393

9494
fn parse_line(file_name: &str, line: &str, output: &str, proc_res: &ProcRes) -> Vec<Error> {
9595
// The compiler sometimes intermingles non-JSON stuff into the
96-
// output. This hack just skips over such lines. Yuck.
96+
// output. This hack just skips over such lines. Yuck.
9797
if line.starts_with('{') {
9898
match serde_json::from_str::<Diagnostic>(line) {
9999
Ok(diagnostic) => {
@@ -147,7 +147,7 @@ fn push_expected_errors(
147147
};
148148

149149
// We break the output into multiple lines, and then append the
150-
// [E123] to every line in the output. This may be overkill. The
150+
// [E123] to every line in the output. This may be overkill. The
151151
// intention was to match existing tests that do things like "//|
152152
// found `i32` [E123]" and expect to match that somewhere, and yet
153153
// also ensure that `//~ ERROR E123` *always* works. The
@@ -156,7 +156,7 @@ fn push_expected_errors(
156156
let with_code = |span: &DiagnosticSpan, text: &str| {
157157
match diagnostic.code {
158158
Some(ref code) =>
159-
// FIXME(#33000) -- it'd be better to use a dedicated
159+
// FIXME(#33000): it'd be better to use a dedicated
160160
// UI harness than to include the line/col number like
161161
// this, but some current tests rely on it.
162162
//
@@ -169,7 +169,7 @@ fn push_expected_errors(
169169
span.line_end, span.column_end,
170170
text, code.code.clone()),
171171
None =>
172-
// FIXME(#33000) -- it'd be better to use a dedicated UI harness
172+
// FIXME(#33000): it'd be better to use a dedicated UI harness.
173173
format!("{}:{}: {}:{}: {}",
174174
span.line_start, span.column_start,
175175
span.line_end, span.column_end,

src/tools/compiletest/src/main.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ pub fn run_tests(config: &Config) {
470470
_ => { /* proceed */ }
471471
}
472472

473-
// FIXME(#33435) Avoid spurious failures in codegen-units/partitioning tests.
473+
// FIXME(#33435): avoid spurious failures in codegen-units/partitioning tests.
474474
if let Mode::CodegenUnits = config.mode {
475475
let _ = fs::remove_dir_all("tmp/partitioning-tests");
476476
}
477477

478478
let opts = test_opts(config);
479479
let tests = make_tests(config);
480-
// sadly osx needs some file descriptor limits raised for running tests in
480+
// sadly macOS needs some file descriptor limits raised for running tests in
481481
// parallel (especially when we have lots and lots of child processes).
482482
// For context, see #8904
483483
unsafe {
@@ -619,7 +619,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> Vec<test::TestDescAn
619619
};
620620

621621
// The `should-fail` annotation doesn't apply to pretty tests,
622-
// since we run the pretty printer across all tests by default.
622+
// since we run the pretty-printer across all tests by default.
623623
// If desired, we could add a `should-fail-pretty` annotation.
624624
let should_panic = match config.mode {
625625
Pretty => test::ShouldPanic::No,
@@ -640,7 +640,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> Vec<test::TestDescAn
640640
revisions
641641
.into_iter()
642642
.map(|revision| {
643-
// Debugging emscripten code doesn't make sense today
643+
// Debugging Emscripten code doesn't make sense today.
644644
let ignore = early_props.ignore == Ignore::Ignore
645645
|| !up_to_date(
646646
config,
@@ -702,7 +702,7 @@ fn up_to_date(
702702
Stamp::from_path(&testpaths.file.parent().unwrap().join("auxiliary").join(aux))
703703
}),
704704
);
705-
// Relevant pretty printer files
705+
// Relevant pretty-printer files.
706706
let pretty_printer_files = [
707707
"src/etc/debugger_pretty_printers_common.py",
708708
"src/etc/gdb_load_rust_pretty_printers.py",
@@ -949,7 +949,7 @@ fn extract_lldb_version(full_version_line: Option<String>) -> (Option<String>, b
949949
// There doesn't seem to be a way to correlate the Apple version
950950
// with the upstream version, and since the tests were originally
951951
// written against Apple versions, we make a fake Apple version by
952-
// multiplying the first number by 100. This is a hack, but
952+
// multiplying the first number by 100. This is a hack, but
953953
// normally fine because the only non-Apple version we test is
954954
// rust-enabled.
955955

src/tools/compiletest/src/read2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// FIXME: This is a complete copy of `cargo/src/cargo/util/read2.rs`
2-
// Consider unify the read2() in libstd, cargo and this to prevent further code duplication.
1+
// FIXME: this is a complete copy of `cargo/src/cargo/util/read2.rs`
2+
// Consider unifying the `read2()` in libstd, cargo and this to prevent further code duplication.
33

44
pub use self::imp::read2;
55

@@ -56,7 +56,7 @@ mod imp {
5656
let mut errfd = 1;
5757

5858
while nfds > 0 {
59-
// wait for either pipe to become readable using `select`
59+
// Wait for either pipe to become readable using `select`.
6060
let r = unsafe { libc::poll(fds.as_mut_ptr(), nfds, -1) };
6161
if r == -1 {
6262
let err = io::Error::last_os_error();

0 commit comments

Comments
 (0)