Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 60 lines (45 sloc) 1.57 kb
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#!/bin/bash

runTest() {
    module=$1
    echo "Running test $module..."

    ghc_output=`runghc -DTEST_MODULE=$module TestDriver.hs`

    hastec --start=asap -DTEST_MODULE=$module TestDriver.hs > /dev/null 2>&1
    haste_output=`js TestDriver.js`

    hastec -O2 --start=asap -DO2 -DTEST_MODULE=$module TestDriver.hs > /dev/null 2>&1
    haste_opt_output=`js TestDriver.js`

    hastec -O2 --opt-tce --start=asap -DTEST_MODULE=$module TestDriver.hs > /dev/null 2>&1
    haste_tce_output=`js TestDriver.js`

    if [[ "$ghc_output" != "$haste_output" ]] ; then
thistest="failed"
        echo " GHC disagrees with hastec output!"
        echo " GHC says '$ghc_output', but hastec says '$haste_output'"
    fi

if [[ "$ghc_output" != "$haste_opt_output" ]] ; then
thistest="failed"
        echo " GHC disagrees with hastec -O2 output!"
        echo " GHC says '$ghc_output', but hastec says '$haste_opt_output'"
    fi

if [[ "$ghc_output" != "$haste_tce_output" ]] ; then
thistest="failed"
        echo " GHC disagrees with hastec -O2 --opt-tce output!"
        echo " GHC says '$ghc_output', but hastec says '$haste_tce_output'"
    fi
}

if [[ "$1" != "" ]] ; then
runTest $1
    exit 0
fi

let failed=0
let tests=0

for file in Tests/*.hs; do
let tests=$tests+1
    thistest="success"

    module=`echo $file | sed -e s/Tests\\\/// | sed -e s/\.hs//`
    runTest $module

    if [[ $thistest == "failed" ]] ; then
let failed=$failed+1
    fi
done

echo
let success=$tests-$failed
echo "$success/$tests succeeded"
Something went wrong with that request. Please try again.