aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/external/c-testsuite/runners/single-exec/9cc-x86_64
blob: dc27fc91940cbea63286df0e9f5334db605868b1 (plain) (blame)
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
#! /bin/sh

set -e
set -u

if ! test "x86_64" = "$(uname -m)"
then
    echo "incorrect host for test" 1>&2
    exit 1
fi

t=$1

cat $t

set -x

if ! 9cc "$t" > "$t.s"
then
    exit 1
fi

if ! gcc -o "$t.bin" "$t.s"
then
    exit 1
fi

if ! "$t.bin" > "$t.output" 2>&1
then
    exit 1
fi

if ! diff -u "$t.expected" "$t.output"
then
    exit 1
fi