1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 2005 Walter Franzini; 5# All rights reserved. 6# Copyright (C) 2007, 2008 Peter Miller 7# 8# This program is free software; you can redistribute it and/or modify 9# it under the terms of the GNU General Public License as published by 10# the Free Software Foundation; either version 3 of the License, or 11# (at your option) any later version. 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with this program. If not, see 20# <http://www.gnu.org/licenses/>. 21# 22 23unset AEGIS_PROJECT 24unset AEGIS_CHANGE 25unset AEGIS_PATH 26unset AEGIS 27umask 022 28 29LINES=24 30export LINES 31COLS=80 32export COLS 33 34USER=${USER:-${LOGNAME:-`whoami`}} 35 36work=${AEGIS_TMP:-/tmp}/$$ 37PAGER=cat 38export PAGER 39AEGIS_FLAGS="delete_file_preference = no_keep; \ 40 lock_wait_preference = always; \ 41 diff_preference = automatic_merge; \ 42 pager_preference = never; \ 43 persevere_preference = all; \ 44 log_file_preference = never; \ 45 default_development_directory = \"$work\";" 46export AEGIS_FLAGS 47AEGIS_THROTTLE=-1 48export AEGIS_THROTTLE 49 50worklib=$work/lib 51workproj=$work/foo.proj 52workchan=$work/foo.chan 53tmp=$work/tmp 54 55# This tells aeintegratq that it is being used by a test. 56AEGIS_TEST_DIR=$work 57export AEGIS_TEST_DIR 58 59here=`pwd` 60if test $? -ne 0 ; then exit 2; fi 61 62if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi 63 64if test "$EXEC_SEARCH_PATH" != "" 65then 66 tpath= 67 hold="$IFS" 68 IFS=":$IFS" 69 for tpath2 in $EXEC_SEARCH_PATH 70 do 71 tpath=${tpath}${tpath2}/${1-.}/bin: 72 done 73 IFS="$hold" 74 PATH=${tpath}${PATH} 75else 76 PATH=${bin}:${PATH} 77fi 78export PATH 79 80AEGIS_DATADIR=$here/lib 81export AEGIS_DATADIR 82 83# 84# set the path, so that the aegis command that aepatch/aedist invokes 85# is from the same test set as the aepatch/aedist command itself. 86# 87PATH=${bin}:$PATH 88export PATH 89 90pass() 91{ 92 set +x 93 echo PASSED 1>&2 94 cd $here 95 find $work -type d -user $USER -exec chmod u+w {} \; 96 rm -rf $work 97 exit 0 98} 99fail() 100{ 101 set +x 102 echo "FAILED test of the aeipass ($activity)" 1>&2 103 cd $here 104 find $work -type d -user $USER -exec chmod u+w {} \; 105 rm -rf $work 106 exit 1 107} 108no_result() 109{ 110 set +x 111 echo "NO RESULT when testing the aeipass ($activity)" 1>&2 112 cd $here 113 find $work -type d -user $USER -exec chmod u+w {} \; 114 rm -rf $work 115 exit 2 116} 117trap \"no_result\" 1 2 3 15 118 119activity="create test directory 104" 120mkdir $work $work/lib 121if test $? -ne 0 ; then no_result; fi 122chmod 777 $work/lib 123if test $? -ne 0 ; then no_result; fi 124cd $work 125if test $? -ne 0 ; then no_result; fi 126 127# 128# use the built-in error messages 129# 130AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 131export AEGIS_MESSAGE_LIBRARY 132unset LANG 133unset LANGUAGE 134 135# 136# If the C++ compiler is called something other than ``c++'', as 137# discovered by the configure script, create a shell script called 138# ``c++'' which invokes the correct C++ compiler. Make sure the current 139# directory is in the path, so that it will be invoked. 140# 141if test "$CXX" != "c++" 142then 143 cat >> $work/c++ << fubar 144#!/bin/sh 145exec ${CXX-g++} \$* 146fubar 147 if test $? -ne 0 ; then no_result; fi 148 chmod a+rx $work/c++ 149 if test $? -ne 0 ; then no_result; fi 150 PATH=${work}:${PATH} 151 export PATH 152fi 153 154# 155# make a new project 156# 157AEGIS_PROJECT=foo 158export AEGIS_PROJECT 159AEGIS_PATH=$worklib 160export AEGIS_PATH 161 162activity="new project 147" 163$bin/aegis -npr foo -vers "" -dir $workproj -lib $worklib > log 2>&1 164if test $? -ne 0 ; then cat log; no_result; fi 165 166# 167# change project attributes 168# 169activity="project attributes 154" 170cat > $tmp << 'end' 171description = "A bogus project created to test the aefa functionality."; 172developer_may_review = true; 173developer_may_integrate = true; 174reviewer_may_integrate = true; 175default_test_exemption = true; 176end 177if test $? -ne 0 ; then no_result; fi 178$bin/aegis -pa -f $tmp > log 2>&1 179if test $? -ne 0 ; then cat log; no_result; fi 180 181# 182# add the staff 183# 184activity="staff 169" 185$bin/aegis -nd $USER > log 2>&1 186if test $? -ne 0 ; then cat log; no_result; fi 187$bin/aegis -nrv $USER > log 2>&1 188if test $? -ne 0 ; then cat log; no_result; fi 189$bin/aegis -ni $USER > log 2>&1 190if test $? -ne 0 ; then cat log; no_result; fi 191 192# -------------------------------------------------------------------------- 193 194# 195# create a new change 196# 197activity="new change 182" 198cat > $tmp << 'end' 199brief_description = "The first change"; 200cause = internal_bug; 201end 202if test $? -ne 0 ; then no_result; fi 203$bin/aegis -nc 1 -f $tmp -p foo > log 2>&1 204if test $? -ne 0 ; then cat log; no_result; fi 205 206# 207# begin development of a change 208# 209$bin/aegis -db 1 -dir $workchan > log 2>&1 210if test $? -ne 0 ; then cat log; no_result; fi 211 212# 213# add a new files to the change 214# 215activity="new file 200" 216$bin/aegis -nf $workchan/bogus -nl > log 2>&1 217if test $? -ne 0 ; then cat log; no_result; fi 218 219cat > $workchan/bogus << 'end' 220the trunk version 221end 222if test $? -ne 0 ; then no_result; fi 223 224$bin/aegis -nf $workchan/aegis.conf -nl > log 2>&1 225if test $? -ne 0 ; then cat log; no_result; fi 226 227cat > $workchan/aegis.conf << 'end' 228build_command = "exit 0"; 229link_integration_directory = true; 230 231history_get_command = "aesvt -check-out -edit ${quote $edit} " 232 "-history ${quote $history} -f ${quote $output}"; 233history_put_command = "aesvt -check-in -history ${quote $history} " 234 "-f ${quote $input}"; 235history_query_command = "aesvt -query -history ${quote $history}"; 236history_content_limitation = binary_capable; 237 238diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 239merge_command = 240 "(diff3 -e $i $orig $mr | sed -e '/^w$$/d' -e '/^q$$/d'; echo '1,$$p' ) " 241 "| ed - $i > $out"; 242patch_diff_command = "set +e; diff -C0 -L $index -L $index $orig $i > $out; \ 243test $$? -le 1"; 244end 245if test $? -ne 0 ; then no_result; fi 246 247activity="build 230" 248$bin/aegis -build 1 > log 2>&1 249if test $? -ne 0; then cat log; no_result; fi 250 251activity="diff 234" 252$bin/aegis -diff 1 > log 2>&1 253if test $? -ne 0; then cat log; no_result; fi 254 255activity="develop end 238" 256$bin/aegis -dev_end 1 > log 2>&1 257if test $? -ne 0; then cat log; no_result; fi 258 259activity="review pass 242" 260$bin/aegis -rpass 1 > log 2>&1 261if test $? -ne 0; then cat log; no_result; fi 262 263activity="integrate begin 246" 264$bin/aegis -ibegin 1 > log 2>&1 265if test $? -ne 0; then cat log; no_result; fi 266 267activity="build 250" 268$bin/aegis -build 1 > log 2>&1 269if test $? -ne 0; then cat log; no_result; fi 270 271activity="integrate pass 254" 272$bin/aegis -ipass 1 > log 2>&1 273if test $? -ne 0; then cat log; fail; fi 274 275# 276# Only definite negatives are possible. 277# The functionality exercised by this test appears to work, 278# no other guarantees are made. 279# 280pass 281