Jiri Olsa | c819e2c | 2014-12-29 13:51:45 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | function test_ex { |
| 4 | make -C ex V=1 clean > ex.out 2>&1 |
| 5 | make -C ex V=1 >> ex.out 2>&1 |
| 6 | |
| 7 | if [ ! -x ./ex/ex ]; then |
| 8 | echo FAILED |
| 9 | exit -1 |
| 10 | fi |
| 11 | |
| 12 | make -C ex V=1 clean > /dev/null 2>&1 |
| 13 | rm -f ex.out |
| 14 | } |
| 15 | |
| 16 | function test_ex_suffix { |
| 17 | make -C ex V=1 clean > ex.out 2>&1 |
| 18 | |
| 19 | # use -rR to disable make's builtin rules |
| 20 | make -rR -C ex V=1 ex.o >> ex.out 2>&1 |
| 21 | make -rR -C ex V=1 ex.i >> ex.out 2>&1 |
| 22 | make -rR -C ex V=1 ex.s >> ex.out 2>&1 |
| 23 | |
| 24 | if [ -x ./ex/ex ]; then |
| 25 | echo FAILED |
| 26 | exit -1 |
| 27 | fi |
| 28 | |
| 29 | if [ ! -f ./ex/ex.o -o ! -f ./ex/ex.i -o ! -f ./ex/ex.s ]; then |
| 30 | echo FAILED |
| 31 | exit -1 |
| 32 | fi |
| 33 | |
| 34 | make -C ex V=1 clean > /dev/null 2>&1 |
| 35 | rm -f ex.out |
| 36 | } |
Jiri Olsa | 0c00c3f | 2015-09-23 12:33:57 +0200 | [diff] [blame] | 37 | |
| 38 | function test_ex_include { |
| 39 | make -C ex V=1 clean > ex.out 2>&1 |
| 40 | |
| 41 | # build with krava.h include |
| 42 | touch ex/krava.h |
| 43 | make -C ex V=1 CFLAGS=-DINCLUDE >> ex.out 2>&1 |
| 44 | |
| 45 | if [ ! -x ./ex/ex ]; then |
| 46 | echo FAILED |
| 47 | exit -1 |
| 48 | fi |
| 49 | |
| 50 | # build without the include |
| 51 | rm -f ex/krava.h ex/ex |
| 52 | make -C ex V=1 >> ex.out 2>&1 |
| 53 | |
| 54 | if [ ! -x ./ex/ex ]; then |
| 55 | echo FAILED |
| 56 | exit -1 |
| 57 | fi |
| 58 | |
| 59 | make -C ex V=1 clean > /dev/null 2>&1 |
| 60 | rm -f ex.out |
| 61 | } |
| 62 | |
Jiri Olsa | c819e2c | 2014-12-29 13:51:45 +0100 | [diff] [blame] | 63 | echo -n Testing.. |
| 64 | |
| 65 | test_ex |
| 66 | test_ex_suffix |
Jiri Olsa | 0c00c3f | 2015-09-23 12:33:57 +0200 | [diff] [blame] | 67 | test_ex_include |
Jiri Olsa | c819e2c | 2014-12-29 13:51:45 +0100 | [diff] [blame] | 68 | |
| 69 | echo OK |