File: check_remote.sh

package info (click to toggle)
viking 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,468 kB
  • sloc: ansic: 81,706; xml: 2,893; sh: 2,501; makefile: 874; python: 589; perl: 384; cpp: 259
file content (43 lines) | stat: -rwxr-xr-x 981 bytes parent folder | download | duplicates (2)
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
40
41
42
43
#!/bin/sh

# Enable running in test directory or via make distcheck when $srcdir is defined
if [ -z "$srcdir" ]; then
  srcdir=.
fi

# Use full Viking program
# Same for normal and via distcheck
VIKING=../src/viking

CONFDIR=$XDG_RUNTIME_DIR/vikingtestconf
pid=`pgrep viking`
if [ "$pid" != "" ]; then
    echo "An instance of Viking is already running, thus skipping remote check tests"
    exit 0
fi

# This should fail returning an exit code of 1
$VIKING -c $CONFDIR -r $srcdir/Stonehenge.gpx
if [ $? != 1 ]; then
   exit 3
fi

$VIKING -c $CONFDIR &
pid=`pgrep viking`
# Give a little time for viking to startup fully before running test
sleep 1
result=0
# Check socket exists
if [ $(ss -lx | grep viking.command-socket | wc -l) != 1 ]; then
    result=2
else
    # Try sending the remote load command
    $VIKING -c $CONFDIR -r $srcdir/Stonehenge.gpx
    result=$?
fi
sleep 1
# Remove running instance & cleanup
kill $pid
rm $CONFDIR/* 2> /dev/null
rmdir $CONFDIR
exit $result