Skip to content

Instantly share code, notes, and snippets.

@timurey
Last active December 7, 2016 13:48
Show Gist options
  • Save timurey/e8c4a869d302211d2d425a3d623570d2 to your computer and use it in GitHub Desktop.
Save timurey/e8c4a869d302211d2d425a3d623570d2 to your computer and use it in GitHub Desktop.
#!/bin/bash
while [ "$1" != "" ]; do
case $1 in
-n | --projectname ) shift
projectname=$1
;;
-c | --config ) shift
config=$1
;;
esac
shift
done
if [ "$projectname" != "" ]; then
TEMPLOG=$(tempfile)
cd "/root/workspace/$projectname/$config"
# удаляем ошмётки `strace`, которые могут появиться в некоторых случаях:
pvs-studio-analyzer trace -- make -f makefile all 2>&1 | sed '/strace: umovestr:/d' -
pvs-studio-analyzer analyze --compiler arm-none-eabi-gcc -o "$TEMPLOG" --cfg /root/workspace/docker-pvs/pvs-studio.cfg
# удаляем непонятную строку, которая у меня появляется в выводе конвертера:
RC=$(plog-converter -t errorfile "$TEMPLOG" | sed '/The documentation for all/d' -)
rm -f "$TEMPLOG"
echo "$RC"
fi
#!/bin/bash
debug()
{
if [ "$debug" == "1" ]; then
d=$1
echo $d
fi
}
usage()
{
echo "usage: eclipse-pvs [[-w <path> -n <name> [-d]]| -h]"
echo "where args:"
echo " -w(--workspace) <path> set path to workspace directory"
echo " -n(--projectname) <name> project name in eclipse"
echo " -c(--config) <config> config descriptor (Debug or Release)"
echo " -d(--debug) some debuging info"
echo " -h(--help) show this message"
}
clean ()
{
debug "Clean"
make -f makefile clean
exit
}
analyze()
{
debug "running command:"
debug "/usr/local/bin/docker run --security-opt seccomp:\"""$workspace/docker-pvs/strace.json""\" -v \"""$workspace""\":/root/workspace -i timurey/docker-pvs /root/workspace/docker-pvs/client -n \"""$projectname""\" -c \"""$config""\""
/usr/local/bin/docker run --security-opt seccomp:"$workspace/docker-pvs/strace.json" -v "$workspace":/root/workspace -i timurey/docker-pvs /root/workspace/docker-pvs/client -n "$projectname" -c "$config"
exit
}
while [ "$1" != "" ]; do
case $1 in
-w | --workspace ) shift
workspace=$1
;;
-c | --config ) shift
config=$1
;;
-n | --projectname ) shift
projectname=$1
;;
-d | --debug )
debug=1
;;
-h | --help ) usage
exit
;;
clean ) clean
exit
esac
shift
done
if [ "$workspace" != "" ]; then
if [ "$projectname" != "" ]; then
if [ "$config" != "" ]; then
debug "workspace path: \"$workspace\""
debug "project name: \"$projectname\""
debug "config description: \"$config\""
analyze
else
echo "config description is not defined" >&2
exit
fi
else
echo "project name path is not defined" >&2
exit
fi
else
echo "workspace is not defined" >&2
exit
fi
exclude-path = /usr/arm-none-eabi/include
platform = linux64
preprocessor = gcc
analysis-mode = 4
sourcetree-root = /root/workspace
#!/bin/sh
echo "Fetching last timurey/docker-pvs image"
/usr/local/bin/docker pull timurey/docker-pvs:latest
echo "Testing"
/usr/local/bin/docker run -i timurey/docker-pvs echo "Ready to run"
{
"defaultAction": "SCMP_ACT_ALLOW",
"syscalls": [
{
"name": "strace",
"action": "SCMP_ACT_ERRNO"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment