tests/tools/run_python_tests.sh
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Sat, 16 Sep 2017 21:26:17 +0300
changeset 1820 76f5eba31afd
child 1825 bcb50e736a46
permissions -rwxr-xr-x
add shell script to run all python tests and automatically handle Xvfb
1820
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     2
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     3
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     4
export DISPLAY=:42
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     5
Xvfb $DISPLAY -screen 0 1280x1024x24 &
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     6
sleep 1
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     7
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     8
ret=0
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     9
DELAY=400
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    10
KILL_DELAY=$(($DELAY + 30))
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    11
timeout -k $KILL_DELAY $DELAY pytest --timeout=10 ./tests/tools
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    12
ret=$?
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    13
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    14
pkill -9 Xvfb
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    15
76f5eba31afd add shell script to run all python tests and automatically handle Xvfb
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    16
exit $ret