File: 01-daemon-tests

package info (click to toggle)
ample 0.5.7-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 692 kB
  • sloc: ansic: 2,885; sh: 255; makefile: 203
file content (39 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

set -e

VERSION=`date +%Y%m%d%H%M%S%N`
AMPLEDIR=$AUTOPKGTEST_TMP/tmp/ample-$VERSION

# create tmp dirs
mkdir -p $AMPLEDIR/mp3

# create temporary conf file
> $AMPLEDIR/ample.conf
cat << EOF >> $AMPLEDIR/ample.conf
port = 1234
order = true
clients = 5
logfile = $AMPLEDIR/ample.log
mp3path = $AMPLEDIR/mp3
recursive = true
servername = Ample
EOF

# create mp3 fake file
> $AMPLEDIR/mp3/test.mp3
cat << EOF >> $AMPLEDIR/mp3/test.mp3
fake mp3 file just to run ample daemon
EOF

# execute the daemon
/usr/bin/ample -c 10 -f $AMPLEDIR/ample.conf -i $AMPLEDIR/ample.pid

# check if the daemon is running
ps ax | egrep '(ample.*ample.pid)' | grep -v grep

# check is the daemon is listening
ss -tlndp | egrep -e '(tcp.*LISTEN.*:1234.*ample)'

# clean up everything
kill -9 `cat $AMPLEDIR/ample.pid`