Debian Codegraph @

debian/tests/run-unit-test

raw
1 #!/bin/bash
2 set -e
3
4 pkg=brian
5
6 export LC_ALL=C.UTF-8
7 if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
8 AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
9 trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
10 fi
11
12 # Return exit code 1 if any of the listed package in argument is not available.
13 is_installed () {
14 local pkg
15 for pkg in "$@"
16 do
17 if dpkg --status "$pkg" 2>/dev/null \
18 | grep -q 'Status: install ok installed'
19 then continue
20 else return 1
21 fi
22 done
23 }
24
25 cd "${AUTOPKGTEST_TMP}"
26
27 # Check for test dependencies
28 if ! is_installed python3-pytest
29 then
30 cat >&2 <<-END
31 error: running the unit test requires installing python3-pytest
32 END
33 exit 1
34 fi
35
36 if ! is_installed python3-sphinx python3-dev g++
37 then
38 cat >&2 <<-END
39 warning: parts of the unit test suite require the following packages:
40 - python3-sphinx
41 - python3-dev
42 - g++
43 END
44 fi
45
46 case "$(dpkg-architecture -qDEB_HOST_ARCH)" in
47 riscv64)
48 SKIP_TESTS='additional_args=["-k", "not (test_synapse_creation_generator_multiple_synapses or test_check_for_invalid_values_linear_integrator or test_rallpack2 or test_synapse_generator_deterministic)"]'
49 ;;
50 *)
51 SKIP_TESTS=
52 ;;
53 esac
54
55 mkdir home
56 export HOME="${AUTOPKGTEST_TMP}/home"
57 python3 -c "import brian2; exit(not brian2.test(${SKIP_TESTS}))"