File: stop

package info (click to toggle)
mpv-mpris 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: ansic: 1,063; sh: 184; makefile: 79
file content (46 lines) | stat: -rwxr-xr-x 1,030 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
40
41
42
43
44
45
46
#!/bin/bash

pause=1

. ./setup

status Paused
check pause true

if [ "$test" = stop ] ; then
	playerctl stop
elif [ "$test" = quit ] ; then
	mpris_quit
fi
sleep 2

ret_ipc=0
prop pause > "$input_json"
cat "$input_json"
rm -f "$socat_log"
# Since mpv should be stopped by now and the IPC socket closed by mpv,
# an error from socat is expected, so redirect it to a log file so that
# it doesn't hit stderr, as some test systems check that stderr is empty.
< "$input_json" socat -lf"$socat_log" - "UNIX-CONNECT:$ipc" > "$output_json" ||
ret_ipc=$?
cat "$output_json"
test ! -s "$output_json"

if [ $ret_ipc -eq 0 ] ; then
	echo 'socat succeeded but it should have failed!' >&2
	echo 'probably mpv did not stop when asked to!' >&2
fi

if [ ! -s "$socat_log" ] ; then
	echo 'socat log should contain an error!' >&2
else
	echo 'socat log contains these *expected* errors:'
	cat "$socat_log"
fi

playerctl status 2>&1 > /dev/null |
grep "^No players \(were \)\?found$"

if [ $ret_ipc -eq 0 ] || [ ! -s "$socat_log" ] ; then
	exit 1
fi