1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1997, 1998, 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}/$$ 32PAGER=cat 33export PAGER 34AEGIS_FLAGS="delete_file_preference = no_keep; \ 35 lock_wait_preference = always; \ 36 diff_preference = automatic_merge; \ 37 pager_preference = never; \ 38 persevere_preference = all; \ 39 log_file_preference = never; \ 40 default_project_directory = \"$work\"; \ 41 default_development_directory = \"$work\";" 42export AEGIS_FLAGS 43AEGIS_THROTTLE=-1 44export AEGIS_THROTTLE 45 46here=`pwd` 47if test $? -ne 0 ; then exit 2; fi 48 49bin=$here/${1-.}/bin 50 51if test "$EXEC_SEARCH_PATH" != "" 52then 53 tpath= 54 hold="$IFS" 55 IFS=":$IFS" 56 for tpath2 in $EXEC_SEARCH_PATH 57 do 58 tpath=${tpath}${tpath2}/${1-.}/bin: 59 done 60 IFS="$hold" 61 PATH=${tpath}${PATH} 62else 63 PATH=${bin}:${PATH} 64fi 65export PATH 66 67check_it() 68{ 69 sed -e "s|$work|...|g" \ 70 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 71 -e "s/\"$USER\"/\"USER\"/g" \ 72 -e 's/19[0-9][0-9]/YYYY/' \ 73 -e 's/20[0-9][0-9]/YYYY/' \ 74 -e 's/node = ".*"/node = "NODE"/' \ 75 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 76 < $2 > $work/sed.out 77 if test $? -ne 0; then no_result; fi 78 diff -c $1 $work/sed.out 79 if test $? -ne 0; then fail; fi 80} 81 82no_result() 83{ 84 set +x 85 echo 'NO RESULT for test of the aecp -indep functionality' 1>&2 86 cd $here 87 find $work -type d -user $USER -exec chmod u+w {} \; 88 rm -rf $work 89 exit 2 90} 91fail() 92{ 93 set +x 94 echo 'FAILED test of the aecp -indep functionality' 1>&2 95 cd $here 96 find $work -type d -user $USER -exec chmod u+w {} \; 97 rm -rf $work 98 exit 1 99} 100pass() 101{ 102 set +x 103 echo PASSED 1>&2 104 cd $here 105 find $work -type d -user $USER -exec chmod u+w {} \; 106 rm -rf $work 107 exit 0 108} 109trap \"no_result\" 1 2 3 15 110 111mkdir $work $work/lib 112if test $? -ne 0 ; then no_result; fi 113chmod 777 $work/lib 114if test $? -ne 0 ; then no_result; fi 115cd $work 116if test $? -ne 0 ; then no_result; fi 117 118# 119# use the built-in error messages 120# 121AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 122export AEGIS_MESSAGE_LIBRARY 123unset LANG 124unset LANGUAGE 125 126AEGIS_PROJECT=test 127export AEGIS_PROJECT 128AEGIS_PATH=$work/lib 129export AEGIS_PATH 130 131# 132# test the aecp -indep functionality 133# 134activity="new project 121" 135$bin/aegis -npr test -version '' -v -dir $work/test > log 2>&1 136if test $? -ne 0 ; then cat log; no_result; fi 137 138activity="project attributes 125" 139cat > paf << 'fubar' 140developer_may_review = true; 141developer_may_integrate = true; 142reviewer_may_integrate = true; 143default_test_exemption = true; 144fubar 145if test $? -ne 0 ; then no_result; fi 146$bin/aegis -pa -f paf -v > log 2>&1 147if test $? -ne 0 ; then cat log; no_result; fi 148 149activity="staff 136" 150$bin/aegis -nd $USER -v > log 2>&1 151if test $? -ne 0 ; then cat log; no_result; fi 152$bin/aegis -nrv $USER -v > log 2>&1 153if test $? -ne 0 ; then cat log; no_result; fi 154$bin/aegis -ni $USER -v > log 2>&1 155if test $? -ne 0 ; then cat log; no_result; fi 156 157activity="new change 144" 158cat > caf << 'fubar' 159brief_description = "one"; 160cause = internal_enhancement; 161test_baseline_exempt = true; 162fubar 163if test $? -ne 0 ; then no_result; fi 164$bin/aegis -nc -f caf -v -p test > log 2>&1 165if test $? -ne 0 ; then cat log; no_result; fi 166 167activity="develop begin 154" 168$bin/aegis -db 10 -v > log 2>&1 169if test $? -ne 0 ; then cat log; no_result; fi 170 171activity="new file 158" 172$bin/aegis -nf $work/test.C010/aegis.conf $work/test.C010/fred -v > log 2>&1 173if test $? -ne 0 ; then cat log; no_result; fi 174cat > $work/test.C010/aegis.conf << 'fubar' 175build_command = "exit 0"; 176 177history_get_command = "aesvt -check-out -edit ${quote $edit} " 178 "-history ${quote $history} -f ${quote $output}"; 179history_put_command = "aesvt -check-in -history ${quote $history} " 180 "-f ${quote $input}"; 181history_query_command = "aesvt -query -history ${quote $history}"; 182history_content_limitation = binary_capable; 183 184diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 185diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 186 echo '1,$$p' ) | ed - $mr > $out"; 187link_integration_directory = true; 188fubar 189if test $? -ne 0 ; then no_result; fi 190echo hello > $work/test.C010/fred 191if test $? -ne 0 ; then no_result; fi 192 193activity="new test 180" 194$bin/aegis -nt -v > log 2>&1 195echo exit 0 > $work/test.C010/test/00/t0001a.sh 196if test $? -ne 0 ; then no_result; fi 197$bin/aegis -ca -f caf -v > log 2>&1 198if test $? -ne 0 ; then cat log; no_result; fi 199 200activity="build 187" 201$bin/aegis -b -v > log 2>&1 202if test $? -ne 0 ; then cat log; no_result; fi 203 204activity="diff 191" 205$bin/aegis -diff -v > log 2>&1 206if test $? -ne 0 ; then cat log; no_result; fi 207 208activity="test 195" 209$bin/aegis -test -v > log 2>&1 210if test $? -ne 0 ; then cat log; no_result; fi 211 212activity="develop end 199" 213$bin/aegis -de -v > log 2>&1 214if test $? -ne 0 ; then cat log; no_result; fi 215 216activity="review pass 203" 217$bin/aegis -rpass 10 -v > log 2>&1 218if test $? -ne 0 ; then cat log; no_result; fi 219 220activity="integrate begin 207" 221$bin/aegis -ib 10 -v > log 2>&1 222if test $? -ne 0 ; then cat log; no_result; fi 223 224activity="integrate build 211" 225$bin/aegis -b -v > log 2>&1 226if test $? -ne 0 ; then cat log; no_result; fi 227 228activity="integrate diff 215" 229$bin/aegis -diff -v > log 2>&1 230if test $? -ne 0 ; then cat log; no_result; fi 231 232activity="integrate test 219" 233$bin/aegis -test -v > log 2>&1 234if test $? -ne 0 ; then cat log; no_result; fi 235 236activity="integrate pass 223" 237$bin/aegis -ipass -v > log 2>&1 238if test $? -ne 0 ; then cat log; no_result; fi 239 240# 241# change a file 242# 243activity="new change 230" 244cat > caf << 'fubar' 245brief_description = "two"; 246cause = internal_enhancement; 247fubar 248if test $? -ne 0 ; then no_result; fi 249$bin/aegis -nc -f caf -v -p test > log 2>&1 250if test $? -ne 0 ; then cat log; no_result; fi 251 252activity="develop begin 239" 253$bin/aegis -db 11 -v > log 2>&1 254if test $? -ne 0 ; then cat log; no_result; fi 255 256activity="copy file 243" 257$bin/aegis -cp $work/test.C011/fred -v > log 2>&1 258if test $? -ne 0 ; then cat log; no_result; fi 259 260echo "fred mark 2" > $work/test.C011/fred 261if test $? -ne 0 ; then no_result; fi 262 263activity="build 250" 264$bin/aegis -b -v > log 2>&1 265if test $? -ne 0 ; then cat log; no_result; fi 266 267activity="diff 254" 268$bin/aegis -diff -v > log 2>&1 269if test $? -ne 0 ; then cat log; no_result; fi 270 271activity="develop end 258" 272$bin/aegis -de -v > log 2>&1 273if test $? -ne 0 ; then cat log; no_result; fi 274 275activity="review pass 262" 276$bin/aegis -rpass 11 -v > log 2>&1 277if test $? -ne 0 ; then cat log; no_result; fi 278 279activity="integrate begin 266" 280$bin/aegis -ib 11 -v > log 2>&1 281if test $? -ne 0 ; then cat log; no_result; fi 282 283activity="integrate build 270" 284$bin/aegis -b -v > log 2>&1 285if test $? -ne 0 ; then cat log; no_result; fi 286 287activity="integrate diff 274" 288$bin/aegis -diff -v > log 2>&1 289if test $? -ne 0 ; then cat log; no_result; fi 290 291activity="integrate pass 278" 292$bin/aegis -ipass -v > log 2>&1 293if test $? -ne 0 ; then cat log; no_result; fi 294 295# 296# now copy independently 297# 298activity="aecp -independent 285" 299mkdir $work/i1 300if test $? -ne 0 ; then no_result; fi 301cd $work/i1 302if test $? -ne 0 ; then no_result; fi 303$bin/aegis -cp -indep . -v > log 2>&1 304if test $? -ne 0 ; then cat log; fail; fi 305diff $work/test/baseline/fred fred 306if test $? -ne 0 ; then fail; fi 307diff $work/test/baseline/aegis.conf aegis.conf 308if test $? -ne 0 ; then fail; fi 309diff $work/test/baseline/test/00/t0001a.sh test/00/t0001a.sh 310if test $? -ne 0 ; then fail; fi 311 312# 313# now copy independently with delta 314# 315activity="aecp -independent -delta 302" 316mkdir $work/i2 317if test $? -ne 0 ; then no_result; fi 318cd $work/i2 319if test $? -ne 0 ; then no_result; fi 320$bin/aegis -cp -indep . -v -delta 1 > log 2>&1 321if test $? -ne 0 ; then cat log; fail; fi 322 323echo hello > ok 324if test $? -ne 0 ; then no_result; fi 325diff ok fred 326if test $? -ne 0 ; then fail; fi 327diff $work/test/baseline/aegis.conf aegis.conf 328if test $? -ne 0 ; then fail; fi 329diff $work/test/baseline/test/00/t0001a.sh test/00/t0001a.sh 330if test $? -ne 0 ; then fail; fi 331 332# 333# Only definite negatives are possible. 334# The functionality exercised by this test appears to work, 335# no other guarantees are made. 336# 337pass 338