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
32 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
35 ./nbd-tester-client 127.0.0.1 11112
39 # Test with multiple exports specified in config file, and
40 # testing more options too
41 cat >nbd-server.conf <<EOF
48 listenaddr = 127.0.0.1
54 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
57 ./nbd-tester-client localhost 11113
61 if [ -f nbd-server.pid ]
63 kill `cat nbd-server.pid`
68 rm -f $tmpnam nbd-server.conf
71 ./nbd-tester-client localhost 11114
75 # Test new-style exports
76 cat >nbd-server.conf <<EOF
81 listenaddr = 127.0.0.1
86 ./nbd-server -C nbd-server.conf -p `pwd`/nbd-server.pid &
89 ./nbd-tester-client localhost -N export1
93 if [ -f nbd-server.pid ]
95 kill `cat nbd-server.pid`
100 rm -f $tmpnam nbd-server.conf
103 ./nbd-tester-client localhost -N export2
107 echo "E: unknown test $1"
111 if [ -f nbd-server.pid ]
113 kill `cat nbd-server.pid`
122 rm -f $tmpnam nbd-server.conf