"Fossies" - the Fresh Open Source Software Archive

Member "libextractor-1.11/src/plugins/fuzz_default.sh" (30 Jan 2021, 1128 Bytes) of package /linux/privat/libextractor-1.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "fuzz_default.sh": 1.10_vs_1.11.

    1 #!/bin/sh
    2 
    3 set -eu
    4 
    5 ZZSTARTSEED=0
    6 ZZSTOPSEED=100
    7 ret=0
    8 # fallbacks for direct, non-"make check" usage
    9 if test x"${testdatadir:-NONE}" = xNONE""
   10 then
   11   testdatadir=../../test
   12 fi
   13 if test x"${bindir:-NONE}" = xNONE""
   14 then
   15   bindir=`grep "^prefix = " ./Makefile | cut -d ' ' -f 3`
   16   bindir="$bindir/bin"
   17 fi
   18 
   19 if test ! -x `which zzuf`
   20 then
   21     echo "zzuf not available, not running the test"
   22     exit 77
   23 fi
   24 
   25 if test -x `which timeout`
   26 then
   27     TIMEOUT="timeout 15"
   28 else
   29     echo "timeout command not found, will not auto-timeout (may cause hang)"
   30     TIMEOUT=""
   31 fi
   32 
   33 for file in $testdatadir/test*
   34 do
   35   if test -f "$file"
   36   then
   37     tmpfile=`mktemp extractortmp.XXXXXX` || exit 1
   38     seed=$ZZSTARTSEED
   39     trap "echo $tmpfile caused SIGSEGV ; exit 1" SEGV
   40     while [ $seed -lt $ZZSTOPSEED ]
   41     do
   42       echo "file $file seed $seed"
   43       zzuf -c -s $seed cat "$file" > "$tmpfile"
   44       if ! $TIMEOUT $bindir/extract -i "$tmpfile" > /dev/null
   45       then
   46         echo "$tmpfile with seed $seed failed"
   47         mv $tmpfile $tmpfile.keep
   48         ret=1
   49       fi
   50       seed=`expr $seed + 1`
   51     done
   52     rm -f "$tmpfile"
   53   fi
   54 done
   55 
   56 exit $ret