2 # Yes, that's POSIX sh, not bash!
6 # Create a one-meg device
7 dd if=/dev/zero of=$tmpnam bs=1024 count=1024
13 # Test with export specified on command line
14 ./nbd-server -C /dev/null -p `pwd`/nbd-server.pid 11111 $tmpnam &
15 # -p only works if nbd-server wasn't compiled with -DNOFORK or
16 # -DNODAEMON, which I sometimes do for testing and debugging.
19 ./nbd-tester-client 127.0.0.1 11111
24 # Test with export specified in config file
25 cat > nbd-server.conf <<EOF
31 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
34 ./nbd-tester-client 127.0.0.1 11112
38 # Test with multiple exports specified in config file, and
39 # testing more options too
40 cat >nbd-server.conf <<EOF
46 listenaddr = 127.0.0.1
52 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
55 ./nbd-tester-client localhost 11113
59 if [ -f nbd-server.pid ]
61 kill `cat nbd-server.pid`
66 rm -f $tmpnam nbd-server.conf
69 ./nbd-tester-client localhost 11114
73 echo "E: unknown test $1"
77 if [ -f nbd-server.pid ]
79 kill `cat nbd-server.pid`
88 rm -f $tmpnam nbd-server.conf