File: run-unit-test

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (57 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e

pkg=brian

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

# Return exit code 1 if any of the listed package in argument is not available.
is_installed () {
	local pkg
	for pkg in "$@"
	do
		if dpkg --status "$pkg" 2>/dev/null \
		   | grep -q 'Status: install ok installed'
		then continue
		else return 1
		fi
	done
}

cd "${AUTOPKGTEST_TMP}"

# Check for test dependencies
if ! is_installed python3-pytest
then
	cat >&2 <<-END
	error: running the unit test requires installing python3-pytest
	END
	exit 1
fi

if ! is_installed python3-sphinx python3-dev g++
then
	cat >&2 <<-END
	warning: parts of the unit test suite require the following packages:
	  - python3-sphinx
	  - python3-dev
          - g++
	END
fi

case "$(dpkg-architecture -qDEB_HOST_ARCH)" in
  riscv64)
    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)"]'
    ;;
  *)
    SKIP_TESTS=
    ;;
esac

mkdir home
export HOME="${AUTOPKGTEST_TMP}/home"
python3 -c "import brian2; exit(not brian2.test(${SKIP_TESTS}))"