[PATCH] D23533: [clang-tidy] Rewrite compilation database test to not require shell

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 07:25:04 PDT 2016


alexfh added inline comments.

================
Comment at: test/clang-tidy/clang-tidy-run-with-database.cpp:11
@@ -10,3 @@
-// RUN: echo '#include "header.h"' > %T/compilation-database-test/b/d.cpp
-// RUN: sed 's|test_dir|%T/compilation-database-test|g' %S/Inputs/compilation-database/template.json > %T/compile_commands.json
-// RUN: clang-tidy --checks=-*,modernize-use-nullptr -p %T %T/compilation-database-test/b/not-exist -header-filter=.*
----------------
This sed call substitutes placeholders with absolute paths, which is an important part of this test. So we can't get rid of the sed call. Furthermore, the test verifies that clang-tidy doesn't crash when applying fixes (which it used to, IIRC), so I'm not sure this change doesn't make the test less informative.

If you need to test correct handling of GCC-style command lines in JSON compilation databases on Windows, we can add another test, but this one should stay as it is.

================
Comment at: test/clang-tidy/clang-tidy-run-with-database.cpp:36
@@ +35,1 @@
+// CHECK-YAML:     ReplacementText: nullptr
\ No newline at end of file

----------------
Please fix "No newline at end of file".


https://reviews.llvm.org/D23533





More information about the cfe-commits mailing list