summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-02 10:18:10 +0000
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 18:16:21 -0700
commit7330a6c8f83b6340041d7dcbebfaa51977d5495f (patch)
tree1f3de54390111fc699acffe1580d28c748960436 /lib
parent3d7489a0ac33f7c5c2b4173cc2accf989b1b1c5e (diff)
backports: add support for testing only a single Coccinelle SmPL patch
You can just pass now one cocci file with the --test-cocci to test only that single Coccinelle SmPL patch. If you are not sure what an SmPL patch produces and you only want to study the results of applying only a single SmPL patch you can use this flag to trigger enabling git on the target directory, a commit will be done before applying the SmPL patch and then another commit will be performed after the SmPL patch is applied. You can then use git show as you'd expect to inspect the results. Note that if you don't use --test-cocci and run gentree.py regularly you can always still use --git-debug to see atomically what is happening after each patch, including Coccinelle patches. This modifies the coccinelle library to use 10 * num_cpus threads for when in testing Coccinelle mode. $ time ./gentree.py --clean --verbose --test-cocci 11-dev-pm-ops.cocci \ /home/mcgrof/linux-next/ \ /home/mcgrof/build/next-20140311 real 0m28.964s user 6m57.848s sys 0m25.124s Note that you can pass either a full path or the file name alone of the target Coccinelle SmPL patch you want to test. Cc: Peter Senna <peter.senna@gmail.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Gilles Muller <Gilles.Muller@lip6.fr> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/bpcoccinelle.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bpcoccinelle.py b/lib/bpcoccinelle.py
index d9a3cc80..77e9d6d7 100644
--- a/lib/bpcoccinelle.py
+++ b/lib/bpcoccinelle.py
@@ -52,9 +52,11 @@ def spatch(cocci_file, outdir,
outfile.close()
ret_q.put((sprocess.returncode, fn))
-def threaded_spatch(cocci_file, outdir, logwrite, print_name):
+def threaded_spatch(cocci_file, outdir, logwrite, print_name, test_cocci):
num_cpus = cpu_count()
threads = num_cpus * 3
+ if test_cocci:
+ threads = num_cpus * 10
jobs = list()
output = ''
ret_q = Queue()