forked from lfortran/lfortran
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_lfortran_cmdline
executable file
·74 lines (62 loc) · 1.06 KB
/
test_lfortran_cmdline
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
set -e
set -x
if [[ $1 == "" ]]; then
echo "Test local lfortran"
PATH="$(pwd):$PATH"
FC=lfortran
elif [[ $1 == "gfortran" ]]; then
echo "Test installed gfortran"
FC=gfortran
elif [[ $1 == "lfortran" ]]; then
echo "Test installed lfortran"
FC=lfortran
else
echo "Invalid option"
exit 1
fi
f=`pwd`/examples/expr2.f90
ASM_PATTERN="movq\|movl\|retq"
cd $(mktemp -d)
$FC $f -o a.out
[ -f "a.out" ]
[ -x "a.out" ]
./a.out
cd $(mktemp -d)
$FC -c $f
[ -f "expr2.o" ]
[ ! -x "expr2.o" ]
$FC -o expr2 expr2.o
[ -f "expr2" ]
[ -x "expr2" ]
./expr2
cd $(mktemp -d)
$FC -o xx1 -c $f
[ -f "xx1" ]
[ ! -x "xx1" ]
$FC -o expr2 xx1
[ -f "expr2" ]
[ -x "expr2" ]
./expr2
cd $(mktemp -d)
$FC -o xx1 $f
[ -f "xx1" ]
[ -x "xx1" ]
./xx1
cd $(mktemp -d)
$FC -S $f
[ -f "expr2.s" ]
grep $ASM_PATTERN expr2.s
cd $(mktemp -d)
$FC -S -c $f
[ -f "expr2.s" ]
grep $ASM_PATTERN expr2.s
cd $(mktemp -d)
$FC -S -o xx1 $f
[ -f "xx1" ]
grep $ASM_PATTERN xx1
cd $(mktemp -d)
$FC -S -o xx1 -c $f
[ -f "xx1" ]
grep $ASM_PATTERN xx1
echo "All tests succeeded"