1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 2007, 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 (at 9# 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 GNU 14# General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License along 17# with this program. If not, see <http://www.gnu.org/licenses/>. 18# 19 20unset AEGIS_PROJECT 21unset AEGIS_CHANGE 22unset AEGIS_PATH 23unset AEGIS 24umask 022 25 26LINES=24 27export LINES 28COLS=80 29export COLS 30 31USER=${USER:-${LOGNAME:-`whoami`}} 32 33work=${AEGIS_TMP:-/tmp}/$$ 34PAGER=cat 35export PAGER 36AEGIS_FLAGS="delete_file_preference = no_keep; \ 37 lock_wait_preference = always; \ 38 diff_preference = automatic_merge; \ 39 pager_preference = never; \ 40 persevere_preference = all; \ 41 log_file_preference = never; \ 42 default_development_directory = \"$work\";" 43export AEGIS_FLAGS 44AEGIS_THROTTLE=-1 45export AEGIS_THROTTLE 46 47# This tells aeintegratq that it is being used by a test. 48AEGIS_TEST_DIR=$work 49export AEGIS_TEST_DIR 50 51here=`pwd` 52if test $? -ne 0 ; then exit 2; fi 53 54parch= 55test "$1" != "" && parch="$1/" 56bin="$here/${parch}bin" 57 58if test "$EXEC_SEARCH_PATH" != "" 59then 60 tpath= 61 hold="$IFS" 62 IFS=":$IFS" 63 for tpath2 in $EXEC_SEARCH_PATH 64 do 65 tpath=${tpath}${tpath2}/${parch}bin: 66 done 67 IFS="$hold" 68 PATH=${tpath}${PATH} 69else 70 PATH=${bin}:${PATH} 71fi 72export PATH 73 74AEGIS_DATADIR=$here/lib 75export AEGIS_DATADIR 76 77# 78# set the path, so that the aegis command that aepatch/aedist invokes 79# is from the same test set as the aepatch/aedist command itself. 80# 81PATH=${bin}:$PATH 82export PATH 83 84pass() 85{ 86 set +x 87 echo PASSED 1>&2 88 cd $here 89 find $work -type d -user $USER -exec chmod u+w {} \; 90 rm -rf $work 91 exit 0 92} 93fail() 94{ 95 set +x 96 echo "FAILED test of the aer getenv() functionality" 1>&2 97 cd $here 98 find $work -type d -user $USER -exec chmod u+w {} \; 99 rm -rf $work 100 exit 1 101} 102no_result() 103{ 104 set +x 105 echo "NO RESULT when testing the aer getenv() functionality" 1>&2 106 cd $here 107 find $work -type d -user $USER -exec chmod u+w {} \; 108 rm -rf $work 109 exit 2 110} 111trap \"no_result\" 1 2 3 15 112 113activity="create test directory 113" 114mkdir $work $work/lib 115if test $? -ne 0 ; then no_result; fi 116chmod 777 $work/lib 117if test $? -ne 0 ; then no_result; fi 118cd $work 119if test $? -ne 0 ; then no_result; fi 120 121# 122# use the built-in error messages 123# 124AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 125export AEGIS_MESSAGE_LIBRARY 126unset LANG 127unset LANGUAGE 128 129# 130# test the aer getenv() functionality 131# 132$bin/aegis -np foo -dir $work/proj -lib $work/lib 133if test $? -ne 0 ; then no_result; fi 134 135cat > test.in << 'fubar' 136columns(80); 137auto s1; 138auto s2; 139s1=getenv("AEGIS_MESSAGE_LIBRARY"); 140s2=getenv("LANGUAGE"); 141print(s1); 142print(s2); 143fubar 144test $? -eq 0 || no_result 145 146cat > test.ok << fubar 147$work/no-such-dir 148 149fubar 150test $? -eq 0 || no_result 151 152$bin/aereport -unf -f test.in -o test.out 153test $? -eq 0 || fail 154 155diff test.ok test.out 156if test $? -ne 0 ; then fail; fi 157 158# 159# Only definite negatives are possible. 160# The functionality exercised by this test appears to work, 161# no other guarantees are made. 162# 163pass 164