From 2c594d9b4d69a3e6616b678ddcd9b322e9a007fb Mon Sep 17 00:00:00 2001 From: Jelte Jansen Date: Wed, 30 Jun 2010 10:37:40 +0000 Subject: [PATCH] set of fixes in makefiles and test scripts, mostly about reading from src vs build for generated/nongenerated files, and putting temporary test output files under the build tree instead of the source tree, as well as a few environment variables. git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2344 e5f2f494-b856-4b98-b285-d166d9295462 --- src/bin/loadzone/Makefile.am | 2 +- src/bin/loadzone/tests/correct/Makefile.am | 5 ++- .../loadzone/tests/correct/correct_test.sh.in | 31 +++++++++------- .../loadzone/tests/correct/get_zonedatas.py | 2 +- src/bin/loadzone/tests/error/Makefile.am | 4 +- src/bin/loadzone/tests/error/error_test.sh.in | 37 +++++++++++-------- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/bin/loadzone/Makefile.am b/src/bin/loadzone/Makefile.am index 7895f65f4a..777ebb25d9 100644 --- a/src/bin/loadzone/Makefile.am +++ b/src/bin/loadzone/Makefile.am @@ -25,7 +25,7 @@ install-data-local: # TODO: permissions handled later EXTRA_DIST += tests/normal/README -EXTRA_DIST += tests/normal/dsset-subzone.example.com. +EXTRA_DIST += tests/normal/dsset-subzone.example.com EXTRA_DIST += tests/normal/example.com EXTRA_DIST += tests/normal/example.com.signed EXTRA_DIST += tests/normal/Kexample.com.+005+04456.key diff --git a/src/bin/loadzone/tests/correct/Makefile.am b/src/bin/loadzone/tests/correct/Makefile.am index fb146275a0..213d089191 100644 --- a/src/bin/loadzone/tests/correct/Makefile.am +++ b/src/bin/loadzone/tests/correct/Makefile.am @@ -12,6 +12,7 @@ EXTRA_DIST += mix2sub2.txt EXTRA_DIST += ttl1.db EXTRA_DIST += ttl2.db EXTRA_DIST += ttlext.db +EXTRA_DIST += example.db # later will have configure option to choose this, like: coverage run --branch PYCOVERAGE = $(PYTHON) @@ -19,6 +20,6 @@ PYCOVERAGE = $(PYTHON) check-local: for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/bin/loadzone \ - $(SHELL) $(abs_srcdir)/$$pytest ; \ + env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/loadzone \ + $(SHELL) $(abs_builddir)/$$pytest ; \ done diff --git a/src/bin/loadzone/tests/correct/correct_test.sh.in b/src/bin/loadzone/tests/correct/correct_test.sh.in index ebd6993cca..509d8e5f13 100644 --- a/src/bin/loadzone/tests/correct/correct_test.sh.in +++ b/src/bin/loadzone/tests/correct/correct_test.sh.in @@ -18,32 +18,35 @@ PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@} export PYTHON_EXEC -PYTHONPATH=@abs_top_builddir@/src/lib/python +PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python export PYTHONPATH -LOADZONE_PATH=@abs_top_srcdir@/src/bin/loadzone +LOADZONE_PATH=@abs_top_builddir@/src/bin/loadzone +TEST_FILE_PATH=@abs_top_srcdir@/src/bin/loadzone/tests/correct +TEST_OUTPUT_PATH=@abs_top_builddir@/src/bin/loadzone//tests/correct + status=0 echo "Loadzone include. from include.db file" -cd ${LOADZONE_PATH}/tests/correct -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 include.db >> /dev/null +cd ${TEST_FILE_PATH} +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 include.db >> /dev/null echo "loadzone ttl1. from ttl1.db file" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ttl1.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 ttl1.db >> /dev/null echo "loadzone ttl2. from ttl2.db file" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ttl2.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 ttl2.db >> /dev/null echo "loadzone mix1. from mix1.db" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 mix1.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 mix1.db >> /dev/null echo "loadzone mix2. from mix2.db" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 mix2.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 mix2.db >> /dev/null echo "loadzone ttlext. from ttlext.db" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ttlext.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 ttlext.db >> /dev/null echo "loadzone example.com. from example.db" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 example.db >> /dev/null +${LOADZONE_PATH}/b10-loadzone -d ${TEST_OUTPUT_PATH}/zone.sqlite3 example.db >> /dev/null echo "I:test master file \$INCLUDE semantics" echo "I:test master file BIND 8 compatibility TTL and \$TTL semantics" @@ -53,13 +56,13 @@ echo "I:test master file RFC1035 TTL and mixed \$INCLUDE with \$TTL semantics" echo "I:test master file BIND9 extenstion of TTL" echo "I:test master file RFC1035 missing CLASS, TTL, NAME semantics" -${PYTHON_EXEC} get_zonedatas.py > test.out +${PYTHON_EXEC} ${TEST_FILE_PATH}/get_zonedatas.py ${TEST_OUTPUT_PATH}/zone.sqlite3 > ${TEST_OUTPUT_PATH}/test.out echo "Compare test results." -diff test.out known.test.out || status=1 +diff ${TEST_OUTPUT_PATH}/test.out ${TEST_FILE_PATH}/known.test.out || status=1 echo "Clean tmp files." -rm -f zone.sqlite3 -rm -f test.out +rm -f ${TEST_OUTPUT_PATH}/zone.sqlite3 +rm -f ${TEST_OUTPUT_PATH}/test.out echo "I:exit status: $status" echo "------------------------------------------------------------------------------" echo "Ran 7 test files" diff --git a/src/bin/loadzone/tests/correct/get_zonedatas.py b/src/bin/loadzone/tests/correct/get_zonedatas.py index de629f2a10..faa563449c 100644 --- a/src/bin/loadzone/tests/correct/get_zonedatas.py +++ b/src/bin/loadzone/tests/correct/get_zonedatas.py @@ -1,6 +1,6 @@ from isc.datasrc import sqlite3_ds import sys -ZONE_FILE = "zone.sqlite3" +ZONE_FILE = sys.argv[1] zonename_set = ["include.", "ttl1.", "ttl2.", "mix1.", "mix2.", "ttlext.", "example.com."] for zone_name in zonename_set: for rr_data in sqlite3_ds.get_zone_datas(zone_name, ZONE_FILE): diff --git a/src/bin/loadzone/tests/error/Makefile.am b/src/bin/loadzone/tests/error/Makefile.am index 2ce860cd16..427260d1c0 100644 --- a/src/bin/loadzone/tests/error/Makefile.am +++ b/src/bin/loadzone/tests/error/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST += include.txt EXTRA_DIST += keyerror1.db EXTRA_DIST += keyerror2.db EXTRA_DIST += keyerror3.db -EXTRA_DIST += nofilenane.db +#EXTRA_DIST += nofilenane.db EXTRA_DIST += originerr1.db EXTRA_DIST += originerr2.db @@ -21,5 +21,5 @@ check-local: for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/bin/loadzone \ - $(SHELL) $(abs_srcdir)/$$pytest ; \ + $(SHELL) $(abs_builddir)/$$pytest ; \ done diff --git a/src/bin/loadzone/tests/error/error_test.sh.in b/src/bin/loadzone/tests/error/error_test.sh.in index ff1872ca59..d1d6bd1837 100644 --- a/src/bin/loadzone/tests/error/error_test.sh.in +++ b/src/bin/loadzone/tests/error/error_test.sh.in @@ -18,46 +18,53 @@ PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@} export PYTHON_EXEC -PYTHONPATH=@abs_top_builddir@/src/lib/python +PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python export PYTHONPATH -LOADZONE_PATH=@abs_top_srcdir@/src/bin/loadzone -export LOADZONE_PATH -status=0 +LOADZONE_PATH=@abs_top_builddir@/src/bin/loadzone +TEST_OUTPUT_PATH=@abs_top_builddir@/src/bin/loadzone/tests/error +TEST_FILE_PATH=@abs_top_srcdir@/src/bin/loadzone/tests/error + cd ${LOADZONE_PATH}/tests/error +export LOADZONE_PATH +status=0 + +echo "PYTHON PATH: $PYTHONPATH" + echo "Test no \$ORIGIN error in zone file" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 originerr1.db 1> /dev/null 2> error.out -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 originerr2.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/originerr1.db 1> /dev/null 2> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/originerr2.db 1> /dev/null 2>> error.out echo "Test: key word TTL spell error" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 keyerror1.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/keyerror1.db 1> /dev/null 2>> error.out echo "Test: key word ORIGIN spell error" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 keyerror2.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/keyerror2.db 1> /dev/null 2>> error.out echo "Test: key INCLUDE spell error" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 keyerror3.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/keyerror3.db 1> /dev/null 2>> error.out echo "Test: include formal error, miss filename" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 formerr1.db 1> /dev/null 2>>error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/formerr1.db 1> /dev/null 2>>error.out echo "Test: include form error, domain is not absolute" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 formerr2.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/formerr2.db 1> /dev/null 2>> error.out echo "Test: TTL form error, no ttl value" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 formerr3.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/formerr3.db 1> /dev/null 2>> error.out echo "Test: TTL form error, ttl value error" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 formerr4.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/formerr4.db 1> /dev/null 2>> error.out echo "Test: rr form error, no type" -${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 formerr5.db 1> /dev/null 2>> error.out +${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 ${TEST_FILE_PATH}/formerr5.db 1> /dev/null 2>> error.out echo "Test: zone file is bogus" +# since bogusfile doesn't exist anyway, we *don't* specify the directory ${LOADZONE_PATH}/b10-loadzone -d zone.sqlite3 bogusfile 1> /dev/null 2>> error.out -diff error.out error.known || status=1 +diff error.out ${TEST_FILE_PATH}/error.known || status=1 echo "Clean tmp file." rm -f error.out