tests: make 'lzip.test' executable
[automake.git] / tests / compile2.test
blob334f1548d61fdbe44c4c857e6867e7792d97dd06
1 #! /bin/sh
2 # Copyright (C) 2009, 2010 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Make sure `compile' deals correctly with w32 style paths.
19 . ./defs || Exit 1
21 set -e
23 cp "$testsrcdir/../lib/compile" .
25 cat >mycc <<'END'
26 source_seen=no
27 for arg
29 test "X$arg" = X-o && exit 1
30 test "X$arg" = "X$amtest_source" && source_seen=yes
31 done
32 if test "$source_seen" != yes; then
33 echo "$0: no source file seen" >&2
34 exit 1
36 if test ! -f "$amtest_source"; then
37 echo "$0: $amtest_source not readable" >&2
38 exit 1
40 if test ! -d "$amtest_lock"; then
41 echo "$0: no lockdir $amtest_lock" >&2
42 exit 1
44 touch "$amtest_obj"
45 END
47 chmod +x ./mycc
49 # In case this test runs on a system with backslash directory separators:
50 mkdir libltdl libltdl/libltdl
52 # Backslashes in the input and the output name should be accepted.
53 # Since this test might run on non-w32 systems, we need to be careful not
54 # to use any backslash sequences which might be interpreted by `echo'.
55 amtest_source='libltdl\libltdl\slist.c'
56 amtest_object='libltdl\libltdl\libltdl_libltdl_la-slist.obj'
57 amtest_obj='slist.o'
58 amtest_lock='slist_o.d'
59 export amtest_source amtest_object amtest_obj amtest_lock
61 : > "$amtest_source"
62 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
63 test -f "$amtest_object"
66 # Absolute w32 paths should be accepted.
67 # Do not actually run this test on anything that could be w32.
68 test -d "C:\\" && Exit 77
69 case $PATH_SEPARATOR in ';'|':');; *) Exit 77;; esac
71 amtest_source='C:\libltdl\libltdl\slist.c'
72 amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj'
73 amtest_obj='slist.o'
74 amtest_lock='slist_o.d'
75 export amtest_source amtest_object amtest_obj amtest_lock
77 : > "$amtest_source"
78 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
79 test -f "$amtest_object"