[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
Török Edvin
edwin at clamav.net
Sun Apr 4 01:04:52 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 3c5f686d7518b9563262fbeb5937c0b6b9d4920e
Author: Török Edvin <edwin at clamav.net>
Date: Mon Sep 14 17:37:19 2009 +0300
Use automake's parallel tests feature.
This simplifies the various clamd/clamscan tests a lot,
since the valgrind tests can now be parallelized by automake,
and we don't need to do that in the script itself.
diff --git a/.gitignore b/.gitignore
index 60b5325..3e37563 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,5 +15,4 @@ target.h
config.log
config.status
libclamav.pc
-unit_tests/*
autom4te.cache/*
diff --git a/Makefile.am b/Makefile.am
index 8787f48..0fc204b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,7 @@ pkgconfig_DATA = libclamav.pc
# don't complain that configuration files and databases are not removed, this is intended
distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print
DISTCLEANFILES = target.h
-if DISTCHECK_ENABLE_FLAGS
+if DISTCHECK_ENABLE_FLAGS
DISTCHECK_CONFIGURE_FLAGS=--enable-milter --disable-clamav CFLAGS="-Wno-pointer-sign -Werror-implicit-function-declaration -Werror -Wextra -Wall -Wbad-function-cast -Wcast-align -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wno-error=missing-prototypes -Wnested-externs -Wno-error=nested-externs -Wpointer-arith -Wstrict-prototypes -Wno-error=strict-prototypes -Wno-switch -Wno-switch-enum -Wundef -Wwrite-strings -Wstrict-overflow=1 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wdeclaration-after-statement -Waggregate-return -Wmissing-format-attribute -Wno-error=missing-format-attribute -Wno-error=type-limits -Wno-error=unused-value -Wno-error=unused-variable -Wcast-qual -Wno-error=cast-qual -Wno-error=sign-compare -Wshadow -Wno-error=shadow -Wno-error=uninitialized -fdiagnostics-show-option -Wno-unused-parameter -Wno-error=unreachable-code -Winvalid-pch -Wno-error=invalid-pch -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -Wno-error=aggregate-return"
else
DISTCHECK_CONFIGURE_FLAGS=--enable-milter --disable-clamav
diff --git a/Makefile.in b/Makefile.in
index a95f2d3..5e1038a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -384,7 +384,8 @@ DISTCLEANFILES = target.h
@DISTCHECK_ENABLE_FLAGS_TRUE@ -D_FORTIFY_SOURCE=2 \
@DISTCHECK_ENABLE_FLAGS_TRUE@ -fstack-protector-all \
@DISTCHECK_ENABLE_FLAGS_TRUE@ -Wstack-protector \
- at DISTCHECK_ENABLE_FLAGS_TRUE@ -Wno-error=aggregate-return"
+ at DISTCHECK_ENABLE_FLAGS_TRUE@ -Wno-error=aggregate-return" \
+ at DISTCHECK_ENABLE_FLAGS_TRUE@ VERBOSE=1
all: clamav-config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/configure.in b/configure.in
index 7fbcfc2..6e25959 100644
--- a/configure.in
+++ b/configure.in
@@ -33,7 +33,7 @@ AC_CREATE_TARGET_H([target.h])
dnl -Wall and -Werror here are NOT CFLAGS, they refer to automake warnings
dnl enable stealth builds and psychedelic tests
-AM_INIT_AUTOMAKE([-Wall -Wportability -Wno-override -Werror std-options foreign dist-bzip2 no-define color-tests])
+AM_INIT_AUTOMAKE([1.11 -Wall -Wportability -Wno-override -Werror std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
AM_SILENT_RULES([yes])
dnl we told automake to not define these, since we want to include
diff --git a/unit_tests/Makefile.am b/unit_tests/Makefile.am
index 8d5f956..b6fa52e 100644
--- a/unit_tests/Makefile.am
+++ b/unit_tests/Makefile.am
@@ -1,14 +1,22 @@
SPLIT_DIR=$(top_srcdir)/unit_tests/.split
FILES = clam-phish-exe
-check_clamd.sh: $(FILES)
+check2_clamd.sh: $(FILES)
+check3_clamd.sh: $(FILES)
+check4_clamd.sh: $(FILES)
+check5_clamd_vg.sh: $(FILES)
+check6_clamd_vg.sh: $(FILES)
+check7_clamd_vg.sh: $(FILES)
+check8_clamd_hg.sh: $(FILES)
+check9_clamd_hg.sh: $(FILES)
+check10_clamd_hg.sh: $(FILES)
$(FILES) :
cat $(SPLIT_DIR)/split.$@aa $(SPLIT_DIR)/split.$@ab > $@
programs = check_clamav
-scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh\
- valgrind_tests.sh efence_tests.sh duma_tests.sh
+scripts = check_freshclam.sh check_sigtool.sh check1_clamscan.sh check2_clamd.sh check3_clamd.sh check4_clamd.sh\
+ check5_clamd_vg.sh check6_clamd_vg.sh check7_clamd_hg.sh check8_clamd_hg.sh
TESTS_ENVIRONMENT=export abs_srcdir=$(abs_srcdir) AWK=$(AWK);
if ENABLE_UNRAR
else
@@ -42,8 +50,8 @@ $(top_builddir)/test/clam.exe:
quick-check:
VALGRIND=no LIBEFENCE=no LIBDUMA=no $(MAKE) check
-CLEANFILES=lcov.out *.gcno *.gcda *.log $(FILES) test-stderr.log clamscan.log valgrind-*.log duma.log duma2.log clamscan2.log
-EXTRA_DIST=.split $(srcdir)/*.ref input test-clamd.conf test-freshclam.conf valgrind.supp virusaction-test.sh $(scripts) preload_run.sh
+CLEANFILES=lcov.out *.gcno *.gcda *.log $(FILES) test-stderr.log clamscan.log accdenied
+EXTRA_DIST=.split $(srcdir)/*.ref input test-freshclam.conf valgrind.supp virusaction-test.sh $(scripts) preload_run.sh check_common.sh
if ENABLE_COVERAGE
LCOV_OUTPUT = lcov.out
LCOV_HTML = lcov_html
diff --git a/unit_tests/Makefile.in b/unit_tests/Makefile.in
index 1cba450..db6c2a0 100644
--- a/unit_tests/Makefile.in
+++ b/unit_tests/Makefile.in
@@ -133,6 +133,76 @@ test "X$(AM_COLOR_TESTS)" != Xno \
blu='[1;34m'; \
std='[m'; \
}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+# Restructured Text title and section.
+am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//'
+am__rst_section = sed 'p;s/./=/g;p;g'
+# Put stdin (possibly several lines separated by ". ") in a box.
+am__text_box = $(AWK) '{ \
+ n = split($$0, lines, "\\. "); max = 0; \
+ for (i = 1; i <= n; ++i) \
+ if (max < length(lines[i])) \
+ max = length(lines[i]); \
+ for (i = 0; i < max; ++i) line = line "="; \
+ print line; \
+ for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\
+ print line; \
+}'
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL). This contradicts POSIX. Work around the problem
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log, and passes
+# TESTS_ENVIRONMENT. Save and restore TERM around use of
+# TESTS_ENVIRONMENT, in case that unsets it.
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+srcdir=$(srcdir); export srcdir; \
+rm -f $@-t; \
+trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \
+ 1 2 13 15; \
+am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \
+test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM; \
+$(TESTS_ENVIRONMENT)
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check check-html recheck recheck-html
+TEST_SUITE_LOG = test-suite.log
+TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -294,8 +364,8 @@ top_srcdir = @top_srcdir@
SPLIT_DIR = $(top_srcdir)/unit_tests/.split
FILES = clam-phish-exe
programs = check_clamav
-scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh\
- valgrind_tests.sh efence_tests.sh duma_tests.sh
+scripts = check_freshclam.sh check_sigtool.sh check1_clamscan.sh check2_clamd.sh check3_clamd.sh check4_clamd.sh\
+ check5_clamd_vg.sh check6_clamd_vg.sh check7_clamd_hg.sh check8_clamd_hg.sh
TESTS_ENVIRONMENT = export abs_srcdir=$(abs_srcdir) AWK=$(AWK); \
$(am__append_1)
@@ -312,8 +382,8 @@ check_SCRIPTS = $(scripts)
@HAVE_LIBCHECK_TRUE at check_clamd_SOURCES = check_clamd.c checks_common.h
@HAVE_LIBCHECK_TRUE at check_clamd_CPPFLAGS = -I$(top_srcdir) @CHECK_CPPFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" -DBUILDDIR=\"$(abs_builddir)\"
@HAVE_LIBCHECK_TRUE at check_clamd_LDADD = @CHECK_LIBS@ @CLAMD_LIBS@
-CLEANFILES = lcov.out *.gcno *.gcda *.log $(FILES) test-stderr.log clamscan.log valgrind-*.log duma.log duma2.log clamscan2.log
-EXTRA_DIST = .split $(srcdir)/*.ref input test-clamd.conf test-freshclam.conf valgrind.supp virusaction-test.sh $(scripts) preload_run.sh
+CLEANFILES = lcov.out *.gcno *.gcda *.log $(FILES) test-stderr.log clamscan.log accdenied
+EXTRA_DIST = .split $(srcdir)/*.ref input test-freshclam.conf valgrind.supp virusaction-test.sh $(scripts) preload_run.sh check_common.sh
@ENABLE_COVERAGE_TRUE at LCOV_OUTPUT = lcov.out
@ENABLE_COVERAGE_TRUE at LCOV_HTML = lcov_html
@ENABLE_COVERAGE_TRUE at LCOV_LCOV = @LCOV@
@@ -323,7 +393,7 @@ EXTRA_DIST = .split $(srcdir)/*.ref input test-clamd.conf test-freshclam.conf va
all: all-am
.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .html .lo .log .o .obj .test .test$(EXEEXT)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@@ -663,97 +733,183 @@ GTAGS:
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; \
- srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
- ;; \
- *) \
- col=$$grn; res=PASS; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
- xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
- fi; \
- echo "$${col}$$res$${std}: $$tst"; \
- done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
- else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
- else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
- fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
- else \
- echo "$$red$$dashes"; \
- fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
- test "$$failed" -eq 0; \
- else :; fi
+# To be appended to the command running the test. Handle the stdout
+# and stderr redirection, and catch the exit status.
+am__check_post = \
+>$@-t 2>&1; \
+estatus=$$?; \
+if test -n '$(DISABLE_HARD_ERRORS)' \
+ && test $$estatus -eq 99; then \
+ estatus=1; \
+fi; \
+TERM=$$__SAVED_TERM; export TERM; \
+$(am__tty_colors); \
+xfailed=PASS; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ xfailed=XFAIL;; \
+esac; \
+case $$estatus:$$xfailed in \
+ 0:XFAIL) col=$$red; res=XPASS;; \
+ 0:*) col=$$grn; res=PASS ;; \
+ 77:*) col=$$blu; res=SKIP ;; \
+ 99:*) col=$$red; res=FAIL ;; \
+ *:XFAIL) col=$$lgn; res=XFAIL;; \
+ *:*) col=$$red; res=FAIL ;; \
+esac; \
+echo "$${col}$$res$${std}: $$f"; \
+echo "$$res: $$f (exit: $$estatus)" | \
+ $(am__rst_section) >$@; \
+cat $@-t >>$@; \
+rm -f $@-t
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__sh_e_setup); \
+ list='$(TEST_LOGS)'; \
+ results=`for f in $$list; do \
+ read line < $$f && echo "$$line" || echo FAIL; \
+ done`; \
+ all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[ ]*//'`; \
+ fail=`echo "$$results" | grep -c '^FAIL'`; \
+ pass=`echo "$$results" | grep -c '^PASS'`; \
+ skip=`echo "$$results" | grep -c '^SKIP'`; \
+ xfail=`echo "$$results" | grep -c '^XFAIL'`; \
+ xpass=`echo "$$results" | grep -c '^XPASS'`; \
+ failures=`expr $$fail + $$xpass`; \
+ all=`expr $$all - $$skip`; \
+ if test "$$all" -eq 1; then tests=test; All=; \
+ else tests=tests; All="All "; fi; \
+ case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \
+ fail=0:xpass=0:xfail=0) \
+ msg="$$All$$all $$tests passed. "; \
+ exit=true;; \
+ fail=0:xpass=0:xfail=*) \
+ msg="$$All$$all $$tests behaved as expected"; \
+ if test "$$xfail" -eq 1; then xfailures=failure; \
+ else xfailures=failures; fi; \
+ msg="$$msg ($$xfail expected $$xfailures). "; \
+ exit=true;; \
+ fail=*:xpass=0:xfail=*) \
+ msg="$$fail of $$all $$tests failed. "; \
+ exit=false;; \
+ fail=*:xpass=*:xfail=*) \
+ msg="$$failures of $$all $$tests did not behave as expected"; \
+ if test "$$xpass" -eq 1; then xpasses=pass; \
+ else xpasses=passes; fi; \
+ msg="$$msg ($$xpass unexpected $$xpasses). "; \
+ exit=false;; \
+ *) \
+ echo >&2 "incorrect case"; exit 4;; \
+ esac; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ msg="$$msg($$skip test was not run). "; \
+ else \
+ msg="$$msg($$skip tests were not run). "; \
+ fi; \
+ fi; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ echo "$$msg"; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for f in $$list; do \
+ read line < $$f; \
+ case $$line in \
+ PASS:*|XFAIL:*);; \
+ *) echo; cat $$f;; \
+ esac; \
+ done; \
+ } >$(TEST_SUITE_LOG).tmp; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if test "$$failures" -ne 0; then \
+ msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \
+ fi; \
+ fi; \
+ test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \
+ $(am__tty_colors); \
+ if $$exit; then \
+ echo $(ECHO_N) "$$grn$(ECHO_C)"; \
+ else \
+ echo $(ECHO_N) "$$red$(ECHO_C)"; \
+ fi; \
+ echo "$$msg" | $(am__text_box); \
+ echo $(ECHO_N) "$$std$(ECHO_C)"; \
+ $$exit
+
+# Run all the tests.
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set_logs=; if test "X$(TEST_LOGS)" = X.log; then \
+ set_logs=TEST_LOGS=; \
+ fi; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) $$set_logs
+
+.log.html:
+ @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \
+ for r2h in $$list; do \
+ if ($$r2h --version) >/dev/null 2>&1; then \
+ R2H=$$r2h; \
+ fi; \
+ done; \
+ if test -z "$$R2H"; then \
+ echo >&2 "cannot find rst2html, cannot create $@"; \
+ exit 2; \
+ fi; \
+ $$R2H $< >$@.tmp
+ @mv $@.tmp $@
+
+# Be sure to run check first, and then to convert the result.
+# Beware of concurrent executions. Run "check" not "check-TESTS", as
+# check-SCRIPTS and other dependencies are rebuilt by the former only.
+# And expect check to fail.
+check-html:
+ @if $(MAKE) $(AM_MAKEFLAGS) check; then \
+ rv=0; else rv=$$?; \
+ fi; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \
+ exit $$rv
+recheck recheck-html:
+ @target=`echo $@ | sed 's,^re,,'`; \
+ list='$(TEST_LOGS)'; \
+ list=`for f in $$list; do \
+ test -f $$f || continue; \
+ if read line < $$f; then \
+ case $$line in FAIL*|XPASS*) echo $$f;; esac; \
+ else echo $$f; fi; \
+ done | tr '\012\015' ' '`; \
+ $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
+check_clamav.log: check_clamav$(EXEEXT)
+ @p='check_clamav$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check_freshclam.sh.log: check_freshclam.sh
+ @p='check_freshclam.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check_sigtool.sh.log: check_sigtool.sh
+ @p='check_sigtool.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check1_clamscan.sh.log: check1_clamscan.sh
+ @p='check1_clamscan.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check2_clamd.sh.log: check2_clamd.sh
+ @p='check2_clamd.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check3_clamd.sh.log: check3_clamd.sh
+ @p='check3_clamd.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check4_clamd.sh.log: check4_clamd.sh
+ @p='check4_clamd.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check5_clamd_vg.sh.log: check5_clamd_vg.sh
+ @p='check5_clamd_vg.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check6_clamd_vg.sh.log: check6_clamd_vg.sh
+ @p='check6_clamd_vg.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check7_clamd_hg.sh.log: check7_clamd_hg.sh
+ @p='check7_clamd_hg.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+check8_clamd_hg.sh.log: check8_clamd_hg.sh
+ @p='check8_clamd_hg.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+.test.log:
+ @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
+ at am__EXEEXT_TRUE@.test$(EXEEXT).log:
+ at am__EXEEXT_TRUE@ @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -806,6 +962,10 @@ install-strip:
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS_TMP)" || rm -f $(TEST_LOGS_TMP)
+ -test -z "$(TEST_SUITE_HTML)" || rm -f $(TEST_SUITE_HTML)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
@@ -889,24 +1049,33 @@ ps-am:
uninstall-am:
-.MAKE: check-am install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
- clean-checkPROGRAMS clean-generic clean-libtool clean-local \
- ctags distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+.MAKE: check-am check-html install-am install-strip recheck \
+ recheck-html
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-html \
+ clean clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-local ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
-
-
-check_clamd.sh: $(FILES)
+ recheck recheck-html tags uninstall uninstall-am
+
+
+check2_clamd.sh: $(FILES)
+check3_clamd.sh: $(FILES)
+check4_clamd.sh: $(FILES)
+check5_clamd_vg.sh: $(FILES)
+check6_clamd_vg.sh: $(FILES)
+check7_clamd_vg.sh: $(FILES)
+check8_clamd_hg.sh: $(FILES)
+check9_clamd_hg.sh: $(FILES)
+check10_clamd_hg.sh: $(FILES)
$(FILES) :
cat $(SPLIT_DIR)/split.$@aa $(SPLIT_DIR)/split.$@ab > $@
diff --git a/unit_tests/check1_clamscan.sh b/unit_tests/check1_clamscan.sh
new file mode 100755
index 0000000..eae56f5
--- /dev/null
+++ b/unit_tests/check1_clamscan.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. $abs_srcdir/check_common.sh
+test_clamscan 1
diff --git a/unit_tests/check2_clamd.sh b/unit_tests/check2_clamd.sh
new file mode 100755
index 0000000..97e5a71
--- /dev/null
+++ b/unit_tests/check2_clamd.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+test_clamd1 2
diff --git a/unit_tests/check3_clamd.sh b/unit_tests/check3_clamd.sh
new file mode 100755
index 0000000..7e6ec2b
--- /dev/null
+++ b/unit_tests/check3_clamd.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+test_clamd2 3
diff --git a/unit_tests/check4_clamd.sh b/unit_tests/check4_clamd.sh
new file mode 100755
index 0000000..7e7d4b6
--- /dev/null
+++ b/unit_tests/check4_clamd.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+test_clamd3 4
diff --git a/unit_tests/check5_clamd_vg.sh b/unit_tests/check5_clamd_vg.sh
new file mode 100755
index 0000000..40b9e3a
--- /dev/null
+++ b/unit_tests/check5_clamd_vg.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+init_valgrind
+WRAPPER="$VALGRIND $VALGRIND_FLAGS" test_clamd1 5
+end_valgrind
diff --git a/unit_tests/check6_clamd_vg.sh b/unit_tests/check6_clamd_vg.sh
new file mode 100755
index 0000000..d8383ad
--- /dev/null
+++ b/unit_tests/check6_clamd_vg.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+init_valgrind
+WRAPPER="$VALGRIND $VALGRIND_FLAGS" test_clamd2 6
+end_valgrind
diff --git a/unit_tests/check7_clamd_hg.sh b/unit_tests/check7_clamd_hg.sh
new file mode 100755
index 0000000..b1e60e5
--- /dev/null
+++ b/unit_tests/check7_clamd_hg.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+init_helgrind
+WRAPPER="$VALGRIND $VALGRIND_FLAGS_RACE" test_clamd1 7
+end_valgrind
diff --git a/unit_tests/check8_clamd_hg.sh b/unit_tests/check8_clamd_hg.sh
new file mode 100755
index 0000000..07f5d8a
--- /dev/null
+++ b/unit_tests/check8_clamd_hg.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+. $srcdir/check_common.sh
+init_helgrind
+WRAPPER="$VALGRIND $VALGRIND_FLAGS_RACE" test_clamd2 8
+end_valgrind
diff --git a/unit_tests/check_clamd.sh b/unit_tests/check_clamd.sh
deleted file mode 100755
index f3eb3d9..0000000
--- a/unit_tests/check_clamd.sh
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/bin/sh
-CLAMD_WRAPPER=${CLAMD_WRAPPER-}
-CLAMD_TEST_UNIQ1=${CLAMD_TEST_UNIQ1-1}
-CLAMD_TEST_UNIQ2=${CLAMD_TEST_UNIQ2-2}
-TOP="../.."
-LTEXEC="$TOP/libtool --mode=execute"
-killclamd() {
- test -f clamd-test.pid || return
- pid=`cat clamd-test.pid 2>/dev/null`
- if test "X$pid" = "X"; then
- # file can be removed between the 'test' and 'cat',
- # it happened a few times for me
- return
- fi
- kill -0 $pid 2>/dev/null || return
- kill $pid
- pippo=0
- while kill -0 $pid 2>/dev/null; do
- sleep 1
- pippo=`expr $pippo + 1`
- if test $pippo -gt 9; then
- kill -KILL $pid
- echo "Clamd didn't quit";
- rm -f clamd-test.pid
- exit 4;
- fi
- done
- rm -f clamd-test.pid
-}
-
-die()
-{
- killclamd
- exit $1
-}
-
-error()
-{
- echo >&2
- echo "***" >&2
- echo "*** $1" >&2
- echo "***" >&2
-}
-
-scan_failed() {
- if test "X$unrar_disabled" = "X1" && test `grep -v '\.rar' $1 | grep OK | wc -l` -eq 0
- then
- error "UNRAR is disabled, won't be able to detect unrar files!";
- else
- error $2;
- die 2;
- fi
-}
-
-start_clamd()
-{
- rm -f clamd-test.log ../clamd-test1.log ../clamd-test2.log
- $LTEXEC $CLAMD_WRAPPER $TOP/clamd/clamd -c $1 --help >clamd-test.log 2>&1 ||
- { error "Failed to start clamd --help!"; cat clamd-test.log; die 1; }
- grep "Clam AntiVirus Daemon" clamd-test.log >/dev/null ||
- { error "Wrong --help reply from clamd!"; die 1; }
- $LTEXEC $CLAMD_WRAPPER $TOP/clamd/clamd -c $1 >clamd-test.log 2>&1 ||
- { error "Failed to start clamd!"; cat clamd-test.log; die 1; }
-}
-
-run_clamdscan_fileonly() {
- rm -f clamdscan.log clamdscan-multiscan.log
- $TOP/clamdscan/clamdscan --version --config-file=test-clamd.conf 2>&1|grep "^ClamAV" >/dev/null ||
- { error "clamdscan can't get version of clamd!"; die 1;}
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* --log=clamdscan.log
- if test $? = 2; then
- error "Failed to run clamdscan!"
- cat clamdscan.log
- die 1
- fi
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* -m --log=clamdscan-multiscan.log
- if test $? = 2; then
- error "Failed to run clamdscan (multiscan)!"
- cat clamdscan-multiscan.log
- die 1
- fi
-}
-
-run_clamdscan() {
- run_clamdscan_fileonly $*
- rm -f clamdscan-fdpass.log clamdscan-multiscan-fdpass.log
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* --fdpass --log=clamdscan-fdpass.log
- if test $? = 2; then
- error "Failed to run clamdscan (fdpass)!"
- cat clamdscan-fdpass.log
- die 1
- fi
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* -m --fdpass --log=clamdscan-multiscan-fdpass.log
- if test $? = 2; then
- error "Failed to run clamdscan (fdpass + multiscan)!"
- cat clamdscan-multiscan-fdpass.log
- die 1
- fi
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* --stream --log=clamdscan-stream.log
- if test $? = 2; then
- error "Failed to run clamdscan (instream)!"
- cat clamdscan-stream.log
- die 1
- fi
- $TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* -m --stream --log=clamdscan-multiscan-stream.log
- if test $? = 2; then
- error "Failed to run clamdscan (instream + multiscan)!"
- cat clamdscan-multiscan-stream.log
- die 1
- fi
-}
-
-run_reload_test()
-{
- rm -f reload-testfile
- echo "ClamAV-RELOAD-Test" >reload-testfile
- run_clamdscan reload-testfile
- grep "ClamAV-RELOAD-TestFile" clamdscan.log >/dev/null 2>/dev/null;
- if test $? -eq 0; then
- # it is not supposed to detect until we actually put the
- # signature there and reload!
- error "RELOAD test failed!"
- cat clamdscan.log
- die 10
- fi
- echo "ClamAV-RELOAD-TestFile:0:0:436c616d41562d52454c4f41442d54657374" >test-db/new.ndb
- $TOP/clamdscan/clamdscan --reload --config-file=test-clamd.conf
- if test $? -ne 0; then
- error "clamdscan says reload failed!"
- die 11
- fi
- run_clamdscan reload-testfile
- grep "ClamAV-RELOAD-TestFile" clamdscan.log >/dev/null 2>/dev/null;
- failed=0
- if test $? -ne 0; then
- error "RELOAD test failed! (after reload)"
- cat clamdscan.log
- failed=1
- fi
- grep "ClamAV-RELOAD-TestFile" clamdscan-multiscan.log >/dev/null 2>/dev/null;
- if test $? -ne 0; then
- error "RELOAD test failed! (after reload, multiscan)"
- cat clamdscan-multiscan.log
- failed=1
- fi
- if test "$failed" = "1"; then
- echo "RELOAD tests failed!"
- die 12
- fi
- rm -f reload-testfile
-}
-
-run_clamdscan_fdpass() {
- rm -f clamdscan.log
- $TOP/clamdscan/clamdscan --quiet --fdpass --config-file=test-clamd.conf - <$1 --log=clamdscan.log
- if test $? = 2; then
- error "Failed to run clamdscan (fdpass)!"
- cat clamdscan.log
- die 14
- fi
-}
-
-# We run multiple clamd tests in parallel, each in its own directory
-prepare_clamd()
-{
- cd clamdtest$1
- # Set up test DBdir
- rm -rf test-db
- mkdir -p test-db
- cat <<EOF >test-db/test.hdb
-aa15bcf478d165efd2065190eb473bcb:544:ClamAV-Test-File
-EOF
- cp $abs_srcdir/input/daily.pdb test-db/
- $AWK "{ sub(/X/,\"$1\"); sub(/CWD/,\"`pwd`\"); print }" $abs_srcdir/test-clamd.conf >test-clamd.conf
-}
-
-rm -rf clamdtest$CLAMD_TEST_UNIQ1 clamdtest$CLAMD_TEST_UNIQ2
-mkdir clamdtest$CLAMD_TEST_UNIQ1 clamdtest$CLAMD_TEST_UNIQ2 ||
- { echo "Unable to create temporary directories!"; exit 1; }
-
-# Prepare configuration for clamd #1 and #2
-(prepare_clamd $CLAMD_TEST_UNIQ1)
-(prepare_clamd $CLAMD_TEST_UNIQ2)
-# Add clamd #2 specific configuration
-echo "VirusEvent $abs_srcdir/virusaction-test.sh `pwd`/clamdtest$CLAMD_TEST_UNIQ2 \"Virus found: %v\"" >>clamdtest$CLAMD_TEST_UNIQ2/test-clamd.conf
-echo "HeuristicScanPrecedence yes" >>clamdtest$CLAMD_TEST_UNIQ2/test-clamd.conf
-grep -v LogFile clamdtest$CLAMD_TEST_UNIQ2/test-clamd.conf >tmp__
-mv tmp__ clamdtest$CLAMD_TEST_UNIQ2/test-clamd.conf
-
-# Start clamd #1 tests
-(cd clamdtest$CLAMD_TEST_UNIQ1
-start_clamd test-clamd.conf
-
-# Test that all testfiles are detected
-FILES=$TOP/test/clam*
-run_clamdscan $FILES
-NFILES=`ls -1 $FILES | wc -l`
-NINFECTED=`grep "Infected files" clamdscan.log | cut -f2 -d:|sed -e 's/ //g'`
-NINFECTED_MULTI=`grep "Infected files" clamdscan-multiscan.log | cut -f2 -d:|sed -e 's/ //g'`
-NINFECTED_FDPASS=`grep "Infected files" clamdscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
-NINFECTED_MULTI_FDPASS=`grep "Infected files" clamdscan-multiscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
-NINFECTED_STREAM=`grep "Infected files" clamdscan-stream.log | cut -f2 -d:|sed -e 's/ //g'`
-NINFECTED_MULTI_STREAM=`grep "Infected files" clamdscan-multiscan-stream.log | cut -f2 -d:|sed -e 's/ //g'`
-if test "$NFILES" -ne "0$NINFECTED"; then
- grep OK clamdscan.log
- scan_failed clamdscan.log "clamd did not detect all testfiles correctly!"
-fi
-if test "$NFILES" -ne "0$NINFECTED_MULTI"; then
- grep OK clamdscan-multiscan.log
- scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in multiscan mode!"
-fi
-if test "$NFILES" -ne "0$NINFECTED_FDPASS"; then
- grep OK clamdscan-fdpass.log
- scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass mode!"
-fi
-if test "$NFILES" -ne "0$NINFECTED_MULTI_FDPASS"; then
- grep OK clamdscan-multiscan-fdpass.log
- scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass+multiscan mode!"
-fi
-
-$TOP/unit_tests/check_clamd
-ecode=$?
-if test $ecode -ne 77 && test $ecode -ne 0; then
- error "Failed clamd protocol test!"
- die 1
-fi
-# Test HeuristicScanPrecedence off feature
-run_clamdscan ../clam-phish-exe
-grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null;
-if test $? -ne 0; then
- error "HeuristicScanPrecedence off test failed!"
- cat clamdscan.log
- die 4
-fi
-die 0
-)&
-pid1=$!
-
-# Start clamd #2 tests
-(cd clamdtest$CLAMD_TEST_UNIQ2
-start_clamd test-clamd.conf
-
-# Test VirusEvent feature
-run_clamdscan_fileonly $TOP/test/clam.exe
-grep "Virus found: ClamAV-Test-File.UNOFFICIAL" test-clamd.log >/dev/null 2>/dev/null;
-if test $? -ne 0; then
- error "Virusaction test failed!"
- cat test-clamd.log
- die 2
-fi
-
-# Test HeuristicScanPrecedence feature
-run_clamdscan ../clam-phish-exe
-grep "Phishing.Heuristics.Email.SpoofedDomain" clamdscan.log >/dev/null 2>/dev/null;
-if test $? -ne 0; then
- error "HeuristicScanPrecedence on test failed!"
- cat clamdscan.log
- die 3
-fi
-
-if grep "^#define HAVE_FD_PASSING 1" $TOP/clamav-config.h >/dev/null; then
- run_clamdscan_fdpass $TOP/test/clam.exe
- grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null;
- if test $? -ne 0; then
- error "FDpassing test failed!"
- cat clamdscan.log;
- die 4
- fi
-else
- echo "*** No file descriptor passing support, skipping test"
-fi
-
-# Test RELOAD command
-run_reload_test
-
-die 0
-)&
-
-pid2=$!
-
-wait $pid1
-exitcode1=$?
-wait $pid2
-exitcode2=$?
-rm -rf clamdtest$CLAMD_TEST_UNIQ1 clamdtest$CLAMD_TEST_UNIQ2 test-db accdenied
-if (test $exitcode1 -ne 0 && test $exitcode1 -ne 127) || (test $exitcode2 -ne 0 && test $exitcode2 -ne 127); then
- exit 1
-fi
-exit 0
diff --git a/unit_tests/check_clamscan.sh b/unit_tests/check_clamscan.sh
deleted file mode 100755
index 68b17df..0000000
--- a/unit_tests/check_clamscan.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-CLAMSCAN_WRAPPER=${CLAMSCAN_WRAPPER-}
-die() {
- rm -rf test-db
- exit $1;
-}
-
-scan_failed() {
- if test "X$unrar_disabled" = "X1" && test `grep -v '\.rar' $1 | grep OK | wc -l` -eq 0
- then
- echo "***" >&2;
- echo "*** UNRAR is disabled, won't be able to detect unrar files!" >&2;
- echo "***" >&2;
- else
- echo "clamscan did not detect all testfiles correctly!" >&2;
- die 2;
- fi
-}
-
-mkdir test-db
-cat <<EOF >test-db/test.hdb
-aa15bcf478d165efd2065190eb473bcb:544:ClamAV-Test-File
-EOF
-rm -f clamscan.log
-../libtool --mode=execute $CLAMSCAN_WRAPPER ../clamscan/clamscan --quiet -dtest-db/test.hdb ../test/clam* --log=clamscan.log
-if test $? != 1; then
- echo "Error running clamscan: $?" >&2;
- grep OK clamscan.log >&2;
- die 1;
-fi
-NFILES=`ls -1 ../test/clam* | wc -l`
-NINFECTED=`grep "Infected files" clamscan.log | cut -f2 -d: |sed -e 's/ //g'`
-if test "$NFILES" -ne "0$NINFECTED"; then
- grep OK clamscan.log >&2;
- scan_failed clamscan.log
-fi
-
-cat <<EOF >test-db/test.pdb
-H:example.com
-EOF
-rm -f clamscan2.log
-../clamscan/clamscan -dtest-db $abs_srcdir/input/phish-test-* --log=clamscan2.log --quiet
-val=$?
-if test $val != 0; then
- if test $val = 1; then
- echo "clamscan detected a file it shouldn't" >&2
- grep FOUND clamscan2.log
- die 3;
- fi
- echo "Error running clamscan: $val" >&2;
- die 3;
-fi
-
-rm -f clamscan2.log
-../clamscan/clamscan --phishing-ssl --phishing-cloak -dtest-db $abs_srcdir/input/phish-test-* --log=clamscan2.log --quiet
-val=$?
-if test $val != 1; then
- echo "Error running clamscan: $val" >&2;
- die 3;
-fi
-grep "phish-test-ssl: Phishing.Heuristics.Email.SSL-Spoof FOUND" clamscan2.log >/dev/null && grep "phish-test-cloak: Phishing.Heuristics.Email.Cloaked.Null FOUND" clamscan2.log >/dev/null
-if test $? -ne 0; then
- echo "Error on ssl/cloak phishing test" >&2;
- die 4;
-fi
-die 0;
diff --git a/unit_tests/check_common.sh b/unit_tests/check_common.sh
new file mode 100644
index 0000000..4957244
--- /dev/null
+++ b/unit_tests/check_common.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+set -e
+
+WRAPPER=${WRAPPER-}
+TOP=`pwd`/..
+CLAMSCAN=$TOP/clamscan/clamscan
+CLAMD=$TOP/clamd/clamd
+CHECK_CLAMD=$TOP/unit_tests/check_clamd
+CLAMDSCAN=$TOP/clamdscan/clamdscan
+TESTFILES=$TOP/test/clam*
+NFILES=`ls -1 $TESTFILES | wc -l`
+
+killclamd() {
+ test -f clamd-test.pid &&
+ pid=`cat clamd-test.pid 2>/dev/null` &&
+ test -n "$pid" &&
+ kill -0 $pid 2>/dev/null &&
+ kill $pid 2>/dev/null &&
+ kill -0 $pid 2>/dev/null &&
+ sleep 1 &&
+ kill -0 $pid 2>/dev/null &&
+ sleep 9 &&
+ kill -0 $pid 2>/dev/null &&
+ kill -KILL $pid || true
+}
+
+error()
+{
+ echo >&2
+ echo "***" >&2
+ echo "*** $1" >&2
+ echo "***" >&2
+}
+
+die()
+{
+ error "$1"
+ test -f valgrind.log && cat valgrind.log || true
+ killclamd
+ exit 42
+}
+
+# Setup test directory to avoid temporary and output file clashes
+test_start() {
+ ulimit -t 120; ulimit -d 512000; ulimit -v 512000;
+ (cd test-$1 2>/dev/null && killclamd || true)
+ rm -rf test-$1
+ mkdir test-$1
+ cd test-$1
+ mkdir test-db
+ cat <<EOF >test-db/test.hdb
+aa15bcf478d165efd2065190eb473bcb:544:ClamAV-Test-File
+EOF
+ cat <<EOF >test-clamd.conf
+LogFile `pwd`/clamd-test.log
+LogFileMaxSize 0
+LogTime yes
+Debug yes
+LogClean yes
+LogVerbose yes
+PidFile `pwd`/clamd-test.pid
+DatabaseDirectory `pwd`/test-db
+LocalSocket clamd-test.socket
+TCPAddr 127.0.0.1
+# using different port here to avoid conflicts with system clamd daemon
+TCPSocket 331$1
+ExitOnOOM yes
+DetectPUA yes
+ScanPDF yes
+CommandReadTimeout 1
+MaxQueue 800
+MaxConnectionQueueLength 1024
+EOF
+}
+
+# arg1: expected exitcode
+test_run() {
+ expected=$1
+ shift
+ set +e
+ $TOP/libtool --mode=execute $WRAPPER $*
+ val=$?
+ if test $val -ne $expected; then
+ error "Failed to run $*, expected $expected exitcode, but was $val" >&2;
+ return 0;
+ fi
+ set -e
+ return 1;
+}
+
+# Run a test and return its exitcode
+test_run_check() {
+ set +e
+ $TOP/libtool --mode=execute $WRAPPER $*
+ val=$?
+ set -e
+ return $?;
+}
+
+# test successfully finished, remove test dir
+test_end() {
+ killclamd
+ cd ..
+ rm -rf test-$1
+}
+
+scan_failed() {
+ if test "X$unrar_disabled" = "X1" && test `grep -v '\.rar' $1 | grep OK | wc -l` -eq 0
+ then
+ error "UNRAR is disabled, won't be able to detect unrar files!"
+ else
+ cat $1
+ die "$2";
+ fi
+}
+
+# ----------- valgrind wrapper
+init_valgrind() {
+ test "x$VG" = "x1" || { echo "*** valgrind tests skipped by default, use 'make check VG=1' to activate"; exit 77; }
+ export VALGRIND=`which ${VALGRIND-valgrind}`
+ export VALGRIND_COMMON_FLAGS="-v --trace-children=yes --suppressions=$abs_srcdir/valgrind.supp --log-file=valgrind.log --error-exitcode=123 $GENSUPP"
+ export VALGRIND_FLAGS="$VALGRIND_COMMON_FLAGS --track-fds=yes --leak-check=full"
+ export VALGRIND_FLAGS_RACE="$VALGRIND_COMMON_FLAGS --tool=helgrind"
+ test -n "$VALGRIND" || { echo "*** valgrind not found, skipping test"; exit 77; }
+ test -x "$VALGRIND" || { echo "*** valgrind not executable, skipping test"; exit 77; }
+}
+
+init_helgrind() {
+ init_valgrind
+}
+
+end_valgrind() {
+ NRUNS=`grep -a "ERROR SUMMARY" valgrind.log | wc -l`
+ if test $NRUNS -ne `grep -a "ERROR SUMMARY: 0 errors" valgrind.log | wc -l` ||
+ test `grep -a "FATAL:" valgrind.log|wc -l` -ne 0; then
+ cat valgrind.log
+ die "Valgrind tests failed"
+ fi
+}
+
+# ----------- clamscan tests --------------------------------------------------------
+test_clamscan() {
+ test_start $1
+ if test_run 1 $CLAMSCAN --quiet -dtest-db/test.hdb $TESTFILES --log=clamscan.log; then
+ scan_failed clamscan.log "clamscan didn't detect all testfiles correctly"
+ fi
+ NINFECTED=`grep "Infected files" clamscan.log | cut -f2 -d: | sed -e 's/ //g'`
+ if test "$NFILES" -ne "0$NINFECTED"; then
+ scan_failed clamscan.log "clamscan didn't detect all testfiles correctly"
+ fi
+
+ cat <<EOF >test-db/test.pdb
+H:example.com
+EOF
+ if test_run 0 $CLAMSCAN --quiet -dtest-db $abs_srcdir/input/phish-test-* --log=clamscan2.log; then
+ cat clamscan2.log;
+ die "Failed to run clamscan (phish-test)";
+ fi
+
+ if test_run 1 $CLAMSCAN --quiet --phishing-ssl --phishing-cloak -dtest-db $abs_srcdir/input/phish-test-* --log=clamscan3.log; then
+ cat clamscan3.log;
+ die "Failed to run clamscan (phish-test2)";
+ fi
+
+ grep "phish-test-ssl: Phishing.Heuristics.Email.SSL-Spoof FOUND" clamscan3.log >/dev/null || die "phish-test1 failed";
+ grep "phish-test-cloak: Phishing.Heuristics.Email.Cloaked.Null FOUND" clamscan3.log >/dev/null || die "phish-test2 failed";
+ test_end $1
+}
+
+# ----------- clamd tests --------------------------------------------------------
+start_clamd()
+{
+ cp $abs_srcdir/input/daily.pdb test-db/daily.pdb
+ if test_run 0 $CLAMD -c test-clamd.conf --help >clamd-test.log; then
+ die "Failed to run clamd --help";
+ fi
+ grep "Clam AntiVirus Daemon" clamd-test.log >/dev/null || die "Wrong --help reply from clamd!";
+ if test_run 0 $CLAMD -c test-clamd.conf >clamd-test.log 2>&1; then
+ cat clamd-test.log
+ die "Failed to run clamd";
+ fi
+}
+
+run_clamdscan_fileonly() {
+ rm -f clamdscan.log clamdscan-multiscan.log
+ $CLAMDSCAN --version --config-file=test-clamd.conf | grep "^ClamAV" >/dev/null || die "clamdscan can't get version of clamd!";
+ set +e
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* --log=clamdscan.log
+ if test $? = 2; then
+ die "Failed to run clamdscan!"
+ fi
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* -m --log=clamdscan-multiscan.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (multiscan)!"
+ fi
+ set -e
+}
+
+run_clamdscan() {
+ run_clamdscan_fileonly $*
+ rm -f clamdscan-fdpass.log clamdscan-multiscan-fdpass.log clamdscan-stream.log clamdscan-multiscan-stream.log
+ set +e
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* --fdpass --log=clamdscan-fdpass.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (fdpass)!"
+ fi
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* -m --fdpass --log=clamdscan-multiscan-fdpass.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (fdpass + multiscan)!"
+ fi
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* --stream --log=clamdscan-stream.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (instream)!"
+ fi
+ $CLAMDSCAN --quiet --config-file=test-clamd.conf $* -m --stream --log=clamdscan-multiscan-stream.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (instream + multiscan)!"
+ fi
+ set -e
+}
+
+run_reload_test()
+{
+ echo "ClamAV-RELOAD-Test" >reload-testfile
+ run_clamdscan reload-testfile
+ # it is not supposed to detect until we actually put the
+ # signature there and reload!
+ grep "ClamAV-RELOAD-TestFile" clamdscan.log >/dev/null 2>/dev/null && die "RELOAD test(1) failed!"
+ echo "ClamAV-RELOAD-TestFile:0:0:436c616d41562d52454c4f41442d54657374" >test-db/new.ndb
+ $CLAMDSCAN --reload --config-file=test-clamd.conf || die "clamdscan says reload failed!"
+ run_clamdscan reload-testfile
+ failed=0
+ grep "ClamAV-RELOAD-TestFile" clamdscan.log >/dev/null 2>/dev/null || die "RELOAD test failed! (after reload)"
+ grep "ClamAV-RELOAD-TestFile" clamdscan-multiscan.log >/dev/null 2>/dev/null || die "RELOAD test failed! (after reload, multiscan)"
+}
+
+run_clamdscan_fdpass() {
+ set +e
+ $CLAMDSCAN --quiet --fdpass --config-file=test-clamd.conf - <$1 --log=clamdscan.log
+ if test $? = 2; then
+ die "Failed to run clamdscan (fdpass)!"
+ fi
+ set -e
+}
+
+test_clamd1() {
+ test_start $1
+ start_clamd
+ # Test that all testfiles are detected
+ run_clamdscan $TESTFILES
+ NINFECTED=`grep "Infected files" clamdscan.log | cut -f2 -d:|sed -e 's/ //g'`
+ NINFECTED_MULTI=`grep "Infected files" clamdscan-multiscan.log | cut -f2 -d:|sed -e 's/ //g'`
+ NINFECTED_FDPASS=`grep "Infected files" clamdscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
+ NINFECTED_MULTI_FDPASS=`grep "Infected files" clamdscan-multiscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
+ NINFECTED_STREAM=`grep "Infected files" clamdscan-stream.log | cut -f2 -d:|sed -e 's/ //g'`
+ NINFECTED_MULTI_STREAM=`grep "Infected files" clamdscan-multiscan-stream.log | cut -f2 -d:|sed -e 's/ //g'`
+ if test "$NFILES" -ne "0$NINFECTED"; then
+ scan_failed clamdscan.log "clamd did not detect all testfiles correctly!"
+ fi
+ if test "$NFILES" -ne "0$NINFECTED_MULTI"; then
+ scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in multiscan mode!"
+ fi
+ if test "$NFILES" -ne "0$NINFECTED_FDPASS"; then
+ scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass mode!"
+ fi
+ if test "$NFILES" -ne "0$NINFECTED_MULTI_FDPASS"; then
+ scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass+multiscan mode!"
+ fi
+ # Test HeuristicScanPrecedence off feature
+ run_clamdscan ../clam-phish-exe
+ grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null;
+ if test $? -ne 0; then
+ cat clamdscan.log
+ die "HeuristicScanPrecedence off test failed!"
+ fi
+ test_end $1
+}
+
+test_clamd2() {
+ test_start $1
+ start_clamd
+ # Run clamd test suite
+ test_run_check $CHECK_CLAMD
+ val=$?
+
+ # Test RELOAD command
+ run_reload_test
+
+ test_end $1
+ exit $?
+}
+
+test_clamd3() {
+ test_start $1
+ echo "VirusEvent $abs_srcdir/virusaction-test.sh `pwd` \"Virus found: %v\"" >>test-clamd.conf
+ echo "HeuristicScanPrecedence yes" >>test-clamd.conf
+ start_clamd
+ # Test HeuristicScanPrecedence feature
+ run_clamdscan ../clam-phish-exe
+ grep "Phishing.Heuristics.Email.SpoofedDomain" clamdscan.log >/dev/null 2>/dev/null ||
+ { cat clamdscan.log; die "HeuristicScanPrecedence on test failed!"; }
+
+ if grep "^#define HAVE_FD_PASSING 1" $TOP/clamav-config.h >/dev/null; then
+ run_clamdscan_fdpass $TOP/test/clam.exe
+ grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null ||
+ { cat clamdscan.log; die "FDpassing test failed!";}
+ else
+ echo "*** No file descriptor passing support, skipping test"
+ fi
+
+ # Test VirusEvent feature
+ run_clamdscan_fileonly $TOP/test/clam.exe
+ test -f test-clamd.log || sleep 1
+ grep "Virus found: ClamAV-Test-File.UNOFFICIAL" test-clamd.log >/dev/null 2>/dev/null ||
+ { cat test-clamd.log || true; die "Virusaction test failed"; }
+
+ test_end $1
+}
diff --git a/unit_tests/test-clamd.conf b/unit_tests/test-clamd.conf
deleted file mode 100644
index a352cc1..0000000
--- a/unit_tests/test-clamd.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-# script will fill in CWD and X
-LogFile CWD/../clamd-testX.log
-LogFileMaxSize 0
-LogTime yes
-Debug yes
-LogClean yes
-LogVerbose yes
-PidFile CWD/clamd-test.pid
-DatabaseDirectory CWD/test-db
-LocalSocket clamd-test.socket
-TCPAddr 127.0.0.1
-# using different port here to avoid conflicts with system clamd daemon
-TCPSocket 331X
-ExitOnOOM yes
-DetectPUA yes
-ScanPDF yes
-CommandReadTimeout 1
-MaxQueue 800
-MaxConnectionQueueLength 1024
diff --git a/unit_tests/valgrind.supp b/unit_tests/valgrind.supp
index 76f7da3..e69de29 100644
--- a/unit_tests/valgrind.supp
+++ b/unit_tests/valgrind.supp
@@ -1,343 +0,0 @@
-{
- glibc-freeres-dbg
- Memcheck:Free
- fun:free
- fun:free_mem
- fun:__libc_freeres
-}
-{
- glibc-freeres
- Memcheck:Free
- fun:free
- obj:/lib*/libc-*.so
- fun:__libc_freeres
-}
-{
- glibc-etch1
- Memcheck:Free
- fun:*
- fun:_dl_allocate_tls
-}
-{
- glibc-etch2
- Memcheck:Free
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
-}
-{
- glibc-etch1
- Memcheck:Free
- fun:*
- fun:_dl_allocate_tls
-}
-{
- glibc-etch2
- Memcheck:Addr8
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
-}
-{
- glibc-etch2
- Memcheck:Addr4
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
-}
-{
- helgrind-glibc27-dbg01
- Helgrind:Race
- fun:mythread_wrapper
- fun:start_thread
-}
-{
- helgrind-glibc27-dbg02
- Helgrind:Race
- fun:pthread_mutex_*
-}
-{
- helgrind-glibc27-dbg03
- Helgrind:Race
- fun:pthread_create*
-}
-{
- helgrind-glibc27-dbg04
- Helgrind:Race
- fun:pthread_create*
-}
-{
- helgrind-glibc27-dbg05
- Helgrind:Race
- fun:__deallocate_stack
- fun:start_thread
-}
-{
- helgrind-glibc27-dbg05
- Helgrind:Race
- fun:free_stacks
- fun:__deallocate_stack
- fun:start_thread
-}
-{
- helgrind-glibc27-dbg06
- Helgrind:Race
- fun:*
- obj:/usr/lib/debug/libpthread-*.so
-}
-{
- helgrind-glibc27-dbg06
- Helgrind:Race
- fun:*
- obj:/lib/libpthread-*.so
-}
-{
- helgrind-glibc27-dbg08
- Helgrind:Race
- obj:/lib/ld-*.so
-}
-{
- helgrind-glibc27-dbg09
- Helgrind:Race
- fun:*
- fun:exit
-}
-{
- helgrind-glibc27-dbg10
- Helgrind:Race
- fun:*
- fun:*
- fun:exit
-}
-{
- helgrind-glibc27-dbg11
- Helgrind:Race
- fun:*
- fun:*
- fun:*
- fun:exit
-}
-{
- helgrind-glibc27-dbg12
- Helgrind:Race
- fun:*
- fun:*
- fun:*
- fun:*
- fun:exit
-}
-{
- helgrind-glibc27-dbg13
- Helgrind:Race
- fun:*
- fun:*
- fun:ctime_r
-}
-{
- helgrind-glibc27-dbg15
- Helgrind:Race
- fun:*
- fun:*
- fun:*
- fun:ctime_r
-}
-{
- helgrind-glibc27-dbg14
- Helgrind:Race
- fun:_IO_link_in
- fun:_IO_file_init*
-}
-# libc has a gconv_lock, but valgrind doesn't know that because it uses lll_lock
-# instead of pthread_mutex_lock
-{
- helgrind-glibc27-dbg15
- Helgrind:Race
- fun:__gconv_release_shlib
-}
-{
- helgrind-glibc27-dbg16
- Helgrind:Race
- fun:__gconv_find_shlib
-}
-{
- helgrind-glibc27-dbg17
- Helgrind:Race
- fun:exit
-}
-
-{
-# suppress false positives, see bb 1189
- chm-etch-gcc41-fp
- Memcheck:Cond
- fun:cli_chm_open
- fun:cli_scanmschm
-}
-{
- glibc-etch
- Memcheck:Leak
- fun:*
- fun:_dl_allocate_tls
-}
-{
- glibc-suse
- Memcheck:Leak
- fun:*
- obj:*
- fun:_dl_allocate_tls
-}
-{
- glibc-tls3
- Memcheck:Leak
- fun:*
- fun:allocate_dtv
- fun:_dl_allocate_tls
-}
-{
- glibc-tls4
- Memcheck:Leak
- fun:allocate_dtv
- fun:_dl_allocate_tls
-}
-# glibc uses IO_lock_lock, which uses lll_lock,
-# and valgrind doesn't know about it, so it thinks it is unlocked
-{
- glibc-IOlock-fp
- Helgrind:Race
- fun:*
- fun:*
- fun:fputs
-}
-{
- glibc-IOlock-fp
- Helgrind:Race
- fun:fputs
-}
-{
- glibc-fork
- Helgrind:Race
- fun:fork
-}
-{
- glibc-fork
- Helgrind:Race
- fun:*
- fun:fork
-}
-{
- glibc-freetcb
- Helgrind:Race
- fun:__free_tcb
-}
-{
- glibc-2.5-strcpy_chk
- Memcheck:Addr8
- obj:/lib64/libc-2.5.so
- fun:decodeLine
-}
-{
- glibc-2.5-strcpy_chk
- Memcheck:Cond
- obj:/lib64/libc-2.5.so
- fun:decodeLine
-}
-{
- glibc-2.5-strcpy_chk
- Memcheck:Cond
- obj:/lib64/libc-2.5.so
- fun:cli_mbox
-}
-{
- glibc-2.8-lll
- Helgrind:Race
- fun:__lll_unlock_wake
-}
-{
- glibc-freeres
- Helgrind:Race
- fun: *
- fun: __libc_thread_freeres
-}
-{
- glibc-poll
- Helgrind:Race
- fun: __libc_enable_asynccancel
- fun: poll
-}
-{
- glibc-poll
- Helgrind:Race
- fun: _setjmp
- fun: clone
-}
-{
- glibc-ubuntu-jaunty
- Helgrind:Race
- fun:__fprintf_chk
-}
-# no symbols in opensuse's libs :(
-{
- glibc-suse
- Helgrind:Race
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
-}
-{
- glibc-suse2
- Helgrind:Race
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
- obj:/lib*/ld-*.so
-}
-{
- glibc-suse4
- Helgrind:Race
- obj:/lib*/libc-*.so
- obj:/lib*/libc-*.so
- obj:/lib*/libc-*.so
-}
-{
- glibc-suse3
- Helgrind:Race
- obj:*
- fun:start_thread
-}
-{
- helgrind-glibc2X-005-valgrind-3.4.0
- Helgrind:Race
- obj:/lib*/libpthread-2.*so*
-}
-{
- debian-libc-dbg
- Helgrind:Race
- fun:__pthread_mutex_*
-}
-{
- debian-libc-dbg
- Helgrind:Race
- fun:pthread_create@*
-}
-{
- debian-libc-dbg
- Helgrind:Race
- fun:close
-}
-{
- debian-libc-dbg
- Helgrind:Race
- obj:/usr/lib*/debug/libpthread-2.*so*
-}
-{
- sighandler-no-mutex
- Helgrind:Race
- fun:sighandler_th
-}
-{
- sighandler-no-mutex
- Helgrind:Race
- fun:recvloop_th
-}
-#{
-# helgrind-glibc27-dbg18
-# Helgrind:Race
-# fun:__reclaim_stacks
-# fun:fork
-#}
diff --git a/unit_tests/valgrind_tests.sh b/unit_tests/valgrind_tests.sh
index f9fc318..9d00b2f 100755
--- a/unit_tests/valgrind_tests.sh
+++ b/unit_tests/valgrind_tests.sh
@@ -17,12 +17,13 @@ parse_valgrindlog()
if test ! -f $1; then
echo "*** Logfile $1 not found. Valgrind failed to run?"
fi
- NRUNS=`grep "ERROR SUMMARY" $1 | wc -l`
- if test $NRUNS -eq `grep "ERROR SUMMARY: 0 errors" $1 | wc -l` && test `grep "FATAL:" $1|wc -l ` -eq 0; then
+ NRUNS=`grep -a "ERROR SUMMARY" $1 | wc -l`
+ if test $NRUNS -eq `grep -a "ERROR SUMMARY: 0 errors" $1 | wc -l` && test `grep -a "FATAL:" $1|wc -l ` -eq 0; then
if test "$1" = "valgrind-race.log" ||
test $NRUNS -eq `grep "no leaks are possible" $1 | wc -l` ||
test `grep "lost:" $1 | grep -v " 0 bytes" | wc -l` -eq 0; then
if test -z "$GENSUPP"; then
+ cp $1 /tmp
rm -f $1;
fi
return
@@ -62,24 +63,40 @@ else
GENSUPP=
fi
-VALGRIND_COMMON_FLAGS="-v --trace-children=yes --suppressions=$abs_srcdir/valgrind.supp $GENSUPP"
+VALGRIND_COMMON_FLAGS="-v --trace-children=yes --suppressions=$abs_srcdir/valgrind.supp --error-exitcode=123 $GENSUPP"
VALGRIND_FLAGS="$VALGRIND_COMMON_FLAGS --track-fds=yes --leak-check=full"
VALGRIND_FLAGS_RACE="$VALGRIND_COMMON_FLAGS --tool=helgrind"
export CK_DEFAULT_TIMEOUT=40
echo "--- Starting check_clamav under valgrind/memcheck"
rm -f valgrind-check.log valgrind-clamd.log valgrind-race.log
-CK_FORK=no ../libtool --mode=execute $VALGRIND $VALGRIND_FLAGS ./check_clamav >valgrind-check.log 2>&1 &
+CK_FORK=no ../libtool --mode=execute $VALGRIND $VALGRIND_FLAGS --log-file=valgrind-check.log ./check_clamav &
pid1=$!
echo "--- Starting clamd under valgrind/memcheck"
-CLAMD_WRAPPER="$VALGRIND $VALGRIND_FLAGS" $abs_srcdir/check_clamd.sh >valgrind-clamd.log 2>&1 &
+CLAMD_WRAPPER="$VALGRIND $VALGRIND_FLAGS --log-file=`pwd`/valgrind-clamd.log" $abs_srcdir/check_clamd.sh &
pid2=$!
echo "--- Starting clamd under valgrind/helgrind"
-CLAMD_TEST_UNIQ1=3 CLAMD_TEST_UNIQ2=4 CLAMD_WRAPPER="$VALGRIND $VALGRIND_FLAGS_RACE" $abs_srcdir/check_clamd.sh >valgrind-race.log 2>&1 &
+CLAMD_TEST_UNIQ1=3 CLAMD_TEST_UNIQ2=4 CLAMD_WRAPPER="$VALGRIND $VALGRIND_FLAGS_RACE --log-file=`pwd`/valgrind-race.log" $abs_srcdir/check_clamd.sh &
pid3=$!
-wait $pid1 $pid2 $pid3
+errors=0
+wait $pid1
+if test $? -ne 0; then
+ # don't rm logs
+ GENSUPP=1
+ errors=1
+fi
+wait $pid2
+if test $? -ne 0; then
+ GENSUPP=1
+ errors=1
+fi
+wait $pid3
+if test $? -ne 0; then
+ GENSUPP=1
+ errors=1
+fi
parse_valgrindlog valgrind-check.log
parse_valgrindlog valgrind-clamd.log
parse_valgrindlog valgrind-race.log
@@ -87,4 +104,4 @@ parse_valgrindlog valgrind-race.log
if test -f valgrind-check.log || test -f valgrind-race.log || test -f valgrind-clamd.log; then
exit 1;
fi
-exit 0
+exit $errors
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list