2 # Yes, that's POSIX sh, not bash!
8 # Create a one-meg device
9 dd if=/dev/zero of=$tmpnam bs=1024 count=1024
15 # Test with export specified on command line
16 ./nbd-server -C /dev/null -p `pwd`/nbd-server.pid 11111 $tmpnam &
17 # -p only works if nbd-server wasn't compiled with -DNOFORK or
18 # -DNODAEMON, which I sometimes do for testing and debugging.
21 ./nbd-tester-client 127.0.0.1 11111
26 # Test with export specified in config file
27 cat > nbd-server.conf <<EOF
34 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
37 ./nbd-tester-client 127.0.0.1 11112
41 # Test with multiple exports specified in config file, and
42 # testing more options too
43 cat >nbd-server.conf <<EOF
50 listenaddr = 127.0.0.1
55 listenaddr = 127.0.0.1
57 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
60 ./nbd-tester-client localhost 11113
64 if [ -f nbd-server.pid ]
66 kill `cat nbd-server.pid`
73 rm -f $tmpnam nbd-server.conf
77 ./nbd-tester-client localhost 11114
81 # Test new-style exports
82 cat >nbd-server.conf <<EOF
87 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
90 ./nbd-tester-client localhost -N export1
94 echo "E: unknown test $1"
98 if [ -f nbd-server.pid ]
100 kill `cat nbd-server.pid`
107 rm -f $tmpnam nbd-server.conf