equal
deleted
inserted
replaced
1 #!/bin/sh |
1 #!/bin/sh |
2 |
2 |
3 LC_ALL=ru_RU.utf-8 |
|
4 |
3 |
5 export DISPLAY=:42 |
|
6 Xvfb $DISPLAY -screen 0 1280x1024x24 & |
|
7 sleep 1 |
|
8 |
4 |
9 ret=0 |
5 cleanup() |
10 DELAY=400 |
6 { |
11 KILL_DELAY=$(($DELAY + 30)) |
7 find $PYTEST_DIR -name '*.pyc' -delete |
12 timeout -k $KILL_DELAY $DELAY pytest --timeout=10 ./tests/tools |
8 } |
13 ret=$? |
|
14 |
9 |
15 pkill -9 Xvfb |
|
16 |
10 |
17 exit $ret |
11 |
|
12 print_help() |
|
13 { |
|
14 echo "Usage: run_python_tests.sh [--on-local-xserver]" |
|
15 echo "" |
|
16 echo "--on-local-xserver" |
|
17 echo " all tests are run on local X-server. " |
|
18 echo " User can see test in action." |
|
19 echo " Any interaction (mouse, keyboard) should be avoided" |
|
20 echo " By default without arguments script runs pytest on virtual X serverf." |
|
21 echo "" |
|
22 |
|
23 exit 1 |
|
24 } |
|
25 |
|
26 main() |
|
27 { |
|
28 LC_ALL=ru_RU.utf-8 |
|
29 PYTEST_DIR=./tests/tools |
|
30 |
|
31 if [ ! -d $PYTEST_DIR ]; then |
|
32 echo "Script should be run from top directory in repository" |
|
33 exit 1; |
|
34 fi |
|
35 |
|
36 use_xvfb=0 |
|
37 if [ "$1" != "--on-local-xserver" ]; then |
|
38 export DISPLAY=:42 |
|
39 use_xvfb=1 |
|
40 Xvfb $DISPLAY -screen 0 1280x1024x24 & |
|
41 sleep 1 |
|
42 fi |
|
43 |
|
44 |
|
45 cleanup |
|
46 |
|
47 ret=0 |
|
48 DELAY=400 |
|
49 KILL_DELAY=$(($DELAY + 30)) |
|
50 timeout -k $KILL_DELAY $DELAY pytest --timeout=10 ./tests/tools |
|
51 ret=$? |
|
52 |
|
53 cleanup |
|
54 |
|
55 [ $use_xvfb = 1 ] && pkill -9 Xvfb |
|
56 exit $ret |
|
57 } |
|
58 |
|
59 |
|
60 [ "$1" = "--help" -o "$1" = "-h" ] && print_help |
|
61 main $@ |