-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple smoketest to check whether a commit completely breaks LM…
…S startup. More sophisticated tests to follow.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: 'Smoketest for Logitech Media Server' | ||
on: [push, pull_request] | ||
jobs: | ||
linux: | ||
name: Run LMS to see whether it crashes immediately... | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Run test | ||
run: bash t/00_smoketest.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
SERVER_LOG=$HOME/server.log | ||
TIMEOUT=30 | ||
|
||
function wait_port() { | ||
local wait_seconds="${1:-10}"; shift # 10 seconds as default timeout | ||
|
||
until test $((wait_seconds--)) -eq 0 ; do | ||
if nc -z localhost 9000 ; then | ||
break | ||
else | ||
sleep 1 | ||
fi | ||
done | ||
|
||
((++wait_seconds)) | ||
} | ||
|
||
function finish { | ||
kill -9 $NODE_PID 2> /dev/null | ||
cat $SERVER_LOG | ||
rm $SERVER_LOG | ||
} | ||
trap finish EXIT | ||
|
||
./slimserver.pl --logfile=$SERVER_LOG & | ||
NODE_PID=$! | ||
|
||
wait_port $TIMEOUT || { | ||
echo "Timing out trying to connect to LMS" | ||
exit 1; | ||
} | ||
|
||
STATUS=$(curl -m1 -sX POST -d '{"id":0,"params":["",["serverstatus"]],"method":"slim.request"}' http://localhost:9000/jsonrpc.js) | ||
|
||
echo $STATUS | jq . | ||
|
||
RESULT=$(echo $STATUS | fgrep -q version) | ||
|
||
exit $RESULT |