2 # Yes, that's POSIX sh, not bash!
8 # Create a one-meg device
9 dd if=/dev/zero of=$tmpnam bs=1024 count=4096 >/dev/null 2>&1
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
25 # Test oversized requests
26 ./nbd-server -C /dev/null -p `pwd`/nbd-server.pid 11111 $tmpnam &
27 # -p only works if nbd-server wasn't compiled with -DNOFORK or
28 # -DNODAEMON, which I sometimes do for testing and debugging.
31 ./nbd-tester-client 127.0.0.1 11111 -o
35 # Test with export specified in config file
36 cat > nbd-server.conf <<EOF
43 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
46 ./nbd-tester-client 127.0.0.1 11112
50 # Test with multiple exports specified in config file, and
51 # testing more options too
52 cat >nbd-server.conf <<EOF
59 listenaddr = 127.0.0.1
64 listenaddr = 127.0.0.1
66 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
69 ./nbd-tester-client localhost 11113
73 if [ -f nbd-server.pid ]
75 kill `cat nbd-server.pid`
82 rm -f $tmpnam nbd-server.conf
86 ./nbd-tester-client localhost 11114
90 # Test new-style exports
91 cat >nbd-server.conf <<EOF
96 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
99 ./nbd-tester-client localhost -N export1
103 # Test new-style exports
104 cat >nbd-server.conf <<EOF
109 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
112 ./nbd-tester-client localhost -N export1 -w
116 # Test new-style exports
117 cat >nbd-server.conf <<EOF
122 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
125 ./nbd-tester-client localhost -N export1 -w -f
129 echo "E: unknown test $1"
133 if [ -f nbd-server.pid ]
135 kill `cat nbd-server.pid`
142 rm -f $tmpnam nbd-server.conf