Move the extra directives for Mode::CoverageRun into iter_header · rust-lang/rust@c521d7f (original) (raw)

`@@ -672,17 +672,6 @@ pub fn line_directive<'line>(

`

672

672

`}

`

673

673

`}

`

674

674

``

675

``

`-

fn iter_header<R: Read>(

`

676

``

`-

mode: Mode,

`

677

``

`-

suite: &str,

`

678

``

`-

poisoned: &mut bool,

`

679

``

`-

testfile: &Path,

`

680

``

`-

rdr: R,

`

681

``

`-

it: &mut dyn FnMut(HeaderLine<'_>),

`

682

``

`-

) {

`

683

``

`-

iter_header_extra(mode, suite, poisoned, testfile, rdr, &[], it)

`

684

``

`-

}

`

685

``

-

686

675

`/// This is generated by collecting directives from ui tests and then extracting their directive

`

687

676

`/// names. This is not an exhaustive list of all possible directives. Instead, this is a

`

688

677

`/// best-effort approximation for diagnostics.

`

`@@ -813,23 +802,37 @@ struct HeaderLine<'ln> {

`

813

802

`line_number: usize,

`

814

803

`}

`

815

804

``

816

``

`-

fn iter_header_extra(

`

``

805

`+

fn iter_header(

`

817

806

`mode: Mode,

`

818

807

`suite: &str,

`

819

808

`poisoned: &mut bool,

`

820

809

`testfile: &Path,

`

821

810

`rdr: impl Read,

`

822

``

`-

extra_directives: &[&str],

`

823

811

`it: &mut dyn FnMut(HeaderLine<'_>),

`

824

812

`) {

`

825

813

`if testfile.is_dir() {

`

826

814

`return;

`

827

815

`}

`

828

816

``

829

``

`-

// Process any extra directives supplied by the caller (e.g. because they

`

830

``

`-

// are implied by the test mode), with a dummy line number of 0.

`

831

``

`-

for directive in extra_directives {

`

832

``

`-

it(HeaderLine { header_revision: None, original_line: "", directive, line_number: 0 });

`

``

817

`+

// Coverage tests in coverage-run mode always have these extra directives,

`

``

818

`+

// without needing to specify them manually in every test file.

`

``

819

`+

// (Some of the comments below have been copied over from the old

`

``

820

`` +

// tests/run-make/coverage-reports/Makefile, which no longer exists.)

``

``

821

`+

if mode == Mode::CoverageRun {

`

``

822

`+

let extra_directives: &[&str] = &[

`

``

823

`+

"needs-profiler-support",

`

``

824

`+

// FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works

`

``

825

`+

// properly. Since we only have GCC on the CI ignore the test for now.

`

``

826

`+

"ignore-windows-gnu",

`

``

827

`+

// FIXME(pietroalbini): this test currently does not work on cross-compiled

`

``

828

`+

// targets because remote-test is not capable of sending back the *.profraw

`

``

829

`+

// files generated by the LLVM instrumentation.

`

``

830

`+

"ignore-cross-compile",

`

``

831

`+

];

`

``

832

`+

// Process the extra implied directives, with a dummy line number of 0.

`

``

833

`+

for directive in extra_directives {

`

``

834

`+

it(HeaderLine { header_revision: None, original_line: "", directive, line_number: 0 });

`

``

835

`+

}

`

833

836

`}

`

834

837

``

835

838

`let comment = if testfile.extension().is_some_and(|e| e == "rs") {

`

`@@ -1162,35 +1165,14 @@ pub fn make_test_description<R: Read>(

`

1162

1165

`let mut ignore_message = None;

`

1163

1166

`let mut should_fail = false;

`

1164

1167

``

1165

``

`-

let extra_directives: &[&str] = match config.mode {

`

1166

``

`-

// The coverage-run tests are treated as having these extra directives,

`

1167

``

`-

// without needing to specify them manually in every test file.

`

1168

``

`-

// (Some of the comments below have been copied over from

`

1169

``

`` -

// tests/run-make/coverage-reports/Makefile, which no longer exists.)

``

1170

``

`-

Mode::CoverageRun => {

`

1171

``

`-

&[

`

1172

``

`-

"needs-profiler-support",

`

1173

``

`-

// FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works

`

1174

``

`-

// properly. Since we only have GCC on the CI ignore the test for now.

`

1175

``

`-

"ignore-windows-gnu",

`

1176

``

`-

// FIXME(pietroalbini): this test currently does not work on cross-compiled

`

1177

``

`-

// targets because remote-test is not capable of sending back the *.profraw

`

1178

``

`-

// files generated by the LLVM instrumentation.

`

1179

``

`-

"ignore-cross-compile",

`

1180

``

`-

]

`

1181

``

`-

}

`

1182

``

`-

_ => &[],

`

1183

``

`-

};

`

1184

``

-

1185

1168

`let mut local_poisoned = false;

`

1186

1169

``

1187

``

`-

iter_header_extra(

`

``

1170

`+

iter_header(

`

1188

1171

` config.mode,

`

1189

1172

`&config.suite,

`

1190

1173

`&mut local_poisoned,

`

1191

1174

` path,

`

1192

1175

` src,

`

1193

``

`-

extra_directives,

`

1194

1176

`&mut |HeaderLine { header_revision, original_line, directive: ln, line_number }| {

`

1195

1177

`if header_revision.is_some() && header_revision != cfg {

`

1196

1178

`return;

`