[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

David Spickett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 1 05:50:23 PDT 2021


DavidSpickett added a comment.

> Can you read the latest example I comment? I think you misunderstand the extra outputs I mentioned. Or if I'm wrong, can you give an inline example?

I understood but yes your example is one that a SAME cannot catch, that's true. My point was that SAME does catch some changes, it's not like it's useless.

The only drawback to a single NEXT is when it fails the output from FileCheck isn't useful until you manually compare the lines it found, since they're so long. Then again a lot of FileCheck output can be like that and using NEXT makes the test more robust so sure, let's go with NEXT.

> Yeah, I suppose this is the only one test to check this valid CPU list? Then I suppose to add check whole list for Arm targets.

Correct. (though I think downstream Arm Compiler tests this in other ways but that's beside the point)



================
Comment at: clang/test/Misc/target-invalid-cpu-note.c:1
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix ARM
 // ARM: error: unknown target CPU 'not-a-cpu'
----------------
Please add a comment as the first line explaining that why we use NEXT and check `{{$}}` ending.


================
Comment at: clang/test/Misc/target-invalid-cpu-note.c:27
 // TUNE_X86_64: error: unknown target CPU 'not-a-cpu'
-// TUNE_X86_64: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3,
-// TUNE_X86_64-SAME: i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3,
-// TUNE_X86_64-SAME: pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott,
-// TUNE_X86_64-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont,
-// TUNE_X86_64-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
-// TUNE_X86_64-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512,
-// TUNE_X86_64-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3,
-// TUNE_X86_64-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64,
-// TUNE_X86_64-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10,
-// TUNE_X86_64-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3,
-// TUNE_X86_64-SAME: x86-64, geode{{$}}
+// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geode{{$}}
 
----------------
This one uses `{{$}}` which I think (please check) means that anything extra on the end of the line will be a mistmatch. I'd add that to the rest as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110798/new/

https://reviews.llvm.org/D110798



More information about the cfe-commits mailing list