X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Flcov-wrapper.in;fp=tests%2Flcov-wrapper.in;h=1981cdaebe5bda7a0f176a19c67fc9d33870d1bf;hb=7c126fbb8a0589f2a29f3e7c520723a2d74b254e;hp=0000000000000000000000000000000000000000;hpb=a778696338b85b86b31b9ec7d1a4daeda430aa8b;p=sliver-openvswitch.git diff --git a/tests/lcov-wrapper.in b/tests/lcov-wrapper.in new file mode 100755 index 000000000..1981cdaeb --- /dev/null +++ b/tests/lcov-wrapper.in @@ -0,0 +1,58 @@ +#! /bin/sh + +abs_top_builddir='@abs_top_builddir@' +wrap_program=`basename '@wrap_program@'` + +# Strip the first directory from $PATH that contains $wrap_program, +# so that below we run the real $wrap_program, not ourselves. +not_found=true +new_path= +first=true +save_IFS=$IFS +IFS=: +for dir in $PATH; do + IFS=$save_IFS + if $not_found && test -x "$dir/$wrap_program"; then + not_found=false + else + if $first; then + first=false + new_path=$dir + else + new_path=$new_path:$dir + fi + fi +done +IFS=$save_IFS +if $not_found; then + echo "$0: error: cannot find $wrap_program in \$PATH" >&2 + exit 1 +fi +PATH=$new_path +export PATH + +# XXX Probably want some kind of synchronization here to deal with +# programs running in parallel. +LCOV="lcov -b $abs_top_builddir -d $abs_top_builddir -q" +$LCOV -z + +# Run the subprocess and propagate signals to it. +for signal in 1 2 3 5 15; do + trap "kill -$signal \$! # Propagate signal + trap - $signal # Reset signal to default + wait # Wait for child to die + kill -$signal $$ # Kill ourselves with same signal + exit 1 # Exit in case 'kill' failed" $signal +done +$wrap_program 0<&0 "$@" & # 0<&0 prevents shell from closing stdin +exec 0> "$abs_top_builddir/tests/coverage.info" + break +done + +exit $rc