From 61456ddf98236fbc59e615da047e45d2bd2a6387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 15 Oct 2013 22:53:30 +0200 Subject: [PATCH] Finish the migration to C TAP Harness by making make distcheck happy --- Makefile.am | 1 - src/zscanner/tests/Makefile.inc | 9 +++++++++ src/zscanner/tests/zscanner | 19 ++++++++----------- tests/Makefile.inc | 23 ++++++++--------------- tests/conf.c | 2 +- resource.sh => tests/resource.sh | 4 ++-- tests/sample_conf.h | 2 ++ 7 files changed, 30 insertions(+), 30 deletions(-) rename resource.sh => tests/resource.sh (89%) create mode 100644 tests/sample_conf.h diff --git a/Makefile.am b/Makefile.am index 3d6285ae6..e5524961b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,4 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src samples doc man -EXTRA_DIST = resource.sh include $(srcdir)/tests/Makefile.inc diff --git a/src/zscanner/tests/Makefile.inc b/src/zscanner/tests/Makefile.inc index 7d1ae55c0..97b6426bf 100644 --- a/src/zscanner/tests/Makefile.inc +++ b/src/zscanner/tests/Makefile.inc @@ -3,6 +3,9 @@ check_PROGRAMS = \ tests/runtests \ tests/zscanner-tool +dist_check_SCRIPTS = \ + tests/zscanner + check_LIBRARIES = tests/tap/libtap.a AM_CPPFLAGS = \ @@ -31,3 +34,9 @@ tests_zscanner_tool_SOURCES = \ tests/processing.c tests_zscanner_tool_LDADD = libzscanner.la @LIBOBJS@ + +EXTRA_DIST += \ + tests/TESTS \ + tests/zscanner-TESTS \ + tests/data \ + tests/tap/libtap.sh diff --git a/src/zscanner/tests/zscanner b/src/zscanner/tests/zscanner index 88bb4fbbb..4b502d5f4 100755 --- a/src/zscanner/tests/zscanner +++ b/src/zscanner/tests/zscanner @@ -7,11 +7,11 @@ TMPDIR=$(test_tmpdir) TESTS_DIR="$SOURCE"/data ZSCANNER_TOOL="$BUILD"/zscanner-tool -plan_lazy +plan 65 -mkdir "$TMPDIR"/includes/ +mkdir -p "$TMPDIR"/includes/ for a in 1 2 3 4 5 6; do - cp -a "$TESTS_DIR"/includes/include"$a" "$TMPDIR"/includes/; + cat "$TESTS_DIR"/includes/include"$a" > "$TMPDIR"/includes/include"$a"; done for case in $(cat "$SOURCE"/zscanner-TESTS); do @@ -21,21 +21,18 @@ for case in $(cat "$SOURCE"/zscanner-TESTS); do fileout="$TMPDIR"/"$case".out sed -e "s|@BUILD@|$BUILD|;s|@SOURCE@|$SOURCE|;" < "$casein" > "$filein" + diag $(ls "$filein") "$ZSCANNER_TOOL" -m 2 . "$filein" > "$fileout" - ZSCANNER_RET=$? - - if [ "$?" -ne 0 ]; then - ok "$case: zscanner-tool run" false - skip - fi - ok "$case: zscanner-tool" true - if cmp -s "$fileout" "$caseout"; then ok "$case: output matches" true + rm "$filein" + rm "$fileout" else ok "$case: output differs" false diff -urNap "$caseout" "$fileout" | while read line; do diag "$line"; done fi done + +rm -rf "$TMPDIR"/includes/ diff --git a/tests/Makefile.inc b/tests/Makefile.inc index 810cf14dd..c5d8d17db 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -34,7 +34,7 @@ tests_runtests_CPPFLAGS = \ -DSOURCE='"$(abs_top_srcdir)/tests"' \ -DBUILD='"$(abs_top_builddir)/tests"' -tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/t +tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests tests_tap_libtap_a_SOURCES = \ tests/tap/basic.c tests/tap/basic.h \ tests/tap/float.c tests/tap/float.h \ @@ -48,20 +48,13 @@ LDADD = \ src/libknotd.la src/libknots.la \ @LIBOBJS@ -EXTRA_DIST += \ - tests/data/sample_conf +tests_conf_SOURCES = tests/conf.c tests/sample_conf.h +nodist_tests_conf_SOURCES = tests/sample_conf.c +CLEANFILES = tests/sample_conf.c -BUILT_SOURCES = \ - tests/sample_conf.rc +EXTRA_DIST = tests/data tests/TESTS -CLEANFILES = \ - tests/sample_conf.rc +dist_check_SCRIPTS = tests/resource.sh -tests_conf_SOURCES = \ - tests/conf.c - -nodist_tests_conf_SOURCES = \ - tests/sample_conf.rc - -tests/sample_conf.rc: tests/data/sample_conf - $(top_srcdir)/resource.sh $< >$@ +tests/sample_conf.c: tests/data/sample_conf + $(abs_top_srcdir)/tests/resource.sh $< >$@ diff --git a/tests/conf.c b/tests/conf.c index 0ed66f142..a48f7292a 100644 --- a/tests/conf.c +++ b/tests/conf.c @@ -21,7 +21,7 @@ #include "knot/conf/conf.h" /* Resources. */ -#include "sample_conf.rc" +#include "tests/sample_conf.h" /*! Run all scheduled tests for given parameters. */ diff --git a/resource.sh b/tests/resource.sh similarity index 89% rename from resource.sh rename to tests/resource.sh index 277d95d9c..497dfb8f5 100755 --- a/resource.sh +++ b/tests/resource.sh @@ -23,8 +23,8 @@ size=$(wc -c "${1}" | awk '{print $1}' 2>/dev/null) dump=$(${hd} "${fmt}" "${1}" 2>/dev/null) # Format file size variable -echo "static const unsigned ${header}_size = ${size};" +echo "const unsigned ${header}_size = ${size};" # Format file content dump -echo "static const char ${header}[] = { " +echo "const char ${header}[] = { " echo "${dump}0x00 };" diff --git a/tests/sample_conf.h b/tests/sample_conf.h new file mode 100644 index 000000000..4630ced73 --- /dev/null +++ b/tests/sample_conf.h @@ -0,0 +1,2 @@ +extern const unsigned sample_conf_rc_size; +extern const char sample_conf_rc[];