Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 87 lines (74 sloc) 1.85 kb
e78e2d7 Jonas Obrist added a testapp with boostrapping to make testing a lot easier
ojii authored
1 #!/bin/bash
2 cd tests
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
3
4 args=("$@")
5 num_args=${#args[@]}
6 index=0
7
64a1813 Jonas Obrist Changed default for reuse_env to true to make tests run faster by defaul...
ojii authored
8 reuse_env=true
c302676 Jonas Obrist .runtest.sh now runs without coverage by default to speed up the test su...
ojii authored
9 disable_coverage=true
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
10
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
11 while [ "$index" -lt "$num_args" ]
12 do
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
13 case "${args[$index]}" in
14 "--failfast")
15 failfast="--failfast"
16 ;;
17
64a1813 Jonas Obrist Changed default for reuse_env to true to make tests run faster by defaul...
ojii authored
18 "--rebuild-env")
19 reuse_env=false
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
20 ;;
21
c302676 Jonas Obrist .runtest.sh now runs without coverage by default to speed up the test su...
ojii authored
22 "--with-coverage")
23 disable_coverage=false
5681e7a Øyvind Saltvik added --disable-coverage flag
fivethreeo authored
24 ;;
25
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
26 "--help")
27 echo ""
28 echo "usage:"
29 echo " runtests.sh"
5681e7a Øyvind Saltvik added --disable-coverage flag
fivethreeo authored
30 echo " or runtests.sh [testcase]"
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
31 echo " or runtests.sh [flags] [testcase]"
32 echo ""
33 echo "flags:"
34 echo " --failfast - abort at first failing test"
c302676 Jonas Obrist .runtest.sh now runs without coverage by default to speed up the test su...
ojii authored
35 echo " --with-coverage - enables coverage"
64a1813 Jonas Obrist Changed default for reuse_env to true to make tests run faster by defaul...
ojii authored
36 echo " --rebuild-env - run buildout before the tests"
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
37 exit 1
38 ;;
39
40 *)
41 suite="cms.${args[$index]}"
42 esac
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
43 let "index = $index + 1"
44 done
45
ee813b5 Øyvind Saltvik added --reuse-env and --help to runtests.sh
fivethreeo authored
46 if [ $reuse_env == false ]; then
47 echo "setting up test environment (this might take a while)..."
48 python bootstrap.py
49 if [ $? != 0 ]; then
50 echo "bootstrap.py failed"
51 exit 1
52 fi
53 ./bin/buildout
54 if [ $? != 0 ]; then
55 echo "bin/buildout failed"
56 exit 1
57 fi
58 else
59 echo "reusing current buildout environment"
60 fi
61
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
62 if [ "$failfast" ]; then
63 echo "--failfast supplied, not using xmlrunner."
64 fi
65
66 if [ ! "$suite" ]; then
67 suite="cms"
68 echo "Running complete cms testsuite."
3da6e83 Jonas Obrist improved runtests.sh and gitignore
ojii authored
69 else
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
70 echo "Running cms test $suite."
e78e2d7 Jonas Obrist added a testapp with boostrapping to make testing a lot easier
ojii authored
71 fi
c657342 Øyvind Saltvik support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored
72
5681e7a Øyvind Saltvik added --disable-coverage flag
fivethreeo authored
73 if [ $disable_coverage == false ]; then
74 ./bin/coverage run --rcfile=.coveragerc testapp/manage.py test $suite $failfast
75 retcode=$?
76
77 echo "Post test actions..."
78 ./bin/coverage xml
79 ./bin/coverage html
80 else
81 ./bin/django test $suite $failfast
82 retcode=$?
83 fi
e78e2d7 Jonas Obrist added a testapp with boostrapping to make testing a lot easier
ojii authored
84 cd ..
92e208a Jonas Obrist small improvements to runtests.sh
ojii authored
85 echo "done"
86 exit $retcode
Something went wrong with that request. Please try again.