From 5c10185aeedd45af551ec3e49304f9e94226c21a Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Tue, 15 May 2018 19:15:43 -0700 Subject: [PATCH 1/3] tidy: Add a check for empty UI test files Check for empty `.stderr` and `.stdout` files in UI test directories. Empty files could still pass testing for `compile-pass` tests with no output so they can get into the repo accidentally, but they are not necessary and can be removed. --- src/tools/tidy/src/ui_tests.rs | 63 +++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 351005ff4b816..c15744078077e 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -10,32 +10,49 @@ //! Tidy check to ensure that there are no stray `.stderr` files in UI test directories. +use std::fs; use std::path::Path; pub fn check(path: &Path, bad: &mut bool) { - super::walk_many(&[&path.join("test/ui"), &path.join("test/ui-fulldeps")], - &mut |_| false, - &mut |file_path| { - if let Some(ext) = file_path.extension() { - if ext == "stderr" || ext == "stdout" { - // Test output filenames have the format: - // $testname.stderr - // $testname.$mode.stderr - // $testname.$revision.stderr - // $testname.$revision.$mode.stderr - // - // For now, just make sure that there is a corresponding - // $testname.rs file. - let testname = file_path.file_name().unwrap() - .to_str().unwrap() - .splitn(2, '.').next().unwrap(); - if !file_path.with_file_name(testname) - .with_extension("rs") - .exists() { - println!("Stray file with UI testing output: {:?}", file_path); - *bad = true; + super::walk_many( + &[&path.join("test/ui"), &path.join("test/ui-fulldeps")], + &mut |_| false, + &mut |file_path| { + if let Some(ext) = file_path.extension() { + if ext == "stderr" || ext == "stdout" { + // Test output filenames have the format: + // $testname.stderr + // $testname.$mode.stderr + // $testname.$revision.stderr + // $testname.$revision.$mode.stderr + // + // For now, just make sure that there is a corresponding + // $testname.rs file. + let testname = file_path + .file_name() + .unwrap() + .to_str() + .unwrap() + .splitn(2, '.') + .next() + .unwrap(); + if !file_path + .with_file_name(testname) + .with_extension("rs") + .exists() + { + println!("Stray file with UI testing output: {:?}", file_path); + *bad = true; + } + + if let Ok(metadata) = fs::metadata(file_path) { + if metadata.len() == 0 { + println!("Empty file with UI testing output: {:?}", file_path); + *bad = true; + } + } } } - } - }); + }, + ); } From 16adb0c725d6964cca097fa5c9250145acda1aca Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Tue, 15 May 2018 19:53:43 -0700 Subject: [PATCH 2/3] Remove empty files --- src/test/ui/compare-method/proj-outlives-region.stdout | 0 src/test/ui/compare-method/region-extra.stdout | 0 src/test/ui/compare-method/region-unrelated.stdout | 0 src/test/ui/const-eval/const_transmute.stderr | 0 src/test/ui/const-expr-addr-operator.stderr | 0 src/test/ui/const-pattern-not-const-evaluable.stderr | 0 src/test/ui/feature-gate-const-indexing.stderr | 0 src/test/ui/issue-38875/issue_38875.stderr | 0 src/test/ui/nll/drop-may-dangle.stderr | 0 src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr | 0 src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr | 0 src/test/ui/print_type_sizes/anonymous.stderr | 0 src/test/ui/print_type_sizes/anonymous.stdout | 0 src/test/ui/print_type_sizes/multiple_types.stderr | 0 src/test/ui/print_type_sizes/packed.stderr | 0 src/test/ui/print_type_sizes/repr-align.stderr | 0 src/test/ui/reachable/expr_andand.stderr | 0 src/test/ui/reachable/expr_oror.stderr | 0 .../generic-associated-types-where.stderr | 0 src/test/ui/rfc1598-generic-associated-types/shadowing.stdout | 0 src/test/ui/union/union-const-eval.stderr | 0 21 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/test/ui/compare-method/proj-outlives-region.stdout delete mode 100644 src/test/ui/compare-method/region-extra.stdout delete mode 100644 src/test/ui/compare-method/region-unrelated.stdout delete mode 100644 src/test/ui/const-eval/const_transmute.stderr delete mode 100644 src/test/ui/const-expr-addr-operator.stderr delete mode 100644 src/test/ui/const-pattern-not-const-evaluable.stderr delete mode 100644 src/test/ui/feature-gate-const-indexing.stderr delete mode 100644 src/test/ui/issue-38875/issue_38875.stderr delete mode 100644 src/test/ui/nll/drop-may-dangle.stderr delete mode 100644 src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr delete mode 100644 src/test/ui/print_type_sizes/anonymous.stderr delete mode 100644 src/test/ui/print_type_sizes/anonymous.stdout delete mode 100644 src/test/ui/print_type_sizes/multiple_types.stderr delete mode 100644 src/test/ui/print_type_sizes/packed.stderr delete mode 100644 src/test/ui/print_type_sizes/repr-align.stderr delete mode 100644 src/test/ui/reachable/expr_andand.stderr delete mode 100644 src/test/ui/reachable/expr_oror.stderr delete mode 100644 src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr delete mode 100644 src/test/ui/rfc1598-generic-associated-types/shadowing.stdout delete mode 100644 src/test/ui/union/union-const-eval.stderr diff --git a/src/test/ui/compare-method/proj-outlives-region.stdout b/src/test/ui/compare-method/proj-outlives-region.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/compare-method/region-extra.stdout b/src/test/ui/compare-method/region-extra.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/compare-method/region-unrelated.stdout b/src/test/ui/compare-method/region-unrelated.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/const-eval/const_transmute.stderr b/src/test/ui/const-eval/const_transmute.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/const-expr-addr-operator.stderr b/src/test/ui/const-expr-addr-operator.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/const-pattern-not-const-evaluable.stderr b/src/test/ui/const-pattern-not-const-evaluable.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/feature-gate-const-indexing.stderr b/src/test/ui/feature-gate-const-indexing.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/issue-38875/issue_38875.stderr b/src/test/ui/issue-38875/issue_38875.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/nll/drop-may-dangle.stderr b/src/test/ui/nll/drop-may-dangle.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr b/src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/print_type_sizes/anonymous.stderr b/src/test/ui/print_type_sizes/anonymous.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/print_type_sizes/anonymous.stdout b/src/test/ui/print_type_sizes/anonymous.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/print_type_sizes/multiple_types.stderr b/src/test/ui/print_type_sizes/multiple_types.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/print_type_sizes/packed.stderr b/src/test/ui/print_type_sizes/packed.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/print_type_sizes/repr-align.stderr b/src/test/ui/print_type_sizes/repr-align.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/reachable/expr_andand.stderr b/src/test/ui/reachable/expr_andand.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/reachable/expr_oror.stderr b/src/test/ui/reachable/expr_oror.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.stdout b/src/test/ui/rfc1598-generic-associated-types/shadowing.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/ui/union/union-const-eval.stderr b/src/test/ui/union/union-const-eval.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 6ed200aaeabb7ab2e12c6fd2a52627bd3f457a95 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Wed, 16 May 2018 10:21:15 -0700 Subject: [PATCH 3/3] Remove empty file introduced by rebase --- .../ui/trivial-bounds-inconsistent-associated-functions.stderr | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/test/ui/trivial-bounds-inconsistent-associated-functions.stderr diff --git a/src/test/ui/trivial-bounds-inconsistent-associated-functions.stderr b/src/test/ui/trivial-bounds-inconsistent-associated-functions.stderr deleted file mode 100644 index e69de29bb2d1d..0000000000000