1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1996-1998, 2000, 2001, 2004-2008, 2012 Peter Miller 5# Copyright (C) 2008, 2010 Walter Franzini 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 3 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program. If not, see 19# <http://www.gnu.org/licenses/>. 20# 21 22unset AEGIS_PROJECT 23unset AEGIS_CHANGE 24unset AEGIS_PATH 25unset AEGIS 26unset LINES 27unset COLS 28umask 022 29 30USER=${USER:-${LOGNAME:-`whoami`}} 31 32work=${AEGIS_TMP:-/tmp}/$$ 33PAGER=cat 34export PAGER 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 48bin=$here/${1-.}/bin 49 50pass() 51{ 52 set +x 53 echo PASSED 1>&2 54 cd $here 55 find $work -type d -user $USER -exec chmod u+w {} \; 56 rm -rf $work 57 exit 0 58} 59fail() 60{ 61 set +x 62 echo "FAILED test of the aecpu directory 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} 68no_result() 69{ 70 set +x 71 echo "NO RESULT for test of the aecpu directory functionality ($activity)" 1>&2 72 cd $here 73 find $work -type d -user $USER -exec chmod u+w {} \; 74 rm -rf $work 75 exit 2 76} 77trap \"no_result\" 1 2 3 15 78 79check_it() 80{ 81 sed -e "s|$work|...|g" \ 82 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 83 -e "s/\"$USER\"/\"USER\"/g" \ 84 -e 's/19[0-9][0-9]/YYYY/' \ 85 -e 's/20[0-9][0-9]/YYYY/' \ 86 -e 's/node = ".*"/node = "NODE"/' \ 87 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 88 -e 's/uuid = ".*"/uuid = "UUID"/' \ 89 < $2 > $work/sed.out 90 if test $? -ne 0; then no_result; fi 91 diff -b $1 $work/sed.out 92 if test $? -ne 0; then fail; fi 93} 94 95activity="working directory 95" 96mkdir $work $work/lib 97if test $? -ne 0 ; then no_result; fi 98chmod 777 $work/lib 99if test $? -ne 0 ; then no_result; fi 100cd $work 101if test $? -ne 0 ; then no_result; fi 102 103workproj=$work/proj 104workchan=$work/chan 105worklib=$work/lib 106 107# 108# use the built-in error messages 109# 110AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 111export AEGIS_MESSAGE_LIBRARY 112unset LANG 113unset LANGUAGE 114 115AEGIS_PATH=$worklib 116export AEGIS_PATH 117AEGIS_PROJECT=test 118export AEGIS_PROJECT 119unset AEGIS_CHANGE 120 121# 122# test the aecpu directory functionality 123# 124activity="new project 124" 125$bin/aegis -npr test -vers "" -dir $workproj -lib $worklib > log 2>&1 126if test $? -ne 0 ; then cat log; no_result; fi 127 128cat > paf << 'fubar' 129developer_may_review = true; 130reviewer_may_integrate = true; 131developer_may_integrate = true; 132default_test_exemption = true; 133fubar 134if test $? -ne 0 ; then no_result; fi 135 136$bin/aegis -pa -f paf > log 2>&1 137if test $? -ne 0 ; then cat log; no_result; fi 138 139activity="new change 139" 140cat > caf << 'fubar' 141brief_description = "ten"; 142cause = internal_enhancement; 143fubar 144if test $? -ne 0 ; then no_result; fi 145 146$bin/aegis -nc -f caf -p test > log 2>&1 147if test $? -ne 0 ; then cat log; no_result; fi 148 149activity="new change 149" 150cat > caf << 'fubar' 151brief_description = "eleven"; 152cause = internal_enhancement; 153fubar 154if test $? -ne 0 ; then no_result; fi 155 156$bin/aegis -nc -f caf -p test > log 2>&1 157if test $? -ne 0 ; then cat log; no_result; fi 158 159activity="staff 159" 160$bin/aegis -ndev $USER > log 2>&1 161if test $? -ne 0 ; then cat log; no_result; fi 162 163$bin/aegis -nrev $USER > log 2>&1 164if test $? -ne 0 ; then cat log; no_result; fi 165 166$bin/aegis -nint $USER > log 2>&1 167if test $? -ne 0 ; then cat log; no_result; fi 168 169activity="develop begin 169" 170$bin/aegis -db 10 -dir $workchan > log 2>&1 171if test $? -ne 0 ; then cat log; no_result; fi 172 173activity="new file 173" 174$bin/aegis -nf $workchan/aegis.conf $workchan/a $workchan/b $workchan/c/d \ 175 $workchan/c/e > log 2>&1 176if test $? -ne 0 ; then cat log; no_result; fi 177 178cat > $workchan/aegis.conf << 'fubar' 179build_command = "exit 0"; 180diff_command = "echo $orig $input > $output"; 181diff3_command = "exit 0; echo $orig $mr $input $output"; 182history_create_command = "exit 0; echo $history $input"; 183history_put_command = "exit 0; echo $history $input"; 184history_get_command = "exit 0; echo $history $output"; 185history_query_command = "echo 1.1; exit 0; echo $history"; 186fubar 187if test $? -ne 0 ; then no_result; fi 188 189activity="build 189" 190$bin/aegis -b > log 2>&1 191if test $? -ne 0 ; then cat log; no_result; fi 192 193activity="diff 193" 194$bin/aegis -diff > log 2>&1 195if test $? -ne 0 ; then cat log; no_result; fi 196 197activity="develop end 197" 198$bin/aegis -de > log 2>&1 199if test $? -ne 0 ; then cat log; no_result; fi 200 201activity="review pass 201" 202$bin/aegis -rpass 10 > log 2>&1 203if test $? -ne 0 ; then cat log; no_result; fi 204 205activity="integrate begin 205" 206$bin/aegis -ib 10 -v > log 2>&1 207if test $? -ne 0 ; then cat log; no_result; fi 208 209activity="build 209" 210$bin/aegis -b -v > log 2>&1 211if test $? -ne 0 ; then cat log; no_result; fi 212 213activity="integrate pass 213" 214$bin/aegis -ipass -v > log 2>&1 215if test $? -ne 0 ; then cat log; no_result; fi 216 217workchan=$work/chan.C11 218activity="develop begin 218" 219$bin/aegis -db 11 -dir $workchan > log 2>&1 220if test $? -ne 0 ; then cat log; no_result; fi 221 222activity="new file 222" 223$bin/aegis -nf $workchan/c/x > log 2>&1 224if test $? -ne 0 ; then cat log; no_result; fi 225 226activity="copy file 226" 227$bin/aegis -cp $workchan/c/d $workchan/c/e > log 2>&1 228if test $? -ne 0 ; then cat log; no_result; fi 229 230activity="check change file state 230" 231cat > ok << 'fubar' 232src = 233[ 234 { 235 file_name = "c/d"; 236 uuid = "UUID"; 237 action = modify; 238 edit_origin = 239 { 240 revision = "1.1"; 241 encoding = none; 242 uuid = "UUID"; 243 }; 244 usage = source; 245 }, 246 { 247 file_name = "c/e"; 248 uuid = "UUID"; 249 action = modify; 250 edit_origin = 251 { 252 revision = "1.1"; 253 encoding = none; 254 uuid = "UUID"; 255 }; 256 usage = source; 257 }, 258 { 259 file_name = "c/x"; 260 uuid = "UUID"; 261 action = create; 262 usage = source; 263 }, 264]; 265fubar 266if test $? -ne 0 ; then no_result; fi 267 268check_it ok $workproj/info/change/0/011.fs 269 270activity="copy dir undo 270" 271$bin/aegis -cpu $workproj/baseline/c -v > log 2>&1 272if test $? -ne 0 ; then cat log; fail; fi 273 274activity="check change file state 274" 275cat > ok << 'fubar' 276src = 277[ 278 { 279 file_name = "c/x"; 280 uuid = "UUID"; 281 action = create; 282 usage = source; 283 }, 284]; 285fubar 286if test $? -ne 0 ; then no_result; fi 287 288check_it ok $workproj/info/change/0/011.fs 289 290# 291# Only definite negatives are possible. 292# The functionality exercised by this test appears to work, 293# no other guarantees are made. 294# 295pass 296# vim: set ts=8 sw=4 et : 297