summaryrefslogtreecommitdiffstats
path: root/debian/tests/test-SSE2
blob: 1c73ab0ccf762ad9815fff77840e4f55fc4b4b99 (plain)
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
#!/bin/sh

set -e

DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)


"/usr/libexec/$DEB_HOST_MULTIARCH/isa-support/qemu-static-good-SSE2" "/usr/libexec/$DEB_HOST_MULTIARCH/isa-support/test-SSE2"
# trap signal to self
trap "exit 0" ILL
trap "exit 0" SEGV
trap "exit 0" BUS


sed_move_to_stderr() {
    sed  -e "/$1/w /dev/stderr" -e "/$1/d"
}

qemu_bad() {
    "/usr/libexec/$DEB_HOST_MULTIARCH/isa-support/qemu-static-bad-SSE2" "/usr/libexec/$DEB_HOST_MULTIARCH/isa-support/test-SSE2" || true
}

exec 5>&1
exec 3>&1
error_qemu=$( ( ( (qemu_bad) 2>&1 >&3 3>&- ; echo $? >&4)  | sed_move_to_stderr 'uncaught target signal' 2>&1 >&3 3>&- ) 4>&1 >&5)
exec 3>&-
exec 5>&-
test "X$error_qemu" = "X0"