1#!/bin/sh
2#
3#       aegis - project change supervisor
4#       Copyright (C) 1994-1999, 2006-2009, 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
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 input_uudecode 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 input_uudecode 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="uudecode, no headers, line 112"
110
111cat > test.ae.uue << 'fubar'
112
113begin 644 test.ae
114M'XL(`````````Y52P6K#,`SM-?X*M^>EC9M!!Z6''788[%1Z&R,HKI)ZI$ZP
115ME6TP]N^SU[0TIH/$&(2D)_D]2\DJ626"G\Z??1!PW_E)8$7@Y__@`BLN=4AR
116MT9CZ'27%&HXX88"ELO-T+@1CR367Y2@N8KD?QH47UUSD`72)L46:,,9RH[#(
117M]FBE40VI6O,-G]%!6>XN<$)+LS4+\KM>GI\Z<M=Q[K`26HL.I32AT5!E>5NN
118MF0=F^(7'AER.3(M=+`>+E=(8)@V6!JUU+V:W:BT!^5?@$Q0I73H)'UC5S1$U
119MN:R1?,->6?3-HJA0%6;^Y\_28G<A[J1%$<A.ES3HFOI0:Z'T<%NW1OK(SQU[
120M6[OOZL\K';D[Q<#=2<^^T['H,_8SZX\GX)2,Y#347O9^MWU\?GG:3J=3S^47
121(V2C(4TP#````
122`
123end
124fubar
125test "$?" -eq 0 || no_result
126
127$bin/test_base64 -uu -i test.ae.uue test.ae
128test "$?" -eq 0 || no_result
129
130$bin/aedist -l -f test.ae -o test.out
131test "$?" -eq 0 || fail
132
133#
134# the things tested in this test, worked
135#
136pass
137# vim: set ts=8 sw=4 et :
138