[clang-tools-extra] 9c8b0d4 - Use FileCheck in new clang-tidy/infrastructure/config-files.cpp tests

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 06:10:27 PDT 2024


Author: Hans Wennborg
Date: 2024-05-03T15:09:58+02:00
New Revision: 9c8b0d4ef6308ca0a74151c14c01f972e8db8cda

URL: https://github.com/llvm/llvm-project/commit/9c8b0d4ef6308ca0a74151c14c01f972e8db8cda
DIFF: https://github.com/llvm/llvm-project/commit/9c8b0d4ef6308ca0a74151c14c01f972e8db8cda.diff

LOG: Use FileCheck in new clang-tidy/infrastructure/config-files.cpp tests

The test was failing spuriously on some machines [1]. Converting from
grep to FileCheck makes it easier to see what's happening, and also grep
is discouraged in tests [2].

Also drop the negative test: checking for the expected output is better.

 1. https://crbug.com/338535754
 2. https://llvm.org/docs/TestingGuide.html#:~:text=.%20%5BThe-,usage%20of%20grep,-in%20RUN%20lines

Added: 
    

Modified: 
    clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp
index cb0f0bc4d13308..d287412454cadd 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp
@@ -66,9 +66,5 @@
 // RUN: clang-tidy --checks="-*,readability-identifier-naming" --dump-config %S/Inputs/config-files/- -- | grep "readability-identifier-naming\." | sort --check
 
 // Dumped config does not overflow for unsigned options
-// RUN: clang-tidy --dump-config \
-// RUN: --checks="-*,misc-throw-by-value-catch-by-reference" \
-// RUN: -- | grep -v -q "misc-throw-by-value-catch-by-reference.MaxSize: '-1'"
-
-// RUN: clang-tidy --dump-config %S/Inputs/config-files/5/- \
-// RUN: -- | grep -q "misc-throw-by-value-catch-by-reference.MaxSize: '1152921504606846976'"
+// RUN: clang-tidy --dump-config %S/Inputs/config-files/5/- -- | FileCheck %s -check-prefix=CHECK-OVERFLOW
+// CHECK-OVERFLOW: misc-throw-by-value-catch-by-reference.MaxSize: '1152921504606846976'


        


More information about the cfe-commits mailing list