summaryrefslogtreecommitdiff
blob: f9ff8090c21586024184362d0135aa5638aa22df (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
--- test/Makefile.am
+++ test/Makefile.am
@@ -1,3 +1,5 @@
+AM_TESTS_ENVIRONMENT = \
+	top_srcdir="$(top_srcdir)"
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca
 
--- test/check-copyright
+++ test/check-copyright
@@ -3,10 +3,11 @@
 #
 # Check that the copyright information is valid
 #
+echo "top srcdir: ${top_srcdir:=..}"
 nfails=0
 nfiles=0
 for dir in $(make -s echo-dirs -C ..); do
-  if [ ! -d "../$dir" ]; then continue; fi
+  if [ ! -d "$top_srcdir/$dir" ]; then continue; fi
   for x in $(make -s echo-sources -C ../$dir); do
     case "$x" in
       *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl)
@@ -14,7 +15,7 @@
       *)
         continue ;;
     esac
-    if ! grep 'Copyright *([cC])' "../$dir/$x" >/dev/null 2>&1; then
+    if ! grep 'Copyright *([cC])' "$top_srcdir/$dir/$x" >/dev/null 2>&1; then
       echo "error: $dir/$x lacks proper copyright information"
       nfails=$(($nfails + 1))
     elif [ -d ../.git ]; then
--- test/check-source
+++ test/check-source
@@ -3,6 +3,7 @@
 #
 # Check that we have no tabs or trailing spaces in the source code
 #
+echo "top srcdir: ${top_srcdir:=..}"
 nfails=0
 nfiles=0
 nlines=0
@@ -12,15 +13,15 @@
     case "$x" in
       *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|*.py|*.pl)
         nfiles=$(($nfiles + 1));
-        nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;;
+        nlines=$(($nlines + `grep -c . "$top_srcdir/$dir/$x"`)) ;;
       *)
         continue ;;
     esac
-    if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then
+    if grep '[[:space:]]$' "$top_srcdir/$dir/$x" >/dev/null 2>&1; then
       echo "error: $dir/$x contains trailing spaces"
       nfails=$(($nfails + 1))
     fi
-    if grep '	' "../$dir/$x" >/dev/null 2>&1; then
+    if grep '	' "$top_srcdir/$dir/$x" >/dev/null 2>&1; then
       echo "error: $dir/$x contains tabs"
       nfails=$(($nfails + 1))
     fi