1# #-- 04-checkconf.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8# test that failed exit code is used 9$PRE/unbound-checkconf bla bla bla>/dev/null 10if test $? != 1; then 11 echo "exit code for usage wrong" 12 exit 1 13fi 14$PRE/unbound-checkconf -h >/dev/null 15if test $? != 1; then 16 echo "exit code for usage wrong" 17 exit 1 18fi 19$PRE/unbound-checkconf notexist_file 20if test $? != 1; then 21 echo "exit code for nofile wrong" 22 exit 1 23fi 24 25# detect windows 26if grep "define UB_ON_WINDOWS 1" ../../config.h; then 27 onwin=1 28else 29 onwin=0 30fi 31 32# test check of config files. 33for f in bad.*; do 34 echo 35 echo $PRE/unbound-checkconf $f 36 if test $f = "bad.user" -a $onwin -eq 1; then 37 echo "skipped on windows" 38 continue 39 fi 40 41 $PRE/unbound-checkconf $f 42 if test $? != 1; then 43 echo "exit code case $f wrong" 44 exit 1 45 fi 46done 47for f in good.*; do 48 echo 49 echo $PRE/unbound-checkconf $f 50 $PRE/unbound-checkconf $f 51 if test $? != 0; then 52 echo "exit code case $f wrong" 53 exit 1 54 fi 55done 56 57echo $PRE/unbound-checkconf warn.algo 58$PRE/unbound-checkconf warn.algo > outfile 2>&1 59if test $? != 0; then 60 cat outfile 61 echo "wrong exit code, warning should not fail with error" 62 exit 1 63fi 64cat outfile 65if grep "unsupported algo" outfile; then 66 echo "OK" 67else 68 echo "Failed, should print warning" 69 exit 1 70fi 71 72exit 0 73