gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7349 - in Extractor: . src/test


From: gnunet
Subject: [GNUnet-SVN] r7349 - in Extractor: . src/test
Date: Fri, 27 Jun 2008 13:03:38 -0600 (MDT)

Author: holindho
Date: 2008-06-27 13:03:38 -0600 (Fri, 27 Jun 2008)
New Revision: 7349

Added:
   Extractor/src/test/fuzz_default.sh
   Extractor/src/test/fuzz_thumbnail.sh
Modified:
   Extractor/configure.ac
   Extractor/src/test/Makefile.am
Log:
add fuzzer tests


Modified: Extractor/configure.ac
===================================================================
--- Extractor/configure.ac      2008-06-27 18:53:30 UTC (rev 7348)
+++ Extractor/configure.ac      2008-06-27 19:03:38 UTC (rev 7349)
@@ -460,6 +460,9 @@
 echo ""
 AC_CHECK_LIB(gsf-1, gsf_init, AC_DEFINE(HAVE_GSF_INIT,1,[gsf_init supported]))
 
+AC_CHECK_PROG([HAVE_ZZUF],[zzuf], 1, 0)
+AM_CONDITIONAL(HAVE_ZZUF, test 0 != $HAVE_ZZUF)
+
 printable=1
 AC_MSG_CHECKING([whether to enable printable extractors])
 AC_ARG_ENABLE(printable,

Modified: Extractor/src/test/Makefile.am
===================================================================
--- Extractor/src/test/Makefile.am      2008-06-27 18:53:30 UTC (rev 7348)
+++ Extractor/src/test/Makefile.am      2008-06-27 19:03:38 UTC (rev 7349)
@@ -9,6 +9,13 @@
 LDADD = \
  $(top_builddir)/src/main/libextractor.la  
 
+if HAVE_ZZUF
+fuzz_tests=fuzz_default.sh fuzz_thumbnail.sh
+endif
+
+TESTS_ENVIRONMENT = testdatadir=$(top_srcdir)/test
+TESTS_ENVIRONMENT += bindir=${bindir}
+
 check_PROGRAMS = \
  trivialtest \
  keywordlisttest \
@@ -19,7 +26,7 @@
  mt_extracttest1 \
  mt_extracttest2
 
-TESTS = $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS) $(fuzz_tests)
 
 plugintest_SOURCES = \
  plugintest.c 

Added: Extractor/src/test/fuzz_default.sh
===================================================================
--- Extractor/src/test/fuzz_default.sh                          (rev 0)
+++ Extractor/src/test/fuzz_default.sh  2008-06-27 19:03:38 UTC (rev 7349)
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+ZZSTARTSEED=0
+ZZSTOPSEED=100
+
+# fallbacks for direct, non-"make check" usage
+if test x"$testdatadir" = x""
+then
+  testdatadir=../../test
+fi
+if test x"$bindir" = x""
+then
+  bindir=`grep "^prefix = " ./Makefile | cut -d ' ' -f 3`
+  bindir="$bindir/bin"
+fi
+
+
+for file in $testdatadir/test*
+do
+  if test -f "$file"
+  then
+    tmpfile=`mktemp`
+    if ! test -f "$tmpfile"
+    then
+      exit 1  
+    fi
+    seed=$ZZSTARTSEED
+    while [ $seed -lt $ZZSTOPSEED ]
+    do
+      echo "file $file seed $seed"
+      zzuf -s $seed cat "$file" > "$tmpfile"
+      if ! "$bindir/extract" "$tmpfile" > /dev/null
+      then
+        rm -f "$tmpfile"
+       exit 1
+      fi
+      seed=`expr $seed + 1`
+    done
+    rm -f "$tmpfile"
+  fi
+done
+


Property changes on: Extractor/src/test/fuzz_default.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: Extractor/src/test/fuzz_thumbnail.sh
===================================================================
--- Extractor/src/test/fuzz_thumbnail.sh                                (rev 0)
+++ Extractor/src/test/fuzz_thumbnail.sh        2008-06-27 19:03:38 UTC (rev 
7349)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+ZZSTARTSEED=0
+ZZSTOPSEED=100
+
+# fallbacks for direct, non-"make check" usage
+if test x"$testdatadir" = x""
+then
+  testdatadir=../../test
+fi
+if test x"$bindir" = x""
+then
+  bindir=`grep "^prefix = " ./Makefile | cut -d ' ' -f 3`
+  bindir="$bindir/bin"
+fi
+
+
+for file in $testdatadir/*.bmp $testdatadir/*.png
+do
+  if test -f "$file"
+  then
+    tmpfile=`mktemp`
+    if ! test -f "$tmpfile"
+    then
+      exit 1  
+    fi
+    seed=$ZZSTARTSEED
+    while [ $seed -lt $ZZSTOPSEED ]
+    do
+      echo "file $file seed $seed"
+      zzuf -s $seed cat "$file" > "$tmpfile"
+      "$bindir/extract" -n -l libextractor_thumbnail:libextractor_mime 
"$tmpfile" > /dev/null
+      seed=`expr $seed + 1`
+    done
+    rm -f "$tmpfile"
+  fi
+done
+


Property changes on: Extractor/src/test/fuzz_thumbnail.sh
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]