1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1993-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 50no_result() 51{ 52 set +x 53 echo "NO RESULT test of -New_Change_Undo functionality ($activity)" 1>&2 54 cd $here 55 find $work -type d -user $USER -exec chmod u+w {} \; 56 rm -rf $work 57 exit 2 58} 59fail() 60{ 61 set +x 62 echo "FAILED test of -New_Change_Undo functionality ($activity)" 1>&2 63 cd $here 64 find $work -type d -user $USER -exec chmod u+w {} \; 65 rm -rf $work 66 exit 1 67} 68pass() 69{ 70 set +x 71 echo PASSED 1>&2 72 cd $here 73 find $work -type d -user $USER -exec chmod u+w {} \; 74 rm -rf $work 75 exit 0 76} 77trap "no_result" 1 2 3 15 78 79activity="working directory 70" 80mkdir $work $work/lib 81if test $? -ne 0 ; then no_result; fi 82chmod 777 $work/lib 83if test $? -ne 0 ; then no_result; fi 84cd $work 85if test $? -ne 0 ; then no_result; fi 86 87worklib=$work/lib 88workproj=$work/foo 89 90# 91# use the built-in error messages 92# 93AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 94export AEGIS_MESSAGE_LIBRARY 95unset LANG 96unset LANGUAGE 97 98# 99# create the project 100# 101activity="new project 106" 102$bin/aegis -npr foo -version "" -lib $worklib -dir $workproj 103if test $? -ne 0 ; then no_result; fi 104 105# 106# create a change 107# 108activity="new change 113" 109cat > ncf << 'fubar' 110brief_description = "hello"; 111cause = internal_enhancement; 112fubar 113if test $? -ne 0 ; then no_result; fi 114$bin/aegis -nc 1 -f ncf -lib $worklib -p foo 115if test $? -ne 0 ; then no_result; fi 116if test ! -f $workproj/info/change/0/001; then no_result; fi 117 118# 119# remove the change 120# 121activity="new change undo 126" 122$bin/aegis -ncu -lib $worklib -p foo -c 1 123if test $? -ne 0 ; then fail; fi 124if test -f $workproj/info/change/0/001; then fail; fi 125 126# 127# Only definite negatives are possible. 128# The functionality exercised by this test appears to work, 129# no other guarantees are made. 130# 131pass 132