summaryrefslogtreecommitdiff
path: root/dmake/tests/recipes-6
blob: 2a0af305ef6a950516ae2d6bd3c4a9fb32d9dbdb (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh

# 13.11.2006 Volker Quetschke
# Test @@ recipe property with group recipes.
# (issue 71422)

: ${DMAKEPROG:=dmake}
file1="mfile1.mk"
file2="ofile1.out"
tmpfiles="$file1 $file2"

trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15

trap 'rm -rf $tmpfiles' 1 2 3 15 

# Remember to quote variables in generated makefiles( $ -> \$ ).
cat > $file1 <<EOT
# Test @@ recipe
SHELL*:=/bin/sh
SHELLFLAGS*:=-ce
GROUPSHELL*:=/bin/sh
GROUPSUFFIX:=.sh

all :
@@[
  echo someoutput > $file2
  echo something
]
EOT

output1=`eval ${DMAKEPROG} -r -f $file1`
result1=$?
if test "$output1" != ""; then
  echo "Wrong result: $output1"
  result1=1
fi
if test -f $file2; then
  if test `cat $file2` != "someoutput"; then
    echo "Wrong file content: `cat $file2`"
    result1=1
  fi
else
  echo "No such file : $file2"
  result1=1
fi

# Test if -vr enables the output again
output2=`eval ${DMAKEPROG} -vr -rf $file1`
result2=$?
if echo $output2 | grep -v 'echo someoutput > ofile1.out'; then
  echo "Missing output: echo someoutput > ofile1.out"
  result2=1
fi
if echo $output2 | grep -v 'something'; then
  echo "Missing output: something"
  result2=1
fi

if test $result1 -eq 0 -a $result2 -eq 0; then
  echo "Success - Cleaning up"
  rm -f ${tmpfiles}
  exit 0
else
  echo "Failure!"
  exit 1
fi