1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1999, 2005-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 25umask 022 26 27LINES=24 28export LINES 29COLS=80 30export COLS 31 32USER=${USER:-${LOGNAME:-`whoami`}} 33 34work=${AEGIS_TMP:-/tmp}/$$ 35PAGER=cat 36export PAGER 37AEGIS_FLAGS="delete_file_preference = no_keep; \ 38 lock_wait_preference = always; \ 39 diff_preference = automatic_merge; \ 40 pager_preference = never; \ 41 persevere_preference = all; \ 42 log_file_preference = never;" 43export AEGIS_FLAGS 44AEGIS_THROTTLE=-1 45export AEGIS_THROTTLE 46 47here=`pwd` 48if test $? -ne 0 ; then exit 2; fi 49 50bin=$here/${1-.}/bin 51 52pass() 53{ 54 set +x 55 echo PASSED 1>&2 56 cd $here 57 find $work -type d -user $USER -exec chmod u+w {} \; 58 rm -rf $work 59 exit 0 60} 61fail() 62{ 63 set +x 64 echo 'FAILED test of the base64 ofilter functionality' 1>&2 65 cd $here 66 find $work -type d -user $USER -exec chmod u+w {} \; 67 rm -rf $work 68 exit 1 69} 70no_result() 71{ 72 set +x 73 echo 'NO RESULT when testing the base64 ofilter functionality' 1>&2 74 cd $here 75 find $work -type d -user $USER -exec chmod u+w {} \; 76 rm -rf $work 77 exit 2 78} 79trap \"no_result\" 1 2 3 15 80 81mkdir $work $work/lib 82if test $? -ne 0 ; then no_result; fi 83chmod 777 $work/lib 84if test $? -ne 0 ; then no_result; fi 85cd $work 86if test $? -ne 0 ; then no_result; fi 87 88# 89# use the built-in error messages 90# 91AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 92export AEGIS_MESSAGE_LIBRARY 93unset LANG 94unset LANGUAGE 95 96# 97# test the base64 ofilter functionality 98# 99cat > test.in << 'fubar' 100The quick brown fox jumps over the lazy dog. 101fubar 102if test $? -ne 0 ; then fail; fi 103 104cat > test.ok << 'fubar' 105Content-Type: application/x-aegis-test 106Content-Transfer-Encoding: base64 107 108VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4K 109fubar 110if test $? -ne 0 ; then fail; fi 111 112$bin/test_base64 -o test.in test.out 113if test $? -ne 0 ; then fail; fi 114 115diff -b test.ok test.out 116if test $? -ne 0 ; then fail; fi 117 118# 119# test the base64 ofilter functionality 120# 121cat > test.in << 'fubar' 122The quick brown fox jumps over the lazy dog. The quick brown fox jumps 123over the lazy dog. 124fubar 125if test $? -ne 0 ; then fail; fi 126 127cat > test.ok << 'fubar' 128Content-Type: application/x-aegis-test 129Content-Transfer-Encoding: base64 130 131VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4gIFRoZSBxdWlj 132ayBicm93biBmb3gganVtcHMKb3ZlciB0aGUgbGF6eSBkb2cuCg== 133fubar 134if test $? -ne 0 ; then fail; fi 135 136$bin/test_base64 -o test.in test.out 137if test $? -ne 0 ; then fail; fi 138 139# 140# test the base64 ofilter functionality 141# 142cat > test.in << 'fubar' 143The quick brown fox jumps over the lazy dog. The quick brown fox jumps 144over the lazy dog. The quick brown fox jumps over the lazy dog. 145fubar 146if test $? -ne 0 ; then fail; fi 147 148cat > test.ok << 'fubar' 149Content-Type: application/x-aegis-test 150Content-Transfer-Encoding: base64 151 152VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4gIFRoZSBxdWlj 153ayBicm93biBmb3gganVtcHMKb3ZlciB0aGUgbGF6eSBkb2cuICBUaGUgcXVpY2sgYnJvd24g 154Zm94IGp1bXBzIG92ZXIgdGhlIGxhenkgZG9nLgo= 155fubar 156if test $? -ne 0 ; then fail; fi 157 158$bin/test_base64 --output test.in test.out 159if test $? -ne 0 ; then fail; fi 160 161diff -b test.ok test.out 162if test $? -ne 0 ; then fail; fi 163 164# 165# Only definite negatives are possible. 166# The functionality exercised by this test appears to work, 167# no other guarantees are made. 168# 169pass 170