tinycc/bootstrap/libc/test/base/test.sh

31 lines
677 B
Bash

#! /usr/bin/env bash
# Args: <compiler>
# Test exists
cd "$(dirname "$0")" &&
(
echo TEST: exit_0 &&
$1 -I../../../include -o exit_0.test exit_0.c ../libc.a &&
(
./exit_0.test
if [ "$?" != "0" ]; then exit 1; fi
) || ( echo FAILED; exit 1 )
) &&
(
echo TEST: exit_1 &&
$1 -I../../../include -o exit_1.test exit_1.c ../libc.a &&
(
./exit_1.test
if [ "$?" != "1" ]; then exit 1; fi
) || ( echo FAILED; exit 1 )
) &&
(
echo TEST: exit_2 &&
$1 -I../../../include -o exit_2.test exit_2.c ../libc.a &&
(
./exit_2.test
if [ "$?" != "2" ]; then exit 1; fi
) || ( echo FAILED; exit 1 )
)