#!/bin/sh

(
    cd bin
    [ -f nsd76 ] || ln -s $SRCBASE/root/bin/nsd76 .
    [ -f nsd82 ] || ln -s $SRCBASE/root/bin/nsd82 .
    [ -f nssock.so ] || ln -s $SRCBASE/root/bin/nssock.so .
    [ -f dqd_utils7.so ] || ln -s ../../dqd_utils7.so .
    [ -f dqd_utils8.so ] || ln -s ../../dqd_utils8.so .
)

run_test () {
    if wget -o /dev/null -O /dev/null "http://localhost:8123/test_$test"; then
	echo "ok $test"
    else
	echo "not ok $test"
    fi
}

run_tests () {
    for test in md5 unlist nssetToList detach detach; do
	run_test $test
    done
}

echo "nsd76"
bin/nsd76 -ikt nsd.tcl 2>&1 &
sleep 1
run_tests
bin/nsd76 -Kt nsd.tcl
sleep 1

echo "nsd82"
bin/nsd82 -ikt nsd.tcl 2>&1 &
sleep 1
run_tests
bin/nsd76 -Kt nsd.tcl
sleep 1

