[PATCH] D55683: [analyzer] Tests for scan-build?

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 15:53:23 PST 2018


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, george.karpenkov, szepet, rnkovacs, Szelethus.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, baloghadamsoftware.

Add a trivial testing infrastructure that could allow writing regression tests for the `scan-build` tool in case we ever try to improve it.

It's a "before i forget" kind of thing - i played with it a little bit but didn't go far, but then @aaron.ballman pointed out that he could have made some tests for D55665 <https://reviews.llvm.org/D55665> if the infrastructure was in place.

An obvious next step is to figure out how to test `scan-build` output, which is annoying because it auto-creates a non-deterministic sub-directory and then produces random file names. I guess we could do wildcards, but we could also make a deterministic output mode; we already have a mode for deterministic file names, so only the date in the directory name is a problem.

Another nice thing to try here is to make `lit` automatically run the same tests for `scan-build-py` as well. I expect the `%scan_build` substitution to allow such tricks, similarly to how we run all Analyzer tests under the Z3 solver if it's enabled.


Repository:
  rC Clang

https://reviews.llvm.org/D55683

Files:
  test/Analysis/scan-build/lit.local.cfg
  test/Analysis/scan-build/simple-test.test


Index: test/Analysis/scan-build/simple-test.test
===================================================================
--- /dev/null
+++ test/Analysis/scan-build/simple-test.test
@@ -0,0 +1,2 @@
+// RUN: %scan_build --help 2>&1 | FileCheck %s
+// CHECK: USAGE: scan-build
Index: test/Analysis/scan-build/lit.local.cfg
===================================================================
--- /dev/null
+++ test/Analysis/scan-build/lit.local.cfg
@@ -0,0 +1,7 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+
+import lit.util
+
+config.substitutions.append(('%scan_build',
+                             lit.util.which('scan-build',
+                                            config.environment['PATH'])))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55683.178154.patch
Type: text/x-patch
Size: 721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181213/a2e9c9af/attachment.bin>


More information about the cfe-commits mailing list