Debian Codegraph @

run-unit-tests

raw
1 #!/bin/sh
2
3 # If AUTOPKGTEST_TMP is set (autopkgtest and debian/tests/control)
4 # test the installed executable and interaction with debhelper.
5 # Else (make check)
6 # test the script in the source directory.
7
8 . ./test_helper.sh
9
10 top_source_dir=$(pwd)
11
12 host=$(dpkg-architecture -qDEB_HOST_ARCH )
13
14 if [ -n "${AUTOPKGTEST_TMP:-}" ]; then
15 tested_command='dh_builtusing --logorrheic'
16 test_dir="$AUTOPKGTEST_TMP"
17 else
18 rm -fr obj/unit-tests
19 tested_command="perl $top_source_dir/dh_builtusing --logorrheic"
20 test_dir="$top_source_dir/obj"
21 fi
22
23 for script in unit-tests/*; do
24
25 # Skip emacs backups.
26 case $script in
27 *~) continue ;;
28 esac
29
30 echo "Running $script"
31
32 test_subdir="$test_dir/$script"
33 mkdir -p "$test_subdir/debian"
34 cd "$test_subdir"
35
36 fake_changelog > debian/changelog
37
38 { . "$top_source_dir/$script"; } 2> stderr
39 if [ -s stderr ]; then
40 echo "$script wrote to stderr:"
41 cat stderr
42 exit 1
43 fi
44
45 echo "OK: $script"
46 done