Debian Codegraph @

admin/jenkins_cxxtest

raw
1 #!/bin/bash
2
3 if test -z "$WORKSPACE"; then
4 echo "ERROR: \$WORKSPACE not defined"
5 exit 1
6 fi
7 export PATH="$WORKSPACE/vpython/bin:$PATH"
8
9 if test -n "$1"; then
10 PYTHON="$1"
11 else
12 PYTHON=python
13 fi
14
15 echo
16 echo "Building on `hostname`:"
17 echo
18 echo " Workspace: ${WORKSPACE}"
19 echo
20 echo " Package: ${PACKAGE}"
21 echo
22 echo " Environment:"
23 /usr/bin/env 2>&1 | sort | sed 's/^/ /'
24 echo
25 echo " Python:"
26 ${PYTHON} -c 'import sys; sys.stdout.write(sys.version+"\n")' 2>&1 \
27 | sed 's/^/ /'
28 PYTHON_VER=`${PYTHON} -c 'import sys; sys.stdout.write(str(sys.version_info[0]))'`
29 echo
30 # The following executables are required (missing app yields build failure)
31 for app in gcc; do
32 which $app || exit 1
33 echo " $app:"
34 $app --version 2>&1 | grep -v '^$' | sed 's/^/ /' || exit 1
35 echo
36 done
37
38
39 # Setup virtual Python environment
40 \rm -Rf vpython
41 tmp=2.6
42 if [ "yes" = "$(echo | awk "($PYTHON_VER < $tmp) { print \"yes\"; }")" ]; then
43 "$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv_1.7.py "$WORKSPACE"/vpython || exit 1
44 else
45 "$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv.py "$WORKSPACE"/vpython || exit 1
46 fi
47 vpython/bin/easy_install nose
48 if test "$PYTHON_VER" -gt 2; then
49 vpython/bin/easy_install unittest2py3k
50 #vpython/bin/pip install unittest2py3k
51 else
52 vpython/bin/easy_install unittest2
53 fi
54 vpython/bin/easy_install ply
55 vpython/bin/easy_install ordereddict
56 vpython/bin/easy_install gcovr
57 vpython/bin/easy_install coverage
58 vpython/bin/easy_install pyutilib.th
59 cd "$WORKSPACE"/cxxtest/python
60 "$WORKSPACE"/vpython/bin/python setup.py develop
61
62 # Cleanup test directories
63 cd "$WORKSPACE"/cxxtest/test
64 make clean
65 cd "$WORKSPACE"/cxxtest/doc
66 make clean
67 cd "$WORKSPACE"
68
69 # Run tests
70 export CXXTEST_GCOV_FLAGS='-fprofile-arcs -ftest-coverage'
71 vpython/bin/nosetests --verbosity=2 -w "$WORKSPACE"/cxxtest \
72 --with-coverage --with-xunit --xunit-file="$WORKSPACE"/TEST-cxxtest.xml \
73 || echo "(INFO) nosetests returned non-zero return code"
74
75 # Generate Python code coverage
76 vpython/bin/coverage xml --omit="$WORKSPACE/vpython/lib/*,$WORKSPACE/cxxtest/test/*,$WORKSPACE/cxxtest/doc/examples/*" -o $WORKSPACE/cxxtest/test/coverage.xml
77
78 # Generate C++ code coverage
79 cd "$WORKSPACE"/cxxtest
80 "$WORKSPACE"/vpython/bin/gcovr -v -d -r "$WORKSPACE"/cxxtest \
81 -x -o "$WORKSPACE"/cxxtest/coverage.xml \
82 --gcov-filter '.*#test#(\.\.|\^)#cxxtest#.*gcov'
83
84 echo "DONE"
85