Blame tests/coccinelle.sh
|
rpm-build |
0fba15 |
#!/usr/bin/env bash
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
# Run the .cocci files in the tests directory; these act
|
|
rpm-build |
0fba15 |
# as a blacklist.
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
set -euo pipefail
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
. $(dirname $0)/libtest.sh
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if ! spatch --version 2>/dev/null; then
|
|
rpm-build |
0fba15 |
skip "no spatch; get it from http://coccinelle.lip6.fr/"
|
|
rpm-build |
0fba15 |
fi
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
if test -z "${OSTREE_UNINSTALLED_SRCDIR:-}"; then
|
|
rpm-build |
0fba15 |
skip "running installed?"
|
|
rpm-build |
0fba15 |
fi
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
coccitests=$(ls $(dirname $0)/coccinelle/*.cocci)
|
|
rpm-build |
0fba15 |
echo "1.."$(echo ${coccitests} | wc -l)
|
|
rpm-build |
0fba15 |
|
|
rpm-build |
0fba15 |
for cocci in $(dirname $0)/coccinelle/*.cocci; do
|
|
rpm-build |
0fba15 |
echo "Running: ${cocci}"
|
|
rpm-build |
0fba15 |
spatch --very-quiet --dir ${OSTREE_UNINSTALLED_SRCDIR} ${cocci} > cocci.out
|
|
rpm-build |
0fba15 |
if test -s cocci.out; then
|
|
rpm-build |
0fba15 |
sed -e 's/^/# /' < cocci.out >&2
|
|
rpm-build |
0fba15 |
fatal "Failed semantic patch: ${cocci}"
|
|
rpm-build |
0fba15 |
fi
|
|
rpm-build |
0fba15 |
echo ok ${cocci}
|
|
rpm-build |
0fba15 |
done
|