-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.bash
More file actions
executable file
·36 lines (27 loc) · 875 Bytes
/
test.bash
File metadata and controls
executable file
·36 lines (27 loc) · 875 Bytes
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
#!/usr/bin/env bash
# Test that running server.py makes no changes to RND files,
# except TIME.RND
set -euo pipefail
RETVAL=0
# Make a temp directory to store what the .RND files were before testing.
TMPDIR="`mktemp -dp .`"
trap "rm -rf $TMPDIR; exit 1" EXIT HUP INT TERM
cp -r orbit-files/* "$TMPDIR"
# Spin up a bad echo server
./test_scripts/super_basic_echo.py &
ECHO_PID=$!
# Run server.py.
timeout --preserve-status --signal=TERM 3 \
./serverv-py/server.py --sevpath "$TMPDIR/sevpath.RND"
RETVAL=$?
# End bad echo server
kill "$ECHO_PID" || true
# Check if any .RND files, except TIME.RND, changed during execution.
for f in `find orbit-files -type f -printf '%P\n'`; do
if [[ "`basename $f`" != 'TIME.RND' ]]; then
diff "orbit-files/$f" "$TMPDIR/$f"
diffresult=$?
if [[ $diffresult -ne 0 ]]; then RETVAL=$diffresult; fi
fi
done
exit $RETVAL