1#! /bin/sh
2#  -*- Mode: Shell-script -*-
3#
4# forin.test --- test forin functionality
5#
6# Author:            Bruce Korb <bkorb@gnu.org>
7#
8##
9## This file is part of AutoGen.
10## AutoGen Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
11##
12## AutoGen is free software: you can redistribute it and/or modify it
13## under the terms of the GNU General Public License as published by the
14## Free Software Foundation, either version 3 of the License, or
15## (at your option) any later version.
16##
17## AutoGen is distributed in the hope that it will be useful, but
18## WITHOUT ANY WARRANTY; without even the implied warranty of
19## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20## See the GNU General Public License for more details.
21##
22## You should have received a copy of the GNU General Public License along
23## with this program.  If not, see <http://www.gnu.org/licenses/>.
24
25. ./defs
26
27# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
28set -x
29echo creating ${testname}.tpl in `pwd`
30cat > ${testname}.tpl <<_EOF_
31[+ AutoGen5 template out +]
32[+
33FOR t IN build host target      +][+
34  FOR v IN alias cpu vendor os  +]
35[+t+]_[+v+]=@[+t+]_[+v+]@[+
36  ENDFOR  +]
37[+t+]_canonical=@[+t+]_cpu@-@[+t+]_vendor@-@[+t+]_os@
38[+
39
40ENDFOR
41
42+]
43_EOF_
44
45# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
46
47echo creating ${testname}.ok
48# this is the output we should expect to see
49cat > ${testname}.ok <<'_EOF_'
50
51build_alias=@build_alias@
52build_cpu=@build_cpu@
53build_vendor=@build_vendor@
54build_os=@build_os@
55build_canonical=@build_cpu@-@build_vendor@-@build_os@
56
57host_alias=@host_alias@
58host_cpu=@host_cpu@
59host_vendor=@host_vendor@
60host_os=@host_os@
61host_canonical=@host_cpu@-@host_vendor@-@host_os@
62
63target_alias=@target_alias@
64target_cpu=@target_cpu@
65target_vendor=@target_vendor@
66target_os=@target_os@
67target_canonical=@target_cpu@-@target_vendor@-@target_os@
68
69_EOF_
70
71run_ag x --no-def -T${testname}.tpl -b ${testname} || \
72  failure autogen failed
73cmp -s ${testname}.ok ${testname}.out || \
74  failure "`diff ${testname}.ok ${testname}.out`"
75
76cleanup
77
78## Local Variables:
79## mode: shell-script
80## indent-tabs-mode: nil
81## sh-indentation: 2
82## sh-basic-offset: 2
83## End:
84
85# end of forin.test
86