Skip to content
This repository
Newer
Older
100755 108 lines (93 sloc) 2.475 kb
e78e2d73 » ojii
2010-07-15 added a testapp with boostrapping to make testing a lot easier
1 #!/bin/bash
2 cd tests
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
3
4 args=("$@")
5 num_args=${#args[@]}
6 index=0
7
64a18139 » ojii
2010-12-10 Changed default for reuse_env to true to make tests run faster by def…
8 reuse_env=true
c3026764 » ojii
2010-12-17 .runtest.sh now runs without coverage by default to speed up the test…
9 disable_coverage=true
5c9da5e0 » ojii
2011-01-06 added option to run tests against django trunk
10 django_trunk=false
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
11
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
12 while [ "$index" -lt "$num_args" ]
13 do
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
14 case "${args[$index]}" in
15 "--failfast")
16 failfast="--failfast"
17 ;;
18
64a18139 » ojii
2010-12-10 Changed default for reuse_env to true to make tests run faster by def…
19 "--rebuild-env")
20 reuse_env=false
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
21 ;;
22
c3026764 » ojii
2010-12-17 .runtest.sh now runs without coverage by default to speed up the test…
23 "--with-coverage")
24 disable_coverage=false
5681e7a1 » fivethreeo
2010-12-06 added --disable-coverage flag
25 ;;
5c9da5e0 » ojii
2011-01-06 added option to run tests against django trunk
26
27 "--django-trunk")
28 django_trunk=true
29 ;;
5681e7a1 » fivethreeo
2010-12-06 added --disable-coverage flag
30
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
31 "--help")
32 echo ""
33 echo "usage:"
34 echo " runtests.sh"
5681e7a1 » fivethreeo
2010-12-06 added --disable-coverage flag
35 echo " or runtests.sh [testcase]"
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
36 echo " or runtests.sh [flags] [testcase]"
37 echo ""
38 echo "flags:"
39 echo " --failfast - abort at first failing test"
c3026764 » ojii
2010-12-17 .runtest.sh now runs without coverage by default to speed up the test…
40 echo " --with-coverage - enables coverage"
5c9da5e0 » ojii
2011-01-06 added option to run tests against django trunk
41 echo " --rebuild-env - run buildout before the tests"
42 echo " --django-trunk - run tests against django trunk"
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
43 exit 1
44 ;;
45
46 *)
47 suite="cms.${args[$index]}"
48 esac
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
49 let "index = $index + 1"
50 done
51
5c9da5e0 » ojii
2011-01-06 added option to run tests against django trunk
52 current_buildout_django=`cat .installed.cfg | grep "^version = " | sed s/'version = '//`
53
54 if [ $reuse_env == true ]; then
55 if [[ $django_trunk && $current_buildout_django != 'trunk' ]]; then
56 reuse_env=false
57 else
58 if [[ !$django_trunk && $current_buildout_django != '1.2.4' ]]; then
59 reuse_env=false
60 fi
61 fi
62 fi
63
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
64 if [ $reuse_env == false ]; then
65 echo "setting up test environment (this might take a while)..."
66 python bootstrap.py
67 if [ $? != 0 ]; then
68 echo "bootstrap.py failed"
69 exit 1
70 fi
50f54e5b » ojii
2011-01-06 fixed runtests.sh always running against django trunk
71 if [ $django_trunk == true ]; then
c7e9302c » ojii
2011-01-06 fixed runtests.sh issue
72 ./bin/buildout -c django-svn.cfg
73 else
74 ./bin/buildout
75 fi
ee813b56 » fivethreeo
2010-12-04 added --reuse-env and --help to runtests.sh
76 if [ $? != 0 ]; then
77 echo "bin/buildout failed"
78 exit 1
79 fi
80 else
81 echo "reusing current buildout environment"
82 fi
83
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
84 if [ "$failfast" ]; then
85 echo "--failfast supplied, not using xmlrunner."
86 fi
87
88 if [ ! "$suite" ]; then
89 suite="cms"
90 echo "Running complete cms testsuite."
3da6e83c » ojii
2010-07-16 improved runtests.sh and gitignore
91 else
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
92 echo "Running cms test $suite."
e78e2d73 » ojii
2010-07-15 added a testapp with boostrapping to make testing a lot easier
93 fi
c657342c » fivethreeo
2010-11-29 support failfast with specific tests, disable xmlrunner with failfast
94
5681e7a1 » fivethreeo
2010-12-06 added --disable-coverage flag
95 if [ $disable_coverage == false ]; then
96 ./bin/coverage run --rcfile=.coveragerc testapp/manage.py test $suite $failfast
97 retcode=$?
98
99 echo "Post test actions..."
100 ./bin/coverage xml
101 ./bin/coverage html
102 else
103 ./bin/django test $suite $failfast
104 retcode=$?
105 fi
e78e2d73 » ojii
2010-07-15 added a testapp with boostrapping to make testing a lot easier
106 cd ..
92e208ad » ojii
2010-07-17 small improvements to runtests.sh
107 echo "done"
108 exit $retcode
Something went wrong with that request. Please try again.