tests: Skip guestfs code on CentOS 6
[nbdkit/ericb.git] / tests / test-shebang-ruby.sh
blobe8d9c89ddf839d9060153bbef52efe78d3a4db2b
1 #!/bin/bash -
2 # nbdkit
3 # Copyright (C) 2017 Red Hat Inc.
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
8 # met:
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # * Neither the name of Red Hat nor the names of its contributors may be
18 # used to endorse or promote products derived from this software without
19 # specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
22 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
25 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # SUCH DAMAGE.
34 pidfile=shebang-ruby.pid
35 sockfile=shebang-ruby.sock
36 script=./shebang.rb
38 rm -f $pidfile $sockfile
40 $script -P $pidfile -U $sockfile -f -v &
42 # We may have to wait a short time for the pid file to appear.
43 for i in `seq 1 10`; do
44 if test -f $pidfile; then
45 break
47 sleep 1
48 done
49 if ! test -f $pidfile; then
50 echo "$0: PID file was not created"
51 exit 1
54 pid="$(cat $pidfile)"
56 # Check the process exists.
57 kill -s 0 $pid
59 # Check the socket was created (and is a socket).
60 test -S $sockfile
62 # Kill the process.
63 kill $pid
65 # Check the process exits (eventually).
66 for i in `seq 1 10`; do
67 if ! kill -s 0 $pid; then
68 break;
70 sleep 1
71 done
72 if kill -s 0 $pid; then
73 echo "$0: process did not exit after sending a signal"
74 exit 1
77 rm $pidfile $sockfile