summaryrefslogtreecommitdiff
path: root/debian/tests/tests.sh
blob: 1e41496bb0d506a1d508dd8addf0d094c282cbf2 (plain)
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
#!/bin/bash

names="test1 test2"

oneTimeSetUp() {
    set -u
    cp debian/tests/test*.f90 $AUTOPKGTEST_TMP
}

testSO() {
    cwd=$(pwd)
    cd $AUTOPKGTEST_TMP
    for name in $names
    do
        echo "Building."
        set -x
        gfortran -O3 -march=native -o $name $name.f90 -llbfgsb
        ret=$?
        set +x
        assertEquals 0 $ret
        
        echo "Running."
        ./$name
        ret=$?
        assertEquals 0 $ret
    done
    cd $cwd
}

testStatic() {
    cwd=$(pwd)
    cd $AUTOPKGTEST_TMP
    for name in $names
    do
        echo "Building (statically linked)."
        set -x
        gfortran $name.f90 -O3 -march=native -static -llbfgsb -llapack -lblas -lgfortran -o $name-static
        ret=$?
        set +x
        assertEquals 0 $ret
        
        echo "Running (statically linked)."
        ./$name-static
        ret=$?
        assertEquals 0 $ret
    done
    cd $cwd
}

. shunit2