Skip to content
Newer
Older
100755 105 lines (90 sloc) 2.38 KB
e78e2d7 added a testapp with boostrapping to make testing a lot easier
Jonas Obrist authored Jul 15, 2010
1 #!/bin/bash
2 cd tests
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
3
4 args=("$@")
5 num_args=${#args[@]}
6 index=0
7
64a1813 Changed default for reuse_env to true to make tests run faster by def…
ojii authored Dec 10, 2010
8 reuse_env=true
c302676 .runtest.sh now runs without coverage by default to speed up the test…
Jonas Obrist authored Dec 17, 2010
9 disable_coverage=true
5c9da5e added option to run tests against django trunk
Jonas Obrist authored Jan 6, 2011
10 django_trunk=false
e434850 @chrisglass Rationalized runtests.sh
chrisglass authored Jan 10, 2011
11 python="python" # to ensure this script works if no python option is specified
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
12 while [ "$index" -lt "$num_args" ]
13 do
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
14 case "${args[$index]}" in
15 "--failfast")
16 failfast="--failfast"
17 ;;
18
64a1813 Changed default for reuse_env to true to make tests run faster by def…
ojii authored Dec 10, 2010
19 "--rebuild-env")
20 reuse_env=false
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
21 ;;
22
c302676 .runtest.sh now runs without coverage by default to speed up the test…
Jonas Obrist authored Dec 17, 2010
23 "--with-coverage")
24 disable_coverage=false
5681e7a @fivethreeo added --disable-coverage flag
fivethreeo authored Dec 6, 2010
25 ;;
5c9da5e added option to run tests against django trunk
Jonas Obrist authored Jan 6, 2011
26
27 "--django-trunk")
28 django_trunk=true
29 ;;
6d1b599 added ability to run tests against different python version
Jonas Obrist authored Jan 7, 2011
30
31 "--python")
32 let "index = $index + 1"
33 python="${args[$index]}"
34 ;;
5681e7a @fivethreeo added --disable-coverage flag
fivethreeo authored Dec 6, 2010
35
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
36 "--help")
37 echo ""
38 echo "usage:"
39 echo " runtests.sh"
5681e7a @fivethreeo added --disable-coverage flag
fivethreeo authored Dec 6, 2010
40 echo " or runtests.sh [testcase]"
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
41 echo " or runtests.sh [flags] [testcase]"
42 echo ""
43 echo "flags:"
44 echo " --failfast - abort at first failing test"
c302676 .runtest.sh now runs without coverage by default to speed up the test…
Jonas Obrist authored Dec 17, 2010
45 echo " --with-coverage - enables coverage"
5c9da5e added option to run tests against django trunk
Jonas Obrist authored Jan 6, 2011
46 echo " --rebuild-env - run buildout before the tests"
47 echo " --django-trunk - run tests against django trunk"
e434850 @chrisglass Rationalized runtests.sh
chrisglass authored Jan 10, 2011
48 echo " --python /path/to/python - python version to use to run the tests"
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
49 exit 1
50 ;;
51
52 *)
53 suite="cms.${args[$index]}"
54 esac
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
55 let "index = $index + 1"
56 done
57
e434850 @chrisglass Rationalized runtests.sh
chrisglass authored Jan 10, 2011
58 echo "using python at: $python"
5c9da5e added option to run tests against django trunk
Jonas Obrist authored Jan 6, 2011
59
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
60 if [ $reuse_env == false ]; then
61 echo "setting up test environment (this might take a while)..."
e434850 @chrisglass Rationalized runtests.sh
chrisglass authored Jan 10, 2011
62 $python bootstrap.py
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
63 if [ $? != 0 ]; then
64 echo "bootstrap.py failed"
65 exit 1
66 fi
50f54e5 fixed runtests.sh always running against django trunk
Jonas Obrist authored Jan 6, 2011
67 if [ $django_trunk == true ]; then
c7e9302 fixed runtests.sh issue
Jonas Obrist authored Jan 6, 2011
68 ./bin/buildout -c django-svn.cfg
69 else
70 ./bin/buildout
71 fi
ee813b5 @fivethreeo added --reuse-env and --help to runtests.sh
fivethreeo authored Dec 4, 2010
72 if [ $? != 0 ]; then
73 echo "bin/buildout failed"
74 exit 1
75 fi
76 else
77 echo "reusing current buildout environment"
78 fi
79
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
80 if [ "$failfast" ]; then
81 echo "--failfast supplied, not using xmlrunner."
82 fi
83
84 if [ ! "$suite" ]; then
85 suite="cms"
86 echo "Running complete cms testsuite."
3da6e83 improved runtests.sh and gitignore
Jonas Obrist authored Jul 16, 2010
87 else
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
88 echo "Running cms test $suite."
e78e2d7 added a testapp with boostrapping to make testing a lot easier
Jonas Obrist authored Jul 15, 2010
89 fi
c657342 @fivethreeo support failfast with specific tests, disable xmlrunner with failfast
fivethreeo authored Nov 29, 2010
90
5681e7a @fivethreeo added --disable-coverage flag
fivethreeo authored Dec 6, 2010
91 if [ $disable_coverage == false ]; then
92 ./bin/coverage run --rcfile=.coveragerc testapp/manage.py test $suite $failfast
93 retcode=$?
94
95 echo "Post test actions..."
96 ./bin/coverage xml
97 ./bin/coverage html
98 else
99 ./bin/django test $suite $failfast
100 retcode=$?
101 fi
e78e2d7 added a testapp with boostrapping to make testing a lot easier
Jonas Obrist authored Jul 15, 2010
102 cd ..
92e208a small improvements to runtests.sh
Jonas Obrist authored Jul 17, 2010
103 echo "done"
104 exit $retcode
Something went wrong with that request. Please try again.