File: run-unit-test

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (48 lines) | stat: -rw-r--r-- 1,803 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
#!/bin/bash
set -e

# called from the .../simrisc-VERSION directory after building a new
# version.

if [ -z "${AUTOPKGTEST_TMP}" ] || [ ! -d "${AUTOPKGTEST_TMP}" ]; then
    AUTOPKGTEST_TMP=$(mktemp --directory)
fi

# create configuration file for simulation
zcat /usr/share/doc/simrisc/simrisc.gz > "${AUTOPKGTEST_TMP}/simrisc.config"

# run simulation
/usr/bin/simrisc --one-analysis \
        --base="${AUTOPKGTEST_TMP}" \
        --config="${AUTOPKGTEST_TMP}/simrisc.config" \
        --data="${AUTOPKGTEST_TMP}/simrisc-test1.out"

# trim the first line of the output, which is a timestamp
tail -n +2 < "${AUTOPKGTEST_TMP}/simrisc-test1.out" | gzip --to-stdout > "${AUTOPKGTEST_TMP}/simrisc-test1.results.gz"

# compare simulation output with expected output
if ! zdiff -q "${AUTOPKGTEST_TMP}/simrisc-test1.results.gz" debian/tests/simrisc-test1.expected.gz 2>/dev/null ; then
    echo "FAIL simrisc simulation output does not match debian/tests/simrisc-test1.expected"
    exit 1
fi

# run another simulation that segfaults with upstream versions 15.02.00
/usr/bin/simrisc --base="${AUTOPKGTEST_TMP}" \
        --config="${AUTOPKGTEST_TMP}/simrisc.config" \
        --data="${AUTOPKGTEST_TMP}/simrisc-test2.out" \
        --cancer=male \
        debian/tests/simrisc-test2.input

# trim the first line of the output, which is a timestamp
tail -n +2 < "${AUTOPKGTEST_TMP}/simrisc-test2.out" | gzip --to-stdout > "${AUTOPKGTEST_TMP}/simrisc-test2.results.gz"

# compare simulation output with expected output
if ! zdiff -q "${AUTOPKGTEST_TMP}/simrisc-test2.results.gz" debian/tests/simrisc-test2.expected.gz 2>/dev/null ; then
    echo "FAIL simrisc simulation output does not match debian/tests/simrisc-test2.expected"
    exit 1
fi

# no tests failed    
echo "No tests failed"
echo "PASS"
exit 0