Confessions of a Wall Street Programmer

practical ideas (and perhaps some uncommon knowledge) on software architecture, design, construction and testing

run_pvs.sh

This script can be used to run PVS-Studio against ITC benchmark suite.

Usage

run_pvs.sh

Notes

This script was used to generate the results discussed in Even Mo’ Static

Code Listing

(run_pvs.sh) download
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
#!/bin/bash

SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE}) && /bin/pwd)
# ensure helper scripts are available
export PATH=${SCRIPT_DIR}:$PATH

CSV=""
CCFILE=""
while getopts ':cp:' flag; do
  case "${flag}" in
    c) CSV="| pvs2csv.pl" ;;
    p) export CCFILE="-p ${OPTARG}" ;;
  esac
done
shift $(($OPTIND - 1))

read -r -d '' COMMAND << 'EOF'
pvs-studio-analyzer analyze --cfg ${SCRIPT_DIR}/PVS-Studio.cfg 2>&1     | # run pvs
egrep -v "Renew|Analyzing|Processing|File processed|Analysis finished"  | # discard unwantated output
sed ':a;N;$!ba;s/:\n/: /g'                                              | # combine lines
sed "s:${ITCBENCH_ROOT}\/::g" |                                           # make all paths relative
sort -u
EOF

bash -c "${COMMAND} ${CSV}"

Comments