1#!/bin/sh
2#
3# aegis - project change supervisor.
4# Copyright (C) 2012 Peter Miller
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or (at
9# your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14# General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19
20TEST_SUBJECT="aemakegen, vs autoconf *.in"
21
22# load up standard prelude and test functions
23. test_funcs
24
25AEGIS_PROJECT=projname
26export AEGIS_PROJECT
27
28activity="new project 28"
29aegis -npr ${AEGIS_PROJECT} -version - -v -dir $work/proj.dir \
30    -lib $AEGIS_PATH > log 2>&1
31if test $? -ne 0 ; then cat log; no_result; fi
32
33activity="project attributes 33"
34cat > paf << fubar
35developer_may_review = true;
36developer_may_integrate = true;
37reviewer_may_integrate = true;
38default_test_exemption = true;
39develop_end_action = goto_awaiting_integration;
40default_development_directory = "$work";
41fubar
42if test $? -ne 0 ; then no_result; fi
43aegis -pa -f paf -v > log 2>&1
44if test $? -ne 0 ; then cat log; no_result; fi
45
46activity="staff 46"
47aegis -nd $USER -v > log 2>&1
48if test $? -ne 0 ; then cat log; no_result; fi
49aegis -nrv $USER -v > log 2>&1
50if test $? -ne 0 ; then cat log; no_result; fi
51aegis -ni $USER -v > log 2>&1
52if test $? -ne 0 ; then cat log; no_result; fi
53
54activity="new change 54"
55cat > caf << 'fubar'
56brief_description = "one";
57cause = internal_enhancement;
58test_baseline_exempt = true;
59fubar
60if test $? -ne 0 ; then no_result; fi
61aegis -nc -f caf -v -p $AEGIS_PROJECT > log 2>&1
62if test $? -ne 0 ; then cat log; no_result; fi
63
64activity="develop begin 64"
65aegis -db 10 -v > log 2>&1
66if test $? -ne 0 ; then cat log; no_result; fi
67
68activity="new file 68"
69aegis -nf \
70        $work/${AEGIS_PROJECT}.C010/aegis.conf \
71        $work/${AEGIS_PROJECT}.C010/configure.ac \
72        $work/${AEGIS_PROJECT}.C010/example/main.c \
73        $work/${AEGIS_PROJECT}.C010/example/libdir.c.in \
74        $work/${AEGIS_PROJECT}.C010/example/libdir.h.in \
75        -v > log 2>&1
76if test $? -ne 0 ; then cat log; no_result; fi
77
78cat > $work/${AEGIS_PROJECT}.C010/example/main.c << 'fubar'
79#include <example/libdir.h>
80int main(){return 0;}
81fubar
82if test $? -ne 0 ; then no_result; fi
83
84cat > $work/${AEGIS_PROJECT}.C010/aegis.conf << 'fubar'
85build_command = "exit 0";
86
87history_get_command = "aesvt -check-out -edit ${quote $edit} "
88    "-history ${quote $history} -f ${quote $output}";
89history_put_command = "aesvt -check-in -history ${quote $history} "
90    "-f ${quote $input}";
91history_query_command = "aesvt -query -history ${quote $history}";
92history_content_limitation = binary_capable;
93
94diff_command = "set +e; diff $orig $i > $out; test $$? -le 1";
95diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \
96    echo '1,$$p' ) | ed - $mr > $out";
97link_integration_directory = true;
98
99test_command = "$sh $filename $arch";
100fubar
101if test $? -ne 0 ; then no_result; fi
102
103TAB=`awk 'BEGIN{printf("%c", 9)}' /dev/null`
104
105# ----------  makefile  ----------------------------------------------------
106
107activity="aemakegen 107"
108aemakegen -c 10 --target=makefile > test.out
109if test $? -ne 0 ; then fail; fi
110
111activity="check makefile 111"
112sed "s|{TAB}|${TAB}|g" > ok << 'fubar'
113#
114# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
115#
116#    W   W    A    RRRR   N   N   III  N   N  III  N   N   GGG
117#    W   W   A A   R   R  NN  N    I   NN  N   I   NN  N  G   G
118#    W   W  A   A  RRRR   N N N    I   N N N   I   N N N  G
119#    W W W  AAAAA  R R    N  NN    I   N  NN   I   N  NN  G  GG
120#    W W W  A   A  R  R   N   N    I   N   N   I   N   N  G   G
121#     W W   A   A  R   R  N   N   III  N   N  III  N   N   GGG
122#
123# Warning: DO NOT send patches which fix this file. IT IS NOT the original
124# source file. This file is GENERATED from the Aegis repository file manifest.
125# If you find a bug in this file, it could well be an Aegis bug.
126#
127# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
128#
129
130#
131# @configure_input@
132#
133# The configure script generates 2 files:
134# 1. This Makefile
135# 2. /config.h
136# If you change this Makefile, you may also need to change these files. To see
137# what is configured by the configure script, search for @ in the Makefile.in
138# file.
139#
140# If you wish to reconfigure the installations directories it is RECOMMENDED
141# that you re-run the configure script.
142#
143# Use "./configure --help" for a list of options.
144#
145
146#
147# directory containing the source
148#
149srcdir = @srcdir@
150VPATH = @srcdir@
151
152#
153# the name of the install program to use
154#
155INSTALL = @INSTALL@
156INSTALL_PROGRAM = @INSTALL_PROGRAM@
157INSTALL_DIR = @INSTALL@ -m 0755 -d
158
159#
160# The name of the C compiler to use.
161#
162CC = @CC@
163
164#
165# The C compiler flags to use.
166#
167CFLAGS = @CFLAGS@
168
169#
170# The C preprocessor flags to use.
171#
172CPPFLAGS = @CPPFLAGS@
173
174#
175# The linker flags to use
176#
177LDFLAGS = @LDFLAGS@
178
179#
180# prefix for installation path
181#
182prefix = @prefix@
183exec_prefix = @exec_prefix@
184
185#
186# Where to put the executables.
187#
188# On a network, this would only be shared between machines of identical
189# cpu-hw-os flavour. It can be read-only.
190#
191# The $(DESTDIR) is for packaging.
192#
193bindir = $(DESTDIR)@bindir@
194
195# define this to silence ./configure warning
196datarootdir = $(DESTDIR)@datarootdir@
197
198#
199# extra libraries required for your system
200#
201LIBS = @LIBS@
202
203#
204# shell to use to run tests and commands
205#
206SH = @SH@
207
208# ---------------------------------------------------------
209# You should not need to change anything below this line.
210
211#
212# The default target
213#
214the-default-target: all
215
216example/libdir.c: config.status example/libdir.c.in
217{TAB}CONFIG_FILES=$@:example/libdir.c.in CONFIG_HEADERS= $(SH) config.status
218
219example/libdir.o: example/libdir.c
220{TAB}$(CC) $(CPPFLAGS) $(CFLAGS) -I. -c example/libdir.c
221{TAB}mv libdir.o $@
222
223example/libdir.h: config.status example/libdir.h.in
224{TAB}CONFIG_FILES= CONFIG_HEADERS=$@:example/libdir.h.in $(SH) config.status
225
226example/main.o: example/libdir.h example/main.c
227{TAB}$(CC) $(CPPFLAGS) $(CFLAGS) -I. -c example/main.c
228{TAB}mv main.o $@
229
230.mkdir.__bindir_:
231{TAB}-$(INSTALL_DIR) $(bindir)
232{TAB}@-test -d $(bindir) && touch $@
233{TAB}@sleep 1
234
235#
236# The example program.
237#
238example_obj = example/libdir.o example/main.o
239
240bin/example: $(example_obj) .bin
241{TAB}$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(example_obj) $(LDFLAGS) $(LIBS)
242
243$(bindir)/example: .mkdir.__bindir_ bin/example
244{TAB}$(INSTALL_PROGRAM) bin/example $@
245
246all: all-bin
247
248all-bin: bin/example
249
250.bin:
251{TAB}-mkdir bin
252{TAB}-chmod 0755 bin
253{TAB}@-test -d bin && touch $@
254{TAB}@sleep 1
255
256check: sure
257
258sure:
259{TAB}@echo Passed All Tests
260
261clean: clean-bin clean-misc clean-obj
262
263clean-bin:
264{TAB}rm -f bin/example
265
266clean-misc:
267{TAB}rm -f .bin .mkdir.__bindir_ core
268
269clean-obj:
270{TAB}rm -f example/libdir.o example/main.o
271
272distclean: clean distclean-directories distclean-files
273
274distclean-files:
275{TAB}rm -f Makefile config.cache config.log config.status example/libdir.c
276{TAB}rm -f example/libdir.h
277
278distclean-directories:
279{TAB}rm -rf bin
280
281install: install-bin
282
283install-bin: $(bindir)/example
284
285uninstall:
286{TAB}rm -f $(bindir)/example
287
288.PHONY: all all-bin check clean clean-bin distclean distclean-directories \
289{TAB}{TAB}distclean-files install install-bin sure the-default-target
290
291# vim: set ts=8 sw=8 noet :
292fubar
293if test $? -ne 0 ; then no_result; fi
294
295diff -u ok test.out
296if test $? -ne 0 ; then fail; fi
297
298# ----------  automake  ----------------------------------------------------
299
300activity="aemakegen 300"
301aemakegen -c 10 --target=automake > test.out
302if test $? -ne 0 ; then fail; fi
303
304activity="check makefile 304"
305sed "s|{TAB}|${TAB}|g" > ok << 'fubar'
306#
307# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
308#
309#    W   W    A    RRRR   N   N   III  N   N  III  N   N   GGG
310#    W   W   A A   R   R  NN  N    I   NN  N   I   NN  N  G   G
311#    W   W  A   A  RRRR   N N N    I   N N N   I   N N N  G
312#    W W W  AAAAA  R R    N  NN    I   N  NN   I   N  NN  G  GG
313#    W W W  A   A  R  R   N   N    I   N   N   I   N   N  G   G
314#     W W   A   A  R   R  N   N   III  N   N  III  N   N   GGG
315#
316# Warning: DO NOT send patches which fix this file. IT IS NOT the original
317# source file. This file is GENERATED from the Aegis repository file manifest.
318# If you find a bug in this file, it could well be an Aegis bug.
319#
320# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
321#
322
323#
324# Tell automake to put the object file for foo/bar.cc in directory foo/
325#
326AUTOMAKE_OPTIONS = subdir-objects
327
328example/libdir.c: config.status example/libdir.c.in
329{TAB}CONFIG_FILES=$@:example/libdir.c.in CONFIG_HEADERS= $(SH) config.status
330
331example/libdir.h: config.status example/libdir.h.in
332{TAB}CONFIG_FILES= CONFIG_HEADERS=$@:example/libdir.h.in $(SH) config.status
333
334# executables to be installed
335bin_PROGRAMS = bin/example
336
337# Files to be removed by the "distclean" make target.
338DISTCLEANFILES = example/libdir.c example/libdir.h
339
340# The example program.
341bin_example_includes = example/libdir.h
342bin_example_SOURCES = example/libdir.c example/libdir.c.in example/libdir.h.in \
343{TAB}{TAB}example/main.c
344
345# Additional source files to be included in the tarball.
346EXTRA_DIST = aegis.conf configure.ac example/libdir.c.in example/libdir.h.in
347
348# Catch-22 when building dependencies.
349BUILT_SOURCES = example/libdir.c example/libdir.h
350
351# vim: set ts=8 sw=8 noet :
352fubar
353if test $? -ne 0 ; then no_result; fi
354
355diff -u ok test.out
356if test $? -ne 0 ; then fail; fi
357
358#
359# Only definite negatives are possible.
360# The functionality exercised by this test appears to work,
361# no other guarantees are made.
362#
363pass
364# vim: set ts=8 sw=4 et :
365