/usr/bin/undertaker-linux-tree is in undertaker 1.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #!/bin/bash -e
# This script is indented to run the undertaker on a whole linux
# tree. It will determine which files to be processed and how many
# threads can be started according to the count of processors your
# machine has. It assumes, that you have run undertaker-kconfigdump
# before, in order to create the models.
#
while getopts :t:m:a:cvh OPT; do
case $OPT in
m)
MODELS="$OPTARG"
;;
a)
DEFAULT_ARCH="$OPTARG"
;;
t)
PROCESSORS="$OPTARG"
;;
c)
COVERAGE=t
;;
v)
echo "undertaker-linux-tree"
exit
;;
h)
echo "\`undertaker-linux-tree' runs the undertaker a whole linux-tree"
echo
echo "Usage: ${0##*/} [-m DIR] [-a ARCH] [-t PROCS] [-c]"
echo " -m <modeldir> Specify the directory for the models"
echo " (default: models)"
echo " -a <arch> Default architecture to check for"
echo " (default: x86)"
echo " -t <count> Number of analyzing processes"
echo " (default: _NPROCESSORS_ONLN)"
echo " -c Do coverage analysis instead of dead block search"
exit
;;
esac
done
shift $(( OPTIND - 1 ))
OPTIND=1
MODELS=${MODELS:-models}
DEFAULT_ARCH=${DEFAULT_ARCH:-x86}
PROCESSORS=${PROCESSORS:-$(getconf _NPROCESSORS_ONLN)}
if [ ! -f arch/x86/Kconfig ]; then
echo "Not run in an linux tree. Please run inside an linux tree without arguments"
exit 1
else
echo "Running on Linux Version $(git describe || echo '(no git)')"
fi
if ! which undertaker > /dev/null; then
echo "No undertaker binary found."
exit 1
fi
if ! ls "$MODELS"/*.model >/dev/null 2>&1; then
echo "No models found, please call undertaker-kconfigdump"
exit
fi
find . -name "*.[hcS]" | shuf > undertaker-worklist
find . -name '*dead' -exec rm -f {} +
if [ -n "$COVERAGE" ]; then
echo "Running coverage analysis"
time undertaker -j coverage -C min -t "$PROCESSORS" -b undertaker-worklist \
-m "$MODELS" -M "$DEFAULT_ARCH" 2>/dev/null | \
grep '^I: ./' > coverage.txt
if [ ! -s coverage.txt ]; then
echo "Coverage analysis failed!"
exit 1
fi
echo "TOP 50 variable files (format: #possible solutions, filename)"
awk '/^I: / {print $2}' < coverage.txt | \
awk -F, '{ printf "%s %s\n", $3, $1 }' | \
sort -n -r | \
head -n 50 | tee coverage.stats
awk '/c$/ { print $2}' coverage.stats > coverage-worklist
time undertaker-calc-coverage -m models/x86.model -d coverage-worklist 2>/dev/null >coverage.log
else
echo "Analyzing $(wc -l < undertaker-worklist) files with $PROCESSORS threads."
time undertaker -t "$PROCESSORS" -b undertaker-worklist -m "$MODELS" -M "$DEFAULT_ARCH"
printf "\n\nFound %s global defects\n" "$(find . -name '*dead'| grep globally | wc -l)"
fi
|