tests: avoid two spurious failures on FreeBSD
[automake.git] / t / ar-lib.sh
blobc6f6a3c88ee3b8049dbc5a5698334af3c643fe86
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 'ar-lib' wraps the Microsoft Library Manager (lib) correctly.
19 am_create_testdir=empty
20 required=xsi-lib-shell
21 . ./defs || exit 1
23 get_shell_script ar-lib
25 # Use a dummy lib, since lib isn't readily available on all systems.
26 cat >lib <<'END'
27 #! /bin/sh
28 if test x"$2" = x-LIST && test x"$3" = xfake.lib; then
29 echo fake.obj
30 elif test x"$2" = x-LIST && test x"$3" = xfake2.lib; then
31 printf "%s\n" "dir\\fake2.obj"
32 else
33 printf "%s\n" "lib $*"
35 END
37 chmod +x ./lib
39 # Check if ar-lib can create an archive with "cr".
40 opts=$(./ar-lib ./lib cr foo.lib foo.obj)
41 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.obj"
43 # Check if ar-lib can update an existing archive with "r".
44 touch foo.lib
45 opts=$(./ar-lib ./lib r foo.lib foo.obj)
46 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
48 # Check if ar-lib can update an existing archive with "q".
49 opts=$(./ar-lib ./lib q foo.lib foo.obj)
50 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
52 # Check if ar-lib accepts "u" as a modifier.
53 # NOTE: "u" should have an effect, but currently doesn't.
54 opts=$(./ar-lib ./lib ru foo.lib foo.obj)
55 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
57 # Check if ar-lib accepts "s" as a modifier.
58 opts=$(./ar-lib ./lib rs foo.lib foo.obj)
59 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
61 # Check if ar-lib accepts "S" as a modifier.
62 opts=$(./ar-lib ./lib rS foo.lib foo.obj)
63 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
65 # Check if ar-lib passes on @FILE with "r"
66 opts=$(./ar-lib ./lib r foo.lib @list)
67 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list"
69 # Check if ar-lib can delete a member from an archive with "d".
70 opts=$(./ar-lib ./lib d foo.lib foo.obj)
71 test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
73 # Check if ar-lib can delete members in an @FILE.
74 echo foo.obj > foolist
75 opts=$(./ar-lib ./lib d foo.lib @foolist)
76 test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
78 # Check if ar-lib can list archive members with "t".
79 opts=$(./ar-lib ./lib t foo.lib)
80 test x"$opts" = x"lib -NOLOGO -LIST foo.lib"
82 # Check if ar-lib accepts "v" as a modifier.
83 # NOTE: "v" should have an effect, but currently doesn't.
84 opts=$(./ar-lib ./lib tv foo.lib)
85 test x"$opts" = x"lib -NOLOGO -LIST foo.lib"
87 # Check if ar-lib can extract archive members with "x".
88 touch fake.lib
89 opts=$(./ar-lib ./lib x fake.lib)
90 test x"$opts" = x"lib -NOLOGO -EXTRACT:fake.obj fake.lib"
92 # Check if ar-lib can extract specified archive members with "x".
93 opts=$(./ar-lib ./lib x foo.lib foo.obj)
94 test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
96 # Check if ar-lib can extract members in an @FILE.
97 opts=$(./ar-lib ./lib x foo.lib @foolist)
98 test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
100 # Check if ar-lib passes -lib and -LTCG through to the wrappee.
101 opts=$(./ar-lib ./lib -lib -LTCG x foo.lib foo.obj)
102 test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
104 # Check if ar-lib can extract backslashed members.
105 touch fake2.lib
106 opts=$(./ar-lib ./lib x fake2.lib)
107 test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib"
109 # Check if ar-lib accepts "s" as an action.
110 opts=$(./ar-lib ./lib s foo.lib)
111 test x"$opts" = x