1#!/bin/sh
2#
3#	aegis - project change supervisor
4#	Copyright (C) 1996-1998, 2006-2008 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
9#	(at 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
14#	GNU General Public License for more details.
15#
16#	You should have received a copy of the GNU General Public License
17#	along with this program. If not, see
18#	<http://www.gnu.org/licenses/>.
19#
20
21unset AEGIS_PROJECT
22unset AEGIS_CHANGE
23unset AEGIS_PATH
24unset AEGIS
25unset LINES
26unset COLS
27umask 022
28
29USER=${USER:-${LOGNAME:-`whoami`}}
30
31work=${AEGIS_TMP:-/tmp}/$$
32PAGER=cat
33export PAGER
34AEGIS_FLAGS="delete_file_preference = no_keep; \
35	lock_wait_preference = always; \
36	diff_preference = automatic_merge; \
37	pager_preference = never; \
38	persevere_preference = all; \
39	log_file_preference = never;"
40export AEGIS_FLAGS
41AEGIS_THROTTLE=-1
42export AEGIS_THROTTLE
43
44here=`pwd`
45if test $? -ne 0 ; then exit 2; fi
46
47bin=$here/${1-.}/bin
48
49pass()
50{
51	set +x
52	echo PASSED 1>&2
53	cd $here
54	find $work -type d -user $USER -exec chmod u+w {} \;
55	rm -rf $work
56	exit 0
57}
58fail()
59{
60	set +x
61	echo 'FAILED test of the strftime report functionality' 1>&2
62	cd $here
63	find $work -type d -user $USER -exec chmod u+w {} \;
64	rm -rf $work
65	exit 1
66}
67no_result()
68{
69	set +x
70	echo 'NO RESULT for test of the strftime report functionality' 1>&2
71	cd $here
72	find $work -type d -user $USER -exec chmod u+w {} \;
73	rm -rf $work
74	exit 2
75}
76trap \"no_result\" 1 2 3 15
77
78mkdir $work $work/lib
79if test $? -ne 0 ; then no_result; fi
80chmod 777 $work/lib
81if test $? -ne 0 ; then no_result; fi
82cd $work
83if test $? -ne 0 ; then no_result; fi
84
85#
86# use the built-in error messages
87#
88AEGIS_MESSAGE_LIBRARY=$work/no-such-dir
89export AEGIS_MESSAGE_LIBRARY
90unset LANG
91unset LANGUAGE
92
93#
94# test the strftime report functionality
95#
96cat > test.in << 'fubar'
97columns(80);
98print(strftime("%d-%b-%Y", 830347200));
99fubar
100if test $? -ne 0 ; then no_result; fi
101cat > test.ok << 'fubar'
10224-Apr-1996
103fubar
104if test $? -ne 0 ; then no_result; fi
105$bin/aegis -report -f test.in -pw 1000 -unf > test.out
106if test $? -ne 0 ; then fail; fi
107diff test.ok test.out
108if test $? -ne 0 ; then fail; fi
109
110#
111# Only definite negatives are possible.
112# The functionality exercised by this test appears to work,
113# no other guarantees are made.
114#
115pass
116