test.sh 2.7 KB
Newer Older
Drew's avatar
Drew committed
1 2 3 4 5
#!/bin/bash
set -e

echo "**********THE ATBUILD TEST SCRIPT*************"

6
DIR=`pwd`
Drew's avatar
Drew committed
7 8 9 10 11 12
ATBUILD="`pwd`/.atllbuild/products/atbuild"
pwd

echo "****************SELF-HOSTING TEST**************"
$ATBUILD atbuild

Drew's avatar
Drew committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
echo "****************PUBLISHPRODUCT TEST**************"
cd $DIR/tests/fixtures/publish_product
$ATBUILD

if [ ! -f "bin/executable" ]; then
    echo "No executable"
    exit 1
fi

if [ ! -f "bin/executable.swiftmodule" ]; then
    echo "No module (executable)"
    exit 1
fi

if [ ! -f "bin/library.swiftmodule" ]; then
    echo "No module (library)"
    exit 1
fi

if [ ! -f "bin/library.a" ]; then
    echo "No library"
    exit 1
fi

37 38 39 40
echo "****************NONSTANDARD TEST**************"
cd $DIR/tests/fixtures/nonstandard_package_file
$ATBUILD -f nonstandard.atpkg

41 42 43 44 45 46
echo "****************AGRESSIVE TEST**************"
cd $DIR/tests/fixtures/agressive
if $ATBUILD 2&> /tmp/warnings.txt; then
    echo "No tool specified but passed anyway?"
    exit 1
fi
Drew's avatar
Drew committed
47
if ! grep "No tool for task agressive.default; did you forget to specify it?" /tmp/warnings.txt; then
48 49 50 51
    echo "Got an error other than one prompting for the correct tool"
    exit 1
fi

52 53 54 55 56 57 58
echo "****************SHADOW TEST*********************"
cd $DIR/tests/fixtures/depend_default
if $ATBUILD build-tests; then
    echo "default task was shadowed; expected a failure but got a pass"
    exit 1
fi

59 60 61 62 63 64 65 66 67
echo "****************WARNING TEST*********************"
cd $DIR/tests/fixtures/warnings
$ATBUILD > /tmp/warnings.txt
if ! grep "germany" /tmp/warnings.txt; then
    echo "Was not warned about invalid task key"
    exit 1
fi


Drew's avatar
Drew committed
68
echo "****************HELP TEST*********************"
69 70

if $ATBUILD atbuild --help; then
Drew's avatar
Drew committed
71 72 73 74
    echo "Unusual help exit code"
    exit 1
fi

Drew's avatar
Drew committed
75
echo "*****************XCS TEST**********************"
76
cd $DIR/tests/fixtures/xcs && $ATBUILD run-tests
Drew's avatar
Drew committed
77

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
echo "*****************STRICT CHECKS**********************"
if [ `uname` != "Darwin" ]; then
    echo "Not checking STRICT for non-Darwin platform"
else
    cd $DIR/tests/fixtures/xcs_strict
    if $ATBUILD run-tests; then
        echo "Expected a failure in xcs_strict"
        exit 1
    else
        echo "Strict failed as expected"
    fi

    cd $DIR/tests/fixtures/xcs_strict_2
    if $ATBUILD run-tests; then
        echo "Expected a failure in xcs_strict"
        exit 1
    else
        echo "Strict failed as expected"
    fi
fi

Drew's avatar
Drew committed
99 100 101
echo "*****************OVERLAY CHECKS**********************"

cd $DIR/tests/fixtures/overlay
Drew's avatar
Drew committed
102 103 104 105
if $ATBUILD; then
    echo "Expected a failure in overlay"
    exit 1
fi
Drew's avatar
Drew committed
106

107
$ATBUILD --use-overlay got-overlay
Drew's avatar
Drew committed
108

109
cd $DIR/tests/fixtures/overlay_default
110
if $ATBUILD --use-overlay foo; then
111 112 113 114
    echo "Expected a failure in overlay"
    exit 1
fi

Drew's avatar
Drew committed
115
echo "***ATBUILD TEST SCRIPT PASSED SUCCESSFULLY*****"