From 7eceac218e8c8c8e10ff2a5461870ecfaba3fd42 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 2 Apr 2018 00:07:05 +0300 Subject: pvscheck: Make realdir work with nonexistent directories --- scripts/pvscheck.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 314966f6aa..84b42c2bae 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -302,8 +302,16 @@ create_compile_commands() {( # realpath is not available in Ubuntu trusty yet. realdir() {( local dir="$1" - cd "$dir" - printf '%s\n' "$PWD" + local add="" + while ! cd "$dir" 2>/dev/null ; do + add="${dir##*/}/$add" + local new_dir="${dir%/*}" + if test "$new_dir" = "$dir" ; then + return 1 + fi + dir="$new_dir" + done + printf '%s\n' "$PWD/$add" )} patch_sources() {( -- cgit From 65d0b8ed32ac0a3123d93d2f78e4c236aa76283d Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 2 Apr 2018 00:10:08 +0300 Subject: pvscheck: Also produce fullhtml reports --- scripts/pvscheck.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 84b42c2bae..ba7d87e983 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -364,6 +364,7 @@ run_analysis() {( plog-converter -t xml -o PVS-studio.xml PVS-studio.log plog-converter -t errorfile -o PVS-studio.err PVS-studio.log plog-converter -t tasklist -o PVS-studio.tsk PVS-studio.log + plog-converter -t fullhtml -o PVS-studio.html.d PVS-studio.log )} detect_url() { -- cgit From 6b84f7813cc98c7dfca7e751856af0cd2bdcf1ac Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 2 Apr 2018 00:12:28 +0300 Subject: pvscheck: Also provide source tree root to plog-converter --- scripts/pvscheck.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index ba7d87e983..54e6241d07 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -361,10 +361,10 @@ run_analysis() {( --file build/compile_commands.json \ --sourcetree-root . || true - plog-converter -t xml -o PVS-studio.xml PVS-studio.log - plog-converter -t errorfile -o PVS-studio.err PVS-studio.log - plog-converter -t tasklist -o PVS-studio.tsk PVS-studio.log - plog-converter -t fullhtml -o PVS-studio.html.d PVS-studio.log + plog-converter -r . -t xml -o PVS-studio.xml PVS-studio.log + plog-converter -r . -t errorfile -o PVS-studio.err PVS-studio.log + plog-converter -r . -t tasklist -o PVS-studio.tsk PVS-studio.log + plog-converter -r . -t fullhtml -o PVS-studio.html.d PVS-studio.log )} detect_url() { -- cgit From 57c66bc168cb30a483b9fd13cb13e35bea5491bc Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 17 Apr 2018 01:14:55 +0300 Subject: pvscheck: Remove outputs before running plog-converter plog-converter behaviour is not the best one when creating fullhtml report and directory already exists: it puts report inside an existing directory. Not sure what exactly it does if inside exists as well, but if I am not mistaking report will not be created. --- scripts/pvscheck.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 54e6241d07..9916a838b6 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -361,6 +361,7 @@ run_analysis() {( --file build/compile_commands.json \ --sourcetree-root . || true + rm -rf PVS-studio.{xml,err,tsk,html.d} plog-converter -r . -t xml -o PVS-studio.xml PVS-studio.log plog-converter -r . -t errorfile -o PVS-studio.err PVS-studio.log plog-converter -r . -t tasklist -o PVS-studio.tsk PVS-studio.log -- cgit From cb3bb0becb74f46dfa88ff4be25833f55576c04e Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 17 Apr 2018 01:35:59 +0300 Subject: pvscheck: Add --update switch --- scripts/pvscheck.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 9916a838b6..62051b191d 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -21,13 +21,14 @@ help() { echo 'Usage:' echo ' pvscheck.sh [--pvs URL] [--deps] [--environment-cc]' echo ' [target-directory [branch]]' - echo ' pvscheck.sh [--pvs URL] [--recheck] [--environment-cc]' + echo ' pvscheck.sh [--pvs URL] [--recheck] [--environment-cc] [--update]' echo ' [target-directory]' echo ' pvscheck.sh [--pvs URL] --only-analyse [target-directory]' echo ' pvscheck.sh [--pvs URL] --pvs-install {target-directory}' echo ' pvscheck.sh --patch [--only-build]' echo echo ' --pvs: Fetch pvs-studio from URL.' + echo echo ' --pvs detect: Auto-detect latest version (by scraping viva64.com).' echo echo ' --deps: (for regular run) Use top-level Makefile and build deps.' @@ -47,6 +48,8 @@ help() { echo echo ' --recheck: run analysis on a prepared target directory.' echo + echo ' --update: when rechecking first do a pull.' + echo echo ' --only-analyse: run analysis on a prepared target directory ' echo ' without building Neovim.' echo @@ -399,13 +402,24 @@ do_check() { install_pvs "$tgt" "$pvs_url" - do_recheck "$tgt" "$deps" "$environment_cc" + do_recheck "$tgt" "$deps" "$environment_cc" "" } do_recheck() { local tgt="$1" ; shift local deps="$1" ; shift local environment_cc="$1" ; shift + local update="$1" ; shift + + if test -n "$update" ; then + ( + cd "$tgt" + local branch="$(git rev-parse --abbrev-ref HEAD)" + git checkout --detach + git fetch -f origin "${branch}:${branch}" + git checkout -f "$branch" + ) + fi create_compile_commands "$tgt" "$deps" "$environment_cc" @@ -437,6 +451,7 @@ main() { pvs-install store_const \ deps store_const \ environment-cc store_const \ + update store_const \ -- \ 'modify realdir tgt "$PWD/../neovim-pvs"' \ 'store branch master' \ @@ -455,7 +470,7 @@ main() { elif test -n "$pvs_install" ; then install_pvs "$tgt" "$pvs_url" elif test -n "$recheck" ; then - do_recheck "$tgt" "$deps" "$environment_cc" + do_recheck "$tgt" "$deps" "$environment_cc" "$update" elif test -n "$only_analyse" ; then do_analysis "$tgt" else -- cgit From 4ce8521ee4a72e050bd187c2986708c5f98c7442 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 22 Apr 2018 20:54:17 +0300 Subject: pvscheck: Disable V011 warning --- scripts/pvscheck.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 62051b191d..11b672c515 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -365,10 +365,11 @@ run_analysis() {( --sourcetree-root . || true rm -rf PVS-studio.{xml,err,tsk,html.d} - plog-converter -r . -t xml -o PVS-studio.xml PVS-studio.log - plog-converter -r . -t errorfile -o PVS-studio.err PVS-studio.log - plog-converter -r . -t tasklist -o PVS-studio.tsk PVS-studio.log - plog-converter -r . -t fullhtml -o PVS-studio.html.d PVS-studio.log + local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011" + plog-converter $plog_args --renderTypes xml --output PVS-studio.xml + plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err + plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk + plog-converter $plog_args --renderTypes fullhtml --output PVS-studio.html.d )} detect_url() { -- cgit