1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1999, 2000, 2004-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 38if test "$EXEC_SEARCH_PATH" != "" 39then 40 tpath= 41 hold="$IFS" 42 IFS=":$IFS" 43 for tpath2 in $EXEC_SEARCH_PATH 44 do 45 tpath=${tpath}${tpath2}/${1-.}/bin: 46 done 47 IFS="$hold" 48 PATH=${tpath}${PATH} 49else 50 PATH=${bin}:${PATH} 51fi 52export PATH 53 54no_result() 55{ 56 set +x 57 echo "NO RESULT for test of integrate pass functionality ($activity)" 1>&2 58 cd $here 59 find $work -type d -user $USER -exec chmod u+w {} \; 60 rm -rf $work 61 exit 2 62} 63fail() 64{ 65 set +x 66 echo "FAILED test of integrate pass functionality ($activity)" 1>&2 67 cd $here 68 find $work -type d -user $USER -exec chmod u+w {} \; 69 rm -rf $work 70 exit 1 71} 72pass() 73{ 74 set +x 75 echo PASSED 1>&2 76 cd $here 77 find $work -type d -user $USER -exec chmod u+w {} \; 78 rm -rf $work 79 exit 0 80} 81trap "no_result" 1 2 3 15 82 83# 84# some variable to make things earier to read 85# 86PAGER=cat 87export PAGER 88 89AEGIS_FLAGS="delete_file_preference = no_keep; \ 90 lock_wait_preference = always; \ 91 diff_preference = automatic_merge; \ 92 pager_preference = never; \ 93 persevere_preference = all; \ 94 log_file_preference = never;" 95export AEGIS_FLAGS 96AEGIS_THROTTLE=-1 97export AEGIS_THROTTLE 98 99worklib=$work/lib 100workproj=$work/foo.proj 101workchan=$work/foo.chan 102tmp=$work/tmp 103AEGIS_PATH=$worklib ; export AEGIS_PATH 104AEGIS_PROJECT=foo ; export AEGIS_PROJECT 105 106# 107# make the directories 108# 109activity="working directory 96" 110mkdir $work $work/lib 111if test $? -ne 0 ; then no_result; fi 112chmod 777 $work/lib 113if test $? -ne 0 ; then no_result; fi 114cd $work 115if test $? -ne 0 ; then no_result; fi 116 117# 118# use the built-in error messages 119# 120AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 121export AEGIS_MESSAGE_LIBRARY 122unset LANG 123unset LANGUAGE 124 125# 126# make a new project 127# 128activity="new project 115" 129$bin/aegis -npr foo -vers "" -dir $workproj > log 2>&1 130if test $? -ne 0 ; then cat log; no_result; fi 131 132# 133# change project attributes 134# 135activity="project attributes 122" 136cat > $tmp << 'end' 137description = "A bogus project created to test the integrate pass functionality."; 138developer_may_review = true; 139developer_may_integrate = true; 140reviewer_may_integrate = true; 141default_test_exemption = true; 142end 143if test $? -ne 0 ; then no_result; fi 144$bin/aegis -pa -f $tmp > log 2>&1 145if test $? -ne 0 ; then cat log; no_result; fi 146 147# 148# add the staff 149# 150activity="staff 137" 151$bin/aegis -nd $USER > log 2>&1 152if test $? -ne 0 ; then cat log; no_result; fi 153$bin/aegis -nrv $USER > log 2>&1 154if test $? -ne 0 ; then cat log; no_result; fi 155$bin/aegis -ni $USER > log 2>&1 156if test $? -ne 0 ; then cat log; no_result; fi 157 158$bin/aegis -nbr -p foo 4 > log 2>&1 159if test $? -ne 0 ; then cat log; no_result; fi 160 161$bin/aegis -nbr -p foo.4 2 > log 2>&1 162if test $? -ne 0 ; then cat log; no_result; fi 163 164AEGIS_PROJECT=foo.4.2 ; export AEGIS_PROJECT 165 166# 167# create a new change 168# 169activity="new change 156" 170cat > $tmp << 'end' 171brief_description = "The first change"; 172cause = internal_bug; 173end 174if test $? -ne 0 ; then no_result; fi 175$bin/aegis -nc 1 -f $tmp -p foo.4.2 > log 2>&1 176if test $? -ne 0 ; then cat log; no_result; fi 177 178# 179# begin development of a change 180# 181$bin/aegis -db 1 -dir $workchan > log 2>&1 182if test $? -ne 0 ; then cat log; no_result; fi 183 184# 185# add a new files to the change 186# 187activity="new file 174" 188$bin/aegis -nf $workchan/main.c $workchan/aegis.conf -nl > log 2>&1 189if test $? -ne 0 ; then cat log; no_result; fi 190cat > $workchan/main.c << 'end' 191/* $Id$ */ 192int main() { test(); exit(0); return 0; } 193end 194if test $? -ne 0 ; then no_result; fi 195 196cat > $workchan/aegis.conf << 'end' 197build_command = "exit 0"; 198link_integration_directory = true; 199create_symlinks_before_build = true; 200 201history_get_command = "aesvt -check-out -edit ${quote $edit} " 202 "-history ${quote $history} -f ${quote $output}"; 203history_put_command = "aesvt -check-in -history ${quote $history} " 204 "-f ${quote $input}"; 205history_query_command = "aesvt -query -history ${quote $history}"; 206history_content_limitation = binary_capable; 207 208diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 209diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 210 echo '1,$$p' ) | ed - $mr > $out"; 211end 212if test $? -ne 0 ; then no_result; fi 213 214# 215# build the change 216# 217activity="build 204" 218$bin/aegis -build -nl -v > log 2>&1 219if test $? -ne 0 ; then cat log; fail; fi 220 221# 222# difference the change 223# 224activity="diff 211" 225$bin/aegis -diff > log 2>&1 226if test $? -ne 0 ; then cat log; no_result; fi 227 228# 229# finish development of the change 230# 231activity="develop end 218" 232$bin/aegis -de > log 2>&1 233if test $? -ne 0 ; then cat log; fail; fi 234 235# 236# pass the review 237# 238activity="review pass 225" 239$bin/aegis -rpass -c 1 > log 2>&1 240if test $? -ne 0 ; then cat log; no_result; fi 241 242# 243# start integrating 244# 245activity="integrate begin 232" 246$bin/aegis -ib 1 > log 2>&1 247if test $? -ne 0 ; then cat log; no_result; fi 248 249# 250# integrate build 251# 252activity="build 239" 253$bin/aegis -b -nl -v > log 2>&1 254if test $? -ne 0 ; then cat log; no_result; fi 255 256# 257# integrate diff 258# 259activity="diff 246" 260$bin/aegis -diff -nl -v > log 2>&1 261if test $? -ne 0 ; then cat log; no_result; fi 262 263# 264# try pass the integration 265# 266# It should complain about "files modified by history tool" because RCS 267# has a nasty habbit of rewriting the input files. 268# 269# BUT: with the new UUID code, we see that RCS unlinks the input file 270# first, and then rewrites it (which is probably a good thing). This 271# means this test is thus broken, because the file is rewrittent in the 272# directory which contains the symlink with the funny name. 273# 274# Only history tools which aren't as polite as RCS will cause this test 275# to fail. [Of course, it was RCS's stupid behaviour, needing the input 276# and thistory file names to be so similar, which caused this test to 277# fail in the first place. 278# 279# activity="integrate pass 347" 280# $bin/aegis -intpass -verbose -nl > log 2>&1 281# if test $? -ne 1 ; then cat log; fail; fi 282 283# 284# the things tested in this test, worked 285# 286pass 287