Commit 2c594d9b authored by Jelte Jansen's avatar Jelte Jansen
Browse files

set of fixes in makefiles and test scripts, mostly about reading from src vs...

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
parent e23b9614
......@@ -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
......
......@@ -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
......@@ -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"
......
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):
......
......@@ -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
......@@ -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
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
cd ${LOADZONE_PATH}/tests/error
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment