1#!/bin/sh
2#
3#	aegis - project change supervisor
4#	Copyright (C) 1994-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
34
35AEGIS_FLAGS="delete_file_preference = no_keep; \
36	lock_wait_preference = always; \
37	diff_preference = automatic_merge; \
38	pager_preference = never; \
39	persevere_preference = all; \
40	log_file_preference = never;"
41export AEGIS_FLAGS
42AEGIS_THROTTLE=-1
43export AEGIS_THROTTLE
44
45here=`pwd`
46if test $? -ne 0 ; then exit 2; fi
47
48if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi
49
50if test "$1" != "" ; then AEGIS_DATADIR=$here/$1/lib; else AEGIS_DATADIR="$here/lib"; fi
51export AEGIS_DATADIR
52
53no_result()
54{
55	set +x
56	echo 'NO RESULT for test of "aegis -report" help and lists' 1>&2
57	cd $here
58	find $work -type d -user $USER -exec chmod u+w {} \;
59	rm -rf $work
60	exit 2
61}
62fail()
63{
64	set +x
65	echo 'FAILED test of "aegis -report" help and lists' 1>&2
66	cd $here
67	find $work -type d -user $USER -exec chmod u+w {} \;
68	rm -rf $work
69	exit 1
70}
71pass()
72{
73	set +x
74	echo PASSED 1>&2
75	cd $here
76	find $work -type d -user $USER -exec chmod u+w {} \;
77	rm -rf $work
78	exit 0
79}
80trap \"no_result\" 1 2 3 15
81
82mkdir $work
83if test $? -ne 0 ; then no_result; fi
84cd $work
85if test $? -ne 0 ; then no_result; fi
86
87mkdir $work/lib $work/lib/report
88if test $? -ne 0 ; then no_result; fi
89
90AEGIS_PATH=$work/lib
91export AEGIS_PATH
92
93#
94# make sure help and list work
95#
96$bin/aegis -rpt -help > /dev/null 2>&1 < /dev/null
97if test $? -ne 0 ; then fail; fi
98$bin/aegis -rpt -list > /dev/null
99if test $? -ne 0 ; then fail; fi
100
101#
102# Only definite negatives are possible.
103# The functionality exercised by this test appears to work,
104# no other guarantees are made.
105#
106pass
107