1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 2004, 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 50here=`pwd` 51if test $? -ne 0 ; then exit 2; fi 52 53if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi 54 55if test "$EXEC_SEARCH_PATH" != "" 56then 57 tpath= 58 hold="$IFS" 59 IFS=":$IFS" 60 for tpath2 in $EXEC_SEARCH_PATH 61 do 62 tpath=${tpath}${tpath2}/${1-.}/bin: 63 done 64 IFS="$hold" 65 PATH=${tpath}${PATH} 66else 67 PATH=${bin}:${PATH} 68fi 69export PATH 70 71pass() 72{ 73 set +x 74 echo PASSED 1>&2 75 cd $here 76 find $work -type d -user $USER -exec chmod u+w {} \; 77 rm -rf $work 78 exit 0 79} 80fail() 81{ 82 set +x 83 echo "FAILED test of the aedist functionality ($activity)" 1>&2 84 cd $here 85 find $work -type d -user $USER -exec chmod u+w {} \; 86 rm -rf $work 87 exit 1 88} 89no_result() 90{ 91 set +x 92 echo "NO RESULT when testing the aedist functionality ($activity)" 1>&2 93 cd $here 94 find $work -type d -user $USER -exec chmod u+w {} \; 95 rm -rf $work 96 exit 2 97} 98trap \"no_result\" 1 2 3 15 99 100mkdir $work $work/lib 101if test $? -ne 0 ; then no_result; fi 102chmod 777 $work/lib 103if test $? -ne 0 ; then no_result; fi 104cd $work 105if test $? -ne 0 ; then no_result; fi 106workproj=$work/foo.proj 107workchan=$work/foo.chan 108tmp=$work/tmp 109AEGIS_PATH=$work/lib 110export AEGIS_PATH 111 112# 113# use the built-in error messages 114# 115AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 116export AEGIS_MESSAGE_LIBRARY 117unset LANG 118unset LANGUAGE 119 120# 121# make a new project 122# 123activity="new project 115" 124$bin/aegis -npr foo -vers "" -lib $work/lib -dir $workproj > log 2>&1 125if test $? -ne 0 ; then cat log; no_result; fi 126 127AEGIS_PROJECT=foo 128export AEGIS_PROJECT 129 130# 131# change project attributes 132# 133activity="project attributes 125" 134cat > $tmp << 'end' 135description = "A bogus project created to test the aefa functionality."; 136developer_may_review = true; 137developer_may_integrate = true; 138reviewer_may_integrate = true; 139default_test_exemption = true; 140end 141if test $? -ne 0 ; then no_result; fi 142$bin/aegis -pa -f $tmp > log 2>&1 143if test $? -ne 0 ; then cat log; no_result; fi 144 145# 146# add the staff 147# 148activity="staff 140" 149$bin/aegis -nd $USER > log 2>&1 150if test $? -ne 0 ; then cat log; no_result; fi 151$bin/aegis -nrv $USER > log 2>&1 152if test $? -ne 0 ; then cat log; no_result; fi 153$bin/aegis -ni $USER > log 2>&1 154if test $? -ne 0 ; then cat log; no_result; fi 155 156# 157# create a new change 158# 159activity="new change 151" 160cat > $tmp << 'end' 161brief_description = "The first change"; 162cause = internal_bug; 163end 164if test $? -ne 0 ; then no_result; fi 165$bin/aegis -nc 1 -f $tmp -p foo > log 2>&1 166if test $? -ne 0 ; then cat log; no_result; fi 167 168# 169# begin development of a change 170# 171$bin/aegis -db 1 -dir $workchan > log 2>&1 172if test $? -ne 0 ; then cat log; no_result; fi 173 174# 175# add a new files to the change 176# 177activity="new file 169" 178$bin/aegis -nf $workchan/aegis.conf $workchan/bogus -nl > log 2>&1 179if test $? -ne 0 ; then cat log; no_result; fi 180 181cat > $workchan/bogus << 'end' 182the trunk version 183end 184if test $? -ne 0 ; then no_result; fi 185 186cat > $workchan/aegis.conf << 'end' 187build_command = "exit 0"; 188create_symlinks_before_build = true; 189remove_symlinks_after_build = false; 190link_integration_directory = true; 191 192history_get_command = "aesvt -check-out -edit ${quote $edit} " 193 "-history ${quote $history} -f ${quote $output}"; 194history_put_command = "aesvt -check-in -history ${quote $history} " 195 "-f ${quote $input}"; 196history_query_command = "aesvt -query -history ${quote $history}"; 197history_content_limitation = binary_capable; 198 199diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 200diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 201 echo '1,$$p' ) | ed - $mr > $out"; 202patch_diff_command = "set +e; diff -C0 -L $index -L $index $orig $i > $out; \ 203test $$? -le 1"; 204end 205if test $? -ne 0 ; then no_result; fi 206 207# 208# build the change 209# 210activity="build 202" 211$bin/aegis -build -nl -v > log 2>&1 212if test $? -ne 0 ; then cat log; fail; fi 213 214# 215# difference the change 216# 217activity="diff 209" 218$bin/aegis -diff > log 2>&1 219if test $? -ne 0 ; then cat log; no_result; fi 220 221# 222# finish development of the change 223# 224activity="develop end 216" 225$bin/aegis -de > log 2>&1 226if test $? -ne 0 ; then cat log; fail; fi 227 228# 229# Create the archive in backward compatible mode 230# 231activity="create dist archive 223" 232$bin/aedist -s -c 1 -compatibility 4.6 -o arch.ae > log 2>&1 233if test $? -ne 0 ; then cat log; no_result; fi 234 235# 236# pass the review 237# 238activity="review pass 230" 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 237" 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 244" 253$bin/aegis -b -nl -v > log 2>&1 254if test $? -ne 0 ; then cat log; no_result; fi 255 256# 257# pass the integration 258# 259activity="integrate pass 251" 260$bin/aegis -intpass -nl > log 2>&1 261if test $? -ne 0 ; then cat log; no_result; fi 262 263# 264# Receive the archive 265# 266activity="receive the archive 258" 267$bin/aedist -rec -f arch.ae > log 2>&1 268if test $? -ne 0; then cat log; fail; fi 269 270 271# 272# Only definite negatives are possible. 273# The functionality exercised by this test appears to work, 274# no other guarantees are made. 275# 276pass 277