test/acceptance/replay 840 B raw
1
#!/bin/sh
2
# Compare complete output from two executions of the same native image.
3
set -eu
4
if [ "$#" -lt 4 ]; then
5
    printf 'usage: replay profile emulator image harts [machine-options...]\n' >&2
6
    exit 1
7
fi
8
profile=$1
9
emulator=$2
10
image=$3
11
harts=$4
12
shift 4
13
mkdir -p bin/acceptance/traces
14
prefix="bin/acceptance/traces/$profile-$harts"
15
for attempt in 1 2; do
16
    if ! "$emulator" -machine -harts="$harts" -memory-size=262144 -max-steps=2000000000 "$@" -run "$image" > "$prefix.$attempt.log" 2>&1; then
17
        cat "$prefix.$attempt.log"
18
        exit 1
19
    fi
20
done
21
if ! cmp -s "$prefix.1.log" "$prefix.2.log"; then
22
    diff -u "$prefix.1.log" "$prefix.2.log" || true
23
    printf 'replay: %s %s-hart output differs\n' "$profile" "$harts" >&2
24
    exit 1
25
fi
26
cat "$prefix.1.log"
27
printf 'replay: %s %s-hart output matched\n' "$profile" "$harts"