]> git.saurik.com Git - apple/ld64.git/blob - ld64-134.9/unit-tests/clean-tests
4c38b4e002d26704657bc3cf05738cfa25bae30d
[apple/ld64.git] / ld64-134.9 / unit-tests / clean-tests
1 find_makefile()
2 {
3 local j
4
5 MF=""
6
7 if [ ! -d $1 ]
8 then
9 return 1
10 fi
11
12 for j in Makefile makefile Makefile.newtest makefile.newtest
13 do
14 [ -f $1/$j ] && MF=$j
15 done
16
17 [ "$MF" ] && return 0
18 return 1
19 }
20
21 find_path_to_test_dir()
22 {
23 # FIND THE PATH TO THE TEST DIR
24 # SO THAT WE CAN ADD THE BIN DIR INTO
25 # THE SEARCH PATH
26
27 # remember the top level execution dir
28 chmod +x "$0" # just in case
29
30 #add path to $0 into search
31 savedir=$PWD
32 DIRNAME=`dirname $0`
33 [ -d "$DIRNAME" ] && cd "$DIRNAME"
34 PATH=$PATH:$PWD
35 cd "$savedir"
36
37 chmod +x "$0" # just in case
38 EXECNAME=`which $0`
39 DIRNAME=`dirname "$EXECNAME"`
40 if [ -d "$DIRNAME" ]
41 then
42 TEST_HOME_DIR="$DIRNAME"
43 else
44 TEST_HOME_DIR="$savedir" # Give up and assume current dir
45 fi
46
47 PATH="$PATH":"$TEST_HOME_DIR"/bin:"$savedir"
48 }
49
50 find_path_to_test_dir
51
52 cd "$TEST_HOME_DIR/test-cases"
53
54 for i in *
55 do
56 [ -d "$i" ] &&
57 (
58 if find_makefile $i
59 then
60 make -C $i -f $MF -s -k clean >/dev/null 2>/dev/null
61 fi
62 )
63 done