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 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 ./ --clean --verbose --test-cocci 11-dev-pm-ops.cocci \
        /home/mcgrof/linux-next/ \

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 <>
Cc: Julia Lawall <>
Cc: Gilles Muller <>
Signed-off-by: Luis R. Rodriguez <>
2 files changed