1#!/bin/sh
2#
3#	aegis - project change supervisor
4#	Copyright (C) 1994-1999, 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}/$$
32
33here=`pwd`
34if test $? -ne 0 ; then exit 2; fi
35
36if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi
37
38no_result()
39{
40	set +x
41	echo "NO RESULT for test of aedist -send -baseline functionality ($activity)" 1>&2
42	cd $here
43	find $work -type d -user $USER -exec chmod u+w {} \;
44	rm -rf $work
45	exit 2
46}
47fail()
48{
49	set +x
50	echo "FAILED test of aedist -send -baseline functionality ($activity)" 1>&2
51	cd $here
52	find $work -type d -user $USER -exec chmod u+w {} \;
53	rm -rf $work
54	exit 1
55}
56pass()
57{
58	set +x
59	echo PASSED 1>&2
60	cd $here
61	find $work -type d -user $USER -exec chmod u+w {} \;
62	rm -rf $work
63	exit 0
64}
65trap "no_result" 1 2 3 15
66
67#
68# some variable to make things earier to read
69#
70PAGER=cat
71export PAGER
72
73AEGIS_FLAGS="delete_file_preference = no_keep; \
74	lock_wait_preference = always; \
75	diff_preference = automatic_merge; \
76	pager_preference = never; \
77	persevere_preference = all; \
78	log_file_preference = never;"
79export AEGIS_FLAGS
80AEGIS_THROTTLE=-1
81export AEGIS_THROTTLE
82
83worklib=$work/lib
84workproj=$work/foo.proj
85workchan=$work/foo.chan
86tmp=$work/tmp
87AEGIS_PATH=$worklib ; export AEGIS_PATH
88AEGIS_PROJECT=foo ; export AEGIS_PROJECT
89
90#
91# make the directories
92#
93activity="working directory 96"
94mkdir $work $work/lib
95if test $? -ne 0 ; then no_result; fi
96chmod 777 $work/lib
97if test $? -ne 0 ; then no_result; fi
98cd $work
99if test $? -ne 0 ; then no_result; fi
100
101#
102# use the built-in error messages
103#
104AEGIS_MESSAGE_LIBRARY=$work/no-such-dir
105export AEGIS_MESSAGE_LIBRARY
106unset LANG
107unset LANGUAGE
108
109activity="text, no headers, line 112"
110
111cat > test.ae << 'fubar'
112H4sIAAAAAAAAA5VSwWrDMAztNf4Kt+eljZtBB6WHHXYY7FR6GyMorpJ6pE6wlW0w9u+z17Q0
113poPEGISkJ/k9S8kqWSWCn86ffRBw3/lJYEXg5//gAisudUhy0Zj6HSXFGo44YYClsvN0LgRj
114yTWX5SguYrkfxoUX11zkAXSJsUWaMMZyo7DI9milUQ2pWvMNn9FBWe4ucEJLszUL8rtenp86
115ctdx7rASWosOpTSh0VBleVuumQdm+IXHhlyOTItdLAeLldIYJg2WBq11L2a3ai0B+VfgExQp
116XToJH1jVzRE1uayRfMNeWfTNoqhQFWb+58/SYnch7qRFEchOlzTomvpQa6H0cFu3RvrIzx17
117W7vv6s8rHbk7xcDdSc++07HoM/Yz648n4JSM5DTUXvZ+t318fnnaTqdTz+UX2SjIU0wDAAA=
118fubar
119test "$?" -eq 0 || no_result
120
121$bin/aedist -l -f test.ae -o test.out
122test "$?" -eq 0 || fail
123
124#
125# the things tested in this test, worked
126#
127pass
128