Debian Codegraph @

debian/tests/01-daemon-tests

raw
1 #!/bin/sh
2
3 set -e
4
5 VERSION=`date +%Y%m%d%H%M%S%N`
6 AMPLEDIR=$AUTOPKGTEST_TMP/tmp/ample-$VERSION
7
8 # create tmp dirs
9 mkdir -p $AMPLEDIR/mp3
10
11 # create temporary conf file
12 > $AMPLEDIR/ample.conf
13 cat << EOF >> $AMPLEDIR/ample.conf
14 port = 1234
15 order = true
16 clients = 5
17 logfile = $AMPLEDIR/ample.log
18 mp3path = $AMPLEDIR/mp3
19 recursive = true
20 servername = Ample
21 EOF
22
23 # create mp3 fake file
24 > $AMPLEDIR/mp3/test.mp3
25 cat << EOF >> $AMPLEDIR/mp3/test.mp3
26 fake mp3 file just to run ample daemon
27 EOF
28
29 # execute the daemon
30 /usr/bin/ample -c 10 -f $AMPLEDIR/ample.conf -i $AMPLEDIR/ample.pid
31
32 # check if the daemon is running
33 ps ax | egrep '(ample.*ample.pid)' | grep -v grep
34
35 # check is the daemon is listening
36 ss -tlndp | egrep -e '(tcp.*LISTEN.*:1234.*ample)'
37
38 # clean up everything
39 kill -9 `cat $AMPLEDIR/ample.pid`