Debug on SWI support
[riscose.git] / tests / argv
blob444a7056a3625aefa5750443506509bd50dd33dd
1 #! /bin/sh
3 set -e
5 r=../src/riscose
7 # should fail if no arguments given.
8 set +e
9 $r >tmp.1 2>tmp.2
10 e=$?
11 set -e
12 test $e -eq 1
13 test `wc -c <tmp.1` -eq 0
14 test `wc -l <tmp.2` -eq 1
15 grep 'no risc os executable specified' tmp.2 >/dev/null
17 # check version number is correct and that long arguments are working.
18 for a in -V --version; do
19 set +e
20 $r $a >tmp.1 2>tmp.2
21 e=$?
22 set -e
23 test $e -eq 0
24 test `wc -l <tmp.1` -eq 1
25 test `wc -c <tmp.2` -eq 0
26 grep "version $VERSION"\$ tmp.1 >/dev/null
27 done
29 # help option works.
30 set +e
31 $r -h >tmp.1 2>tmp.2
32 e=$?
33 set -e
34 test $e -eq 0
35 test `wc -l <tmp.1` -gt 5
36 test `wc -c <tmp.2` -eq 0
37 sed 1q tmp.1 | grep 'usage: riscose ' >/dev/null
38 awk '/^ -/ {i++} END {i < 5}' tmp.1
40 # binary must exist.
41 set +e
42 rm -f tmp
43 $r tmp >tmp.1 2>tmp.2
44 e=$?
45 set -e
46 test $e -eq 1
47 test `wc -c <tmp.1` -eq 0
48 test `wc -l <tmp.2` -eq 1
49 grep '^riscose: error: file "tmp" not found$' tmp.2 >/dev/null
51 # binary can't be an empty file.
52 set +e
53 >tmp
54 $r tmp >tmp.1 2>tmp.2
55 e=$?
56 set -e
57 test $e -eq 1
58 test `wc -c <tmp.1` -eq 0
59 test `wc -l <tmp.2` -eq 1
60 grep '^riscose: error: file "tmp" is empty$' tmp.2 >/dev/null
62 rm tmp tmp.1 tmp.2