1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1997, 1998, 2000, 2001, 2004-2008, 2012 Peter Miller 5# Copyright (C) 2008 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 50if test "$EXEC_SEARCH_PATH" != "" 51then 52 tpath= 53 hold="$IFS" 54 IFS=":$IFS" 55 for tpath2 in $EXEC_SEARCH_PATH 56 do 57 tpath=${tpath}${tpath2}/${1-.}/bin: 58 done 59 IFS="$hold" 60 PATH=${tpath}${PATH} 61else 62 PATH=${bin}:${PATH} 63fi 64export PATH 65 66pass() 67{ 68 set +x 69 echo PASSED 1>&2 70 cd $here 71 find $work -type d -user $USER -exec chmod u+w {} \; 72 rm -rf $work 73 exit 0 74} 75fail() 76{ 77 set +x 78 echo "FAILED test of the branch ipass functionality ($activity)" 1>&2 79 cd $here 80 find $work -type d -user $USER -exec chmod u+w {} \; 81 rm -rf $work 82 exit 1 83} 84no_result() 85{ 86 set +x 87 echo "NO RESULT when testing the branch ipass functionality ($activity)" 1>&2 88 cd $here 89 find $work -type d -user $USER -exec chmod u+w {} \; 90 rm -rf $work 91 exit 2 92} 93trap \"no_result\" 1 2 3 15 94 95check_it() 96{ 97 sed -e "s|$work|...|g" \ 98 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 99 -e "s/\"$USER\"/\"USER\"/g" \ 100 -e 's/19[0-9][0-9]/YYYY/' \ 101 -e 's/20[0-9][0-9]/YYYY/' \ 102 -e 's/node = ".*"/node = "NODE"/' \ 103 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 104 -e 's/uuid = ".*"/uuid = "UUID"/' \ 105 < $2 > $work/sed.out 106 if test $? -ne 0; then fail; fi 107 diff -b $1 $work/sed.out 108 if test $? -ne 0; then fail; fi 109} 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 118workproj=$work/proj 119workchan=$work/chan 120worklib=$work/lib 121 122# 123# use the built-in error messages 124# 125AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 126export AEGIS_MESSAGE_LIBRARY 127unset LANG 128unset LANGUAGE 129 130# 131# test the branch ipass functionality 132# 133activity="new project 119" 134$bin/aegis -npr test -vers '' -dir $workproj -lib $worklib > log 2>&1 135if test $? -ne 0 ; then cat log; no_result; fi 136 137activity="staff 123" 138$bin/aegis -nd $USER -p test -lib $worklib > log 2>&1 139if test $? -ne 0 ; then cat log; no_result; fi 140activity="staff 126" 141$bin/aegis -nrv $USER -p test -lib $worklib > log 2>&1 142if test $? -ne 0 ; then cat log; no_result; fi 143activity="staff 129" 144$bin/aegis -ni $USER -p test -lib $worklib > log 2>&1 145if test $? -ne 0 ; then cat log; no_result; fi 146 147activity="project attributes 133" 148cat > pa << 'fubar' 149developer_may_review = true; 150developer_may_integrate = true; 151reviewer_may_integrate = true; 152fubar 153if test $? -ne 0 ; then no_result; fi 154$bin/aegis -pa -f pa -p test -lib $worklib > log 2>&1 155if test $? -ne 0 ; then cat log; no_result; fi 156 157activity="create branch 143" 158$bin/aegis -nbr 4 -p test -lib $worklib > log 2>&1 159if test $? -ne 0 ; then cat log; no_result; fi 160 161# 162# create a change to the branch 163# 164activity="new change 150" 165cat > ca << 'fubar' 166brief_description = "first"; 167description = "This is the first change."; 168cause = internal_enhancement; 169test_exempt = true; 170test_baseline_exempt = true; 171regression_test_exempt = true; 172fubar 173if test $? -ne 0 ; then no_result; fi 174$bin/aegis -nc -f ca -p test.4 -lib $worklib > log 2>&1 175if test $? -ne 0 ; then cat log; no_result; fi 176 177activity="develop begin 163" 178$bin/aegis -db 10 -p test.4 -dir $workchan -lib $worklib > log 2>&1 179if test $? -ne 0 ; then cat log; no_result; fi 180 181activity="new file 167" 182$bin/aegis -nf $workchan/aegis.conf -c 10 -p test.4 -lib $worklib > log 2>&1 183if test $? -ne 0 ; then cat log; no_result; fi 184 185cat > $workchan/aegis.conf << 'fubar' 186build_command = "exit 0"; 187 188history_get_command = "aesvt -check-out -edit ${quote $edit} " 189 "-history ${quote $history} -f ${quote $output}"; 190history_put_command = "aesvt -check-in -history ${quote $history} " 191 "-f ${quote $input}"; 192history_query_command = "aesvt -query -history ${quote $history}"; 193history_content_limitation = binary_capable; 194 195diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 196 197diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 198 echo '1,$$p' ) | ed - $mr > $out"; 199 200link_integration_directory = true; 201fubar 202if test $? -ne 0 ; then no_result; fi 203 204# build 205activity="build 193" 206$bin/aegis -b -c 10 -p test.4 -lib $worklib > log 2>&1 207if test $? -ne 0 ; then cat log; no_result; fi 208 209activity="difference 197" 210$bin/aegis -diff -c 10 -p test.4 -lib $worklib > log 2>&1 211if test $? -ne 0 ; then cat log; no_result; fi 212 213activity="develop end 201" 214$bin/aegis -de -c 10 -p test.4 -lib $worklib > log 2>&1 215if test $? -ne 0 ; then cat log; no_result; fi 216 217activity="review pass 205" 218$bin/aegis -rpass 10 -p test.4 -lib $worklib > log 2>&1 219if test $? -ne 0 ; then cat log; no_result; fi 220 221activity="integrate begin 209" 222$bin/aegis -ib 10 -p test.4 -lib $worklib > log 2>&1 223if test $? -ne 0 ; then cat log; no_result; fi 224 225# build 226activity="build 214" 227$bin/aegis -b -c 10 -p test.4 -lib $worklib > log 2>&1 228if test $? -ne 0 ; then cat log; no_result; fi 229 230# diff 231activity="diff 219" 232$bin/aegis -diff -c 10 -p test.4 -lib $worklib > log 2>&1 233if test $? -ne 0 ; then cat log; no_result; fi 234 235activity="integrate pass 223" 236$bin/aegis -ipass 10 -p test.4 -lib $worklib > log 2>&1 237if test $? -ne 0 ; then cat log; no_result; fi 238 239# 240# create another change to branch 4 241# 242activity="new change 230" 243cat > ca << 'fubar' 244brief_description = "second"; 245description = "This is the second change."; 246cause = internal_enhancement; 247test_exempt = false; 248test_baseline_exempt = true; 249regression_test_exempt = true; 250fubar 251if test $? -ne 0 ; then no_result; fi 252$bin/aegis -nc -f ca -p test.4 -lib $worklib > log 2>&1 253if test $? -ne 0 ; then cat log; no_result; fi 254 255# develop begin 256activity="develop begin 244" 257$bin/aegis -db 11 -p test.4 -dir $workchan -lib $worklib > log 2>&1 258if test $? -ne 0 ; then cat log; no_result; fi 259 260activity="new file 248" 261$bin/aegis -nf $workchan/fred -c 11 -p test.4 -lib $worklib > log 2>&1 262if test $? -ne 0 ; then cat log; no_result; fi 263 264activity="new test 252" 265$bin/aegis -nt $workchan/a.test.sh -c 11 -p test.4 -lib $worklib > log 2>&1 266if test $? -ne 0 ; then cat log; no_result; fi 267 268echo exit 0 > $workchan.a.test.sh 269if test $? -ne 0 ; then no_result; fi 270 271activity="change attributes 259" 272$bin/aegis -ca -f ca -c 11 -p test.4 -lib $worklib > log 2>&1 273if test $? -ne 0 ; then cat log; no_result; fi 274 275# build 276activity="build 264" 277$bin/aegis -b -c 11 -p test.4 -lib $worklib > log 2>&1 278if test $? -ne 0 ; then cat log; no_result; fi 279 280# test 281activity="test 269" 282$bin/aegis -t -c 11 -p test.4 -lib $worklib > log 2>&1 283if test $? -ne 0 ; then cat log; no_result; fi 284 285activity="difference 273" 286$bin/aegis -diff -c 11 -p test.4 -lib $worklib > log 2>&1 287if test $? -ne 0 ; then cat log; no_result; fi 288 289activity="develop end 277" 290$bin/aegis -de -c 11 -p test.4 -lib $worklib > log 2>&1 291if test $? -ne 0 ; then cat log; no_result; fi 292 293activity="review pass 281" 294$bin/aegis -rpass 11 -p test.4 -lib $worklib > log 2>&1 295if test $? -ne 0 ; then cat log; no_result; fi 296 297activity="integrate begin 285" 298$bin/aegis -ib 11 -p test.4 -lib $worklib > log 2>&1 299if test $? -ne 0 ; then cat log; no_result; fi 300 301# build 302activity="build 290" 303$bin/aegis -b -c 11 -p test.4 -lib $worklib > log 2>&1 304if test $? -ne 0 ; then cat log; no_result; fi 305 306# test 307activity="test 295" 308$bin/aegis -t -c 11 -p test.4 -lib $worklib > log 2>&1 309if test $? -ne 0 ; then cat log; no_result; fi 310 311activity="difference 299" 312$bin/aegis -diff -c 11 -p test.4 -lib $worklib > log 2>&1 313if test $? -ne 0 ; then cat log; no_result; fi 314 315activity="integrate pass 303" 316$bin/aegis -ipass 11 -p test.4 -lib $worklib > log 2>&1 317if test $? -ne 0 ; then cat log; no_result; fi 318 319activity="check file state 307" 320cat > ok << 'fubar' 321src = 322[ 323 { 324 file_name = "a.test.sh"; 325 uuid = "UUID"; 326 action = create; 327 edit = 328 { 329 revision = "1"; 330 encoding = none; 331 uuid = "UUID"; 332 }; 333 edit_origin = 334 { 335 revision = "1"; 336 encoding = none; 337 uuid = "UUID"; 338 }; 339 usage = test; 340 file_fp = 341 { 342 youngest = TIME; 343 oldest = TIME; 344 crypto = "GUNK"; 345 }; 346 diff_file_fp = 347 { 348 youngest = TIME; 349 oldest = TIME; 350 crypto = "GUNK"; 351 }; 352 architecture_times = 353 [ 354 { 355 variant = "unspecified"; 356 test_time = TIME; 357 }, 358 ]; 359 }, 360 { 361 file_name = "aegis.conf"; 362 uuid = "UUID"; 363 action = create; 364 edit = 365 { 366 revision = "1"; 367 encoding = none; 368 uuid = "UUID"; 369 }; 370 edit_origin = 371 { 372 revision = "1"; 373 encoding = none; 374 uuid = "UUID"; 375 }; 376 usage = config; 377 file_fp = 378 { 379 youngest = TIME; 380 oldest = TIME; 381 crypto = "GUNK"; 382 }; 383 diff_file_fp = 384 { 385 youngest = TIME; 386 oldest = TIME; 387 crypto = "GUNK"; 388 }; 389 }, 390 { 391 file_name = "fred"; 392 uuid = "UUID"; 393 action = create; 394 edit = 395 { 396 revision = "1"; 397 encoding = none; 398 uuid = "UUID"; 399 }; 400 edit_origin = 401 { 402 revision = "1"; 403 encoding = none; 404 uuid = "UUID"; 405 }; 406 usage = source; 407 file_fp = 408 { 409 youngest = TIME; 410 oldest = TIME; 411 crypto = "GUNK"; 412 }; 413 diff_file_fp = 414 { 415 youngest = TIME; 416 oldest = TIME; 417 crypto = "GUNK"; 418 }; 419 test = 420 [ 421 "a.test.sh", 422 ]; 423 }, 424]; 425fubar 426if test $? -ne 0 ; then no_result; fi 427check_it ok $workproj/info/change/0/004.fs 428 429# 430# end branch 4 and integrate it 431# 432activity="change attributes 414" 433cat > ca << 'fubar' 434test_baseline_exempt = true; 435regression_test_exempt = true; 436fubar 437if test $? -ne 0 ; then no_result; fi 438$bin/aegis -ca -f ca -c 4 -p test -lib $worklib > log 2>&1 439if test $? -ne 0 ; then cat log; no_result; fi 440 441activity="develop end 423" 442$bin/aegis -de -c 4 -p test -lib $worklib > log 2>&1 443if test $? -ne 0 ; then cat log; no_result; fi 444 445activity="review pass 427" 446$bin/aegis -rpass -c 4 -p test -lib $worklib > log 2>&1 447if test $? -ne 0 ; then cat log; no_result; fi 448 449activity="integrate begin 431" 450$bin/aegis -ib -c 4 -p test -lib $worklib > log 2>&1 451if test $? -ne 0 ; then cat log; no_result; fi 452 453activity="build 435" 454$bin/aegis -b -c 4 -p test -lib $worklib > log 2>&1 455if test $? -ne 0 ; then cat log; no_result; fi 456 457activity="test 439" 458$bin/aegis -t -c 4 -p test -lib $worklib > log 2>&1 459if test $? -ne 0 ; then cat log; no_result; fi 460 461activity="integrate pass 443" 462$bin/aegis -ipass -c 4 -p test -lib $worklib > log 2>&1 463if test $? -ne 0 ; then cat log; no_result; fi 464 465# 466# Now make sure that the test correlations look as they should 467# 468activity="check file state 450" 469cat > ok << 'fubar' 470src = 471[ 472 { 473 file_name = "a.test.sh"; 474 uuid = "UUID"; 475 action = create; 476 edit = 477 { 478 revision = "2"; 479 encoding = none; 480 uuid = "UUID"; 481 }; 482 edit_origin = 483 { 484 revision = "2"; 485 encoding = none; 486 uuid = "UUID"; 487 }; 488 usage = test; 489 file_fp = 490 { 491 youngest = TIME; 492 oldest = TIME; 493 crypto = "GUNK"; 494 }; 495 architecture_times = 496 [ 497 { 498 variant = "unspecified"; 499 test_time = TIME; 500 }, 501 ]; 502 }, 503 { 504 file_name = "aegis.conf"; 505 uuid = "UUID"; 506 action = create; 507 edit = 508 { 509 revision = "2"; 510 encoding = none; 511 uuid = "UUID"; 512 }; 513 edit_origin = 514 { 515 revision = "2"; 516 encoding = none; 517 uuid = "UUID"; 518 }; 519 usage = config; 520 file_fp = 521 { 522 youngest = TIME; 523 oldest = TIME; 524 crypto = "GUNK"; 525 }; 526 }, 527 { 528 file_name = "fred"; 529 uuid = "UUID"; 530 action = create; 531 edit = 532 { 533 revision = "2"; 534 encoding = none; 535 uuid = "UUID"; 536 }; 537 edit_origin = 538 { 539 revision = "2"; 540 encoding = none; 541 uuid = "UUID"; 542 }; 543 usage = source; 544 file_fp = 545 { 546 youngest = TIME; 547 oldest = TIME; 548 crypto = "GUNK"; 549 }; 550 test = 551 [ 552 "a.test.sh", 553 ]; 554 }, 555]; 556fubar 557if test $? -ne 0 ; then no_result; fi 558check_it ok $workproj/info/trunk.fs 559 560# 561# Only definite negatives are possible. 562# The functionality exercised by this test appears to work, 563# no other guarantees are made. 564# 565pass 566# vim: set ts=8 sw=4 et : 567