1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1995-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# This test creates a project, and performs a single change. It then 22# creates a branch, and performs another change on that branch. 23# 24 25unset AEGIS_PROJECT 26unset AEGIS_CHANGE 27unset AEGIS_PATH 28unset AEGIS 29unset LINES 30unset COLS 31umask 022 32 33USER=${USER:-${LOGNAME:-`whoami`}} 34 35work=${AEGIS_TMP:-/tmp}/$$ 36 37here=`pwd` 38if test $? -ne 0; then exit 2; fi 39 40bin="$here/${1-.}/bin" 41 42if test "$EXEC_SEARCH_PATH" != "" 43then 44 tpath= 45 hold="$IFS" 46 IFS=":$IFS" 47 for tpath2 in $EXEC_SEARCH_PATH 48 do 49 tpath=${tpath}${tpath2}/${1-.}/bin: 50 done 51 IFS="$hold" 52 PATH=${tpath}${PATH} 53else 54 PATH=${bin}:${PATH} 55fi 56export PATH 57 58activity="create working directory 58" 59 60pass() 61{ 62 set +x 63 echo PASSED 1>&2 64 cd $here 65 find $work -type d -user $USER -exec chmod u+w {} \; 66 rm -rf $work 67 exit 0 68} 69fail() 70{ 71 set +x 72 echo FAILED test of branching functionality "($activity)" 1>&2 73 cd $here 74 find $work -type d -user $USER -exec chmod u+w {} \; 75 rm -rf $work 76 exit 1 77} 78no_result() 79{ 80 set +x 81 echo NO RESULT test of branching functionality "($activity)" 1>&2 82 cd $here 83 find $work -type d -user $USER -exec chmod u+w {} \; 84 rm -rf $work 85 exit 2 86} 87trap "no_result" 1 2 3 15 88 89check_it() 90{ 91 sed -e "s|$work|...|g" \ 92 -e 's|= 0; /.*|= TIME_NOT_SET;|' \ 93 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 94 -e "s/\"$USER\"/\"USER\"/g" \ 95 -e 's/19[0-9][0-9]/YYYY/' \ 96 -e 's/20[0-9][0-9]/YYYY/' \ 97 -e 's/node = ".*";/node = "NODE";/' \ 98 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 99 -e 's/uuid = ".*"/uuid = "UUID"/' \ 100 < $1 > $work/sed.out 101 if test $? -ne 0; then no_result; fi 102 diff -b $2 $work/sed.out 103 if test $? -ne 0; then fail; fi 104} 105 106# 107# some variables to make things easier to read 108# 109PAGER=cat 110export PAGER 111 112AEGIS_FLAGS="delete_file_preference = no_keep; \ 113 lock_wait_preference = always; \ 114 diff_preference = automatic_merge; \ 115 pager_preference = never; \ 116 persevere_preference = all; \ 117 log_file_preference = never;" 118export AEGIS_FLAGS 119AEGIS_THROTTLE=-1 120export AEGIS_THROTTLE 121 122worklib=$work/lib 123workproj=$work/foo.proj 124workchan=$work/foo.chan 125tmp=$work/tmp 126 127# 128# make the directories 129# 130mkdir $work $work/lib 131if test $? -ne 0 ; then no_result; fi 132cd $work 133if test $? -ne 0 ; then no_result; fi 134chmod 0777 $work/lib 135if test $? -ne 0 ; then no_result; fi 136 137# 138# use the built-in error messages 139# 140AEGIS_MESSAGE_LIBRARY=$work/no-such-dir 141export AEGIS_MESSAGE_LIBRARY 142unset LANG 143unset LANGUAGE 144 145# 146# If the C++ compiler is called something other than "c++", as 147# discovered by the configure script, create a shell script called 148# "c++" which invokes the correct C++ compiler. Make sure the current 149# directory is in the path, so that it will be invoked. 150# 151if test "$CXX" != "c++" 152then 153 cat >> $work/c++ << fubar 154#!/bin/sh 155exec ${CXX-g++} \$* 156fubar 157 if test $? -ne 0 ; then no_result; fi 158 chmod a+rx $work/c++ 159 if test $? -ne 0 ; then no_result; fi 160 PATH=${work}:${PATH} 161 export PATH 162fi 163 164# 165# make a new project 166# 167activity="new project 167" 168$bin/aegis -newpro foo -dir $workproj -lib $worklib -vers - > log 2>&1 169if test $? -ne 0 ; then cat log; no_result; fi 170 171# 172# change project attributes 173# 174activity="project attributes 174" 175cat > $tmp << 'end' 176description = "A bogus project created to test branching."; 177developer_may_review = true; 178developer_may_integrate = true; 179reviewer_may_integrate = true; 180end 181if test $? -ne 0 ; then no_result; fi 182$bin/aegis -proatt -f $tmp -proj foo -lib $worklib > log 2>&1 183if test $? -ne 0 ; then cat log; no_result; fi 184 185# 186# create a new change 187# 188activity="new change 188" 189cat > $tmp << 'end' 190brief_description = "change one"; 191cause = internal_bug; 192end 193if test $? -ne 0 ; then no_result; fi 194$bin/aegis -new_change 1 -f $tmp -project foo -lib $worklib > log 2>&1 195if test $? -ne 0 ; then cat log; no_result; fi 196 197# 198# add staff 199# 200activity="staff 200" 201$bin/aegis -newdev $USER -p foo -lib $worklib > log 2>&1 202if test $? -ne 0 ; then cat log; no_result; fi 203$bin/aegis -newrev $USER -p foo -lib $worklib > log 2>&1 204if test $? -ne 0 ; then cat log; no_result; fi 205$bin/aegis -newint $USER -p foo -lib $worklib > log 2>&1 206if test $? -ne 0 ; then cat log; no_result; fi 207 208# 209# begin development of a change 210# 211activity="develop begin 211" 212$bin/aegis -devbeg 1 -p foo -dir $workchan -lib $worklib > log 2>&1 213if test $? -ne 0 ; then cat log; no_result; fi 214activity="new file 214" 215$bin/aegis -new_file $workchan/main.cc $workchan/aegis.conf -nl -lib $worklib \ 216 -Pro foo > log 2>&1 217if test $? -ne 0 ; then cat log; no_result; fi 218 219cat > $workchan/main.cc << 'end' 220int 221main(int argc, char **argv) 222{ 223 return 0; 224} 225end 226cat > $workchan/aegis.conf << 'end' 227build_command = 228 "rm -f foo; c++ -o foo -D'VERSION=\"$v\"' -D'PATH=\"$sp\"' main.cc"; 229 230history_get_command = "aesvt -check-out -edit ${quote $edit} " 231 "-history ${quote $history} -f ${quote $output}"; 232history_put_command = "aesvt -check-in -history ${quote $history} " 233 "-f ${quote $input}"; 234history_query_command = "aesvt -query -history ${quote $history}"; 235history_content_limitation = binary_capable; 236 237diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 238 239diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 240 echo '1,$$p' ) | ed - $mr > $out"; 241 242/* 243 * file templates 244 */ 245file_template = 246[ 247 { 248 pattern = [ "*" ]; 249 body = "hello\n"; 250 }, 251 { 252 pattern = [ "test/*/*.sh" ]; 253 body = "#!/bin/sh\nexit 1\n"; 254 } 255]; 256end 257 258# 259# create a new test 260# 261activity="new test 261" 262$bin/aegis -nt -lib $worklib -p foo > log 2>&1 263if test $? -ne 0 ; then cat log; no_result; fi 264cat > $workchan/test/00/t0001a.sh << 'end' 265#!/bin/sh 266pass() 267{ 268 exit 0 269} 270fail() 271{ 272 echo SHUZBUTT 1>&2 273 exit 1 274} 275no_result() 276{ 277 echo WHIMPER 1>&2 278 exit 2 279} 280trap "no_result" 1 2 3 15 281./foo 282if test $? -ne 0; then fail; fi 283pass 284end 285if test $? -ne 0 ; then no_result; fi 286 287# 288# build the change 289# 290activity="build 290" 291$bin/aegis -build -nl -lib $worklib -p foo > test.out 2>&1 292if test $? -ne 0 ; then cat test.out;no_result; fi 293 294# 295# difference the change 296# 297activity="diff 297" 298$bin/aegis -diff -lib $worklib -p foo > test.out 2>&1 299if test $? -ne 0 ; then cat test.out; no_result; fi 300 301# 302# test the change 303# 304activity="test 304" 305$bin/aegis -test -lib $worklib -p foo -nl > test.out 2>&1 306if test $? -ne 0 ; then cat test.out; no_result; fi 307 308# 309# finish development of the change 310# 311aectivity="develop end 241" 312$bin/aegis -dev_end -lib $worklib -p foo > log 2>&1 313if test $? -ne 0 ; then cat log; no_result; fi 314 315# 316# pass the review 317# 318activity="review pass 318" 319$bin/aegis -review_pass -chan 1 -proj foo -lib $worklib > log 2>&1 320if test $? -ne 0 ; then cat log; no_result; fi 321 322# 323# start integrating 324# 325activity="integrate begin 325" 326$bin/aegis -intbeg 1 -p foo -lib $worklib -v > test.out 2>&1 327if test $? -ne 0 ; then cat test.out; no_result; fi 328 329# 330# integrate build 331# 332activity="integration build 332" 333$bin/aegis -build -nl -lib $worklib -p foo > test.out 2>&1 334if test $? -ne 0 ; then cat test.out; no_result; fi 335 336# 337# integrate test 338# 339activity="integration test 339" 340$bin/aegis -test -nl -lib $worklib -p foo > test.out 2>&1 341if test $? -ne 0 ; then cat test.out; no_result; fi 342 343# 344# check the file state 345# 346cat > ok << 'fubar' 347src = 348[ 349 { 350 file_name = "aegis.conf"; 351 uuid = "UUID"; 352 action = create; 353 usage = config; 354 file_fp = 355 { 356 youngest = TIME; 357 oldest = TIME; 358 crypto = "GUNK"; 359 }; 360 diff_file_fp = 361 { 362 youngest = TIME; 363 oldest = TIME; 364 crypto = "GUNK"; 365 }; 366 }, 367 { 368 file_name = "main.cc"; 369 uuid = "UUID"; 370 action = create; 371 usage = source; 372 file_fp = 373 { 374 youngest = TIME; 375 oldest = TIME; 376 crypto = "GUNK"; 377 }; 378 diff_file_fp = 379 { 380 youngest = TIME; 381 oldest = TIME; 382 crypto = "GUNK"; 383 }; 384 }, 385 { 386 file_name = "test/00/t0001a.sh"; 387 uuid = "UUID"; 388 action = create; 389 usage = test; 390 file_fp = 391 { 392 youngest = TIME; 393 oldest = TIME; 394 crypto = "GUNK"; 395 }; 396 diff_file_fp = 397 { 398 youngest = TIME; 399 oldest = TIME; 400 crypto = "GUNK"; 401 }; 402 architecture_times = 403 [ 404 { 405 variant = "unspecified"; 406 test_time = TIME; 407 }, 408 ]; 409 }, 410]; 411fubar 412if test $? -ne 0 ; then no_result; fi 413check_it $workproj/info/change/0/001.fs ok 414 415# 416# pass the integration 417# 418activity="integrate pass 418" 419$bin/aegis -intpass -nl -lib $worklib -p foo > test.out 2>&1 420if test $? -ne 0 ; then cat test.out; no_result; fi 421 422# 423# create a new branch 424# 425activity="new branch 425" 426$bin/aegis -nbr -lib $worklib -p foo > test.out 2>&1 427if test $? -ne 0 ; then cat test.out; fail; fi 428cat > ok << 'fubar' 429brief_description = "A bogus project created to test branching, branch 2."; 430description = "A bogus project created to test branching, branch 2."; 431cause = internal_enhancement; 432test_exempt = true; 433test_baseline_exempt = true; 434regression_test_exempt = true; 435architecture = 436[ 437 "unspecified", 438]; 439state = being_developed; 440development_directory = "branch.2"; 441history = 442[ 443 { 444 when = TIME; 445 what = new_change; 446 who = "USER"; 447 }, 448 { 449 when = TIME; 450 what = develop_begin; 451 who = "USER"; 452 }, 453]; 454branch = 455{ 456 umask = 022; 457 developer_may_review = true; 458 developer_may_integrate = true; 459 reviewer_may_integrate = true; 460 developers_may_create_changes = false; 461 default_test_exemption = false; 462 default_test_regression_exemption = true; 463 skip_unlucky = false; 464 compress_database = false; 465 develop_end_action = goto_being_reviewed; 466 change = 467 [ 468 ]; 469 administrator = 470 [ 471 "USER", 472 ]; 473 developer = 474 [ 475 "USER", 476 ]; 477 reviewer = 478 [ 479 "USER", 480 ]; 481 integrator = 482 [ 483 "USER", 484 ]; 485 minimum_change_number = 10; 486 reuse_change_numbers = true; 487 minimum_branch_number = 1; 488 protect_development_directory = false; 489}; 490fubar 491if test $? -ne 0 ; then no_result; fi 492check_it $work/foo.proj/info/change/0/002 ok 493 494# 495# check that the branch shows in the project list 496# 497activity="project list 497" 498$bin/aegis -l p -unf -lib $worklib > test.out 2>&1 499if test $? -ne 0 ; then cat test.out; no_result; fi 500grep '^foo[.0-9]* ' < test.out > test.out2 501if test $? -ne 0 ; then no_result; fi 502cat > ok << 'fubar' 503foo.2 .../foo.proj/branch.2 A bogus project created to test branching, branch 2. 504foo .../foo.proj A bogus project created to test branching. 505fubar 506if test $? -ne 0 ; then no_result; fi 507check_it test.out2 ok 508 509# 510# make sure the right state files have been created 511# and that they contain the right stuff 512# 513activity="check branch state files 513" 514cat > ok << fubar 515brief_description = "A bogus project created to test branching, branch 2."; 516description = "A bogus project created to test branching, branch 2."; 517cause = internal_enhancement; 518test_exempt = true; 519test_baseline_exempt = true; 520regression_test_exempt = true; 521architecture = 522[ 523 "unspecified", 524]; 525state = being_developed; 526development_directory = "branch.2"; 527history = 528[ 529 { 530 when = TIME; 531 what = new_change; 532 who = "USER"; 533 }, 534 { 535 when = TIME; 536 what = develop_begin; 537 who = "USER"; 538 }, 539]; 540branch = 541{ 542 umask = 022; 543 developer_may_review = true; 544 developer_may_integrate = true; 545 reviewer_may_integrate = true; 546 developers_may_create_changes = false; 547 default_test_exemption = false; 548 default_test_regression_exemption = true; 549 skip_unlucky = false; 550 compress_database = false; 551 develop_end_action = goto_being_reviewed; 552 change = 553 [ 554 ]; 555 administrator = 556 [ 557 "USER", 558 ]; 559 developer = 560 [ 561 "USER", 562 ]; 563 reviewer = 564 [ 565 "USER", 566 ]; 567 integrator = 568 [ 569 "USER", 570 ]; 571 minimum_change_number = 10; 572 reuse_change_numbers = true; 573 minimum_branch_number = 1; 574 protect_development_directory = false; 575}; 576fubar 577if test $? -ne 0 ; then no_result; fi 578check_it $workproj/info/change/0/002 ok 579if test ! -d $workproj/branch.2; then fail; fi 580if test ! -d $workproj/branch.2/baseline; then fail; fi 581 582# 583# create a change on the new wbranch 584# 585cat > $tmp << 'end' 586brief_description = "change one of branch two"; 587cause = internal_bug; 588end 589if test $? -ne 0 ; then no_result; fi 590$bin/aegis -new_change 1 -f $tmp -project foo-2 -lib $worklib > log 2>&1 591if test $? -ne 0 ; then cat log; fail; fi 592 593# 594# make sure the right state files have been created 595# and that they contain the right stuff 596# 597activity="check change state file 597" 598cat > ok << fubar 599brief_description = "change one of branch two"; 600description = "change one of branch two"; 601cause = internal_bug; 602test_exempt = false; 603test_baseline_exempt = false; 604regression_test_exempt = true; 605architecture = 606[ 607 "unspecified", 608]; 609state = awaiting_development; 610given_regression_test_exemption = true; 611history = 612[ 613 { 614 when = TIME; 615 what = new_change; 616 who = "USER"; 617 }, 618]; 619fubar 620if test $? -ne 0 ; then no_result; fi 621check_it $workproj/info/change/0/002.branch/0/001 ok 622cat > ok << fubar 623src = 624[ 625]; 626fubar 627if test $? -ne 0 ; then no_result; fi 628check_it $workproj/info/change/0/002.branch/0/001.fs ok 629 630# 631# start work on foo-2, change 1 632# 633activity="develop begin 633" 634$bin/aegis -devbeg 1 -p foo-2 -dir $workchan -lib $worklib > log 2>&1 635if test $? -ne 0 ; then cat log; no_result; fi 636 637# 638# check the contents of the state files 639# 640activity="check user state file 640" 641cat > ok << fubar 642own = 643[ 644 { 645 project_name = "foo.2"; 646 changes = 647 [ 648 1, 649 ]; 650 }, 651]; 652fubar 653if test $? -ne 0 ; then no_result; fi 654check_it $worklib/user/$USER ok 655 656# 657# copy a file into the change 658# 659activity="copy file 659" 660$bin/aegis -cp $workchan/main.cc -nl -lib $worklib -p foo-2 > log 2>&1 661if test $? -ne 0 ; then cat log; fail; fi 662 663# 664# change the file 665# 666cat > $workchan/main.cc << 'end' 667 668#include <stdio.h> 669 670int 671main(int argc, char **argv) 672{ 673 if (argc != 1) 674 { 675 fprintf(stderr, "usage: %s\n", argv[0]); 676 return 1; 677 } 678 printf("hello, world\n"); 679 return 0; 680} 681end 682if test $? -ne 0 ; then no_result; fi 683 684# 685# need another test 686# 687activity="new test 687" 688$bin/aegis -nt -lib $worklib -p foo-2 > log 2>&1 689if test $? -ne 0 ; then cat log; fail; fi 690cat > $workchan/test/00/t0002a.sh << 'end' 691#!/bin/sh 692set -x 693pass() 694{ 695 exit 0 696} 697fail() 698{ 699 echo SHUZBUTT 1>&2 700 exit 1 701} 702no_result() 703{ 704 echo WHIMPER 1>&2 705 exit 2 706} 707trap "no_result" 1 2 3 15 708./foo > /dev/null 2>&1 709if test $? -ne 0; then fail; fi 710./foo ickky 711if test $? -ne 1; then fail; fi 712pass 713end 714 715# 716# build the change 717# diff the change 718# test the change 719# 720activity="build 720" 721$bin/aegis -b -nl -lib $worklib -p foo-2 > test.out 2>&1 722if test $? -ne 0 ; then cat test.out; no_result; fi 723activity="diff 723" 724$bin/aegis -diff -nl -lib $worklib -p foo-2 > test.out 2>&1 725if test $? -ne 0 ; then cat test.out; fail; fi 726activity="test 726" 727$bin/aegis -test -nl -lib $worklib -p foo-2 > test.out 2>&1 728if test $? -ne 0 ; then cat test.out; fail; fi 729activity="test bl 729" 730$bin/aegis -test -bl -nl -lib $worklib -p foo-2 > test.out 2>&1 731if test $? -ne 0 ; then cat test.out; fail; fi 732activity="test reg 732" 733$bin/aegis -test -reg -nl -lib $worklib -p foo-2 > test.out 2>&1 734if test $? -ne 0 ; then cat test.out; fail; fi 735 736# 737# end development 738# review pass 739# start integrating 740# 741activity="devlop end 741" 742$bin/aegis -devend -lib $worklib -p foo-2 > log 2>&1 743if test $? -ne 0 ; then cat log; fail; fi 744activity="review pass 744" 745$bin/aegis -revpass -c 1 -p foo-2 -lib $worklib > log 2>&1 746if test $? -ne 0 ; then cat log; no_result; fi 747activity="integrate begin 747" 748$bin/aegis -intbeg -c 1 -p foo-2 -lib $worklib -v > test.out 2>&1 749if test $? -ne 0 ; then cat test.out; fail; fi 750 751# 752# build the integration 753# test the integration 754# test the integration against the baseline 755# 756activity="integrate build 756" 757$bin/aegis -b -nl -lib $worklib -p foo-2 > test.out 2>&1 758if test $? -ne 0 ; then cat test.out; no_result; fi 759activity="integrate diff 759" 760$bin/aegis -diff -nl -lib $worklib -p foo-2 > test.out 2>&1 761if test $? -ne 0 ; then cat test.out; fail; fi 762activity="integrate test 762" 763$bin/aegis -t -nl -lib $worklib -p foo-2 > test.out 2>&1 764if test $? -ne 0 ; then cat test.out; no_result; fi 765$bin/aegis -t -bl -nl -lib $worklib -p foo-2 > test.out 2>&1 766if test $? -ne 0 ; then cat test.out; no_result; fi 767$bin/aegis -t -reg -nl -lib $worklib -p foo-2 > test.out 2>&1 768if test $? -ne 0 ; then cat test.out; no_result; fi 769 770# 771# check the project file state 772# 773activity="check change file state 773" 774cat > ok << 'fubar' 775src = 776[ 777 { 778 file_name = "main.cc"; 779 uuid = "UUID"; 780 action = transparent; 781 edit = 782 { 783 revision = "1"; 784 encoding = none; 785 uuid = "UUID"; 786 }; 787 edit_origin = 788 { 789 revision = "1"; 790 encoding = none; 791 uuid = "UUID"; 792 }; 793 usage = source; 794 locked_by = 1; 795 about_to_be_copied_by = 1; 796 test = 797 [ 798 "test/00/t0001a.sh", 799 ]; 800 }, 801 { 802 file_name = "test/00/t0002a.sh"; 803 uuid = "UUID"; 804 action = transparent; 805 usage = test; 806 locked_by = 1; 807 about_to_be_created_by = 1; 808 }, 809]; 810fubar 811if test $? -ne 0 ; then no_result; fi 812check_it $workproj/info/change/0/002.fs ok 813 814# 815# pass the integration 816# branch 2, change 1 817# 818activity="integrate pass 818" 819$bin/aegis -intpass -nl -lib $worklib -p foo-2 > test.out 2>&1 820if test $? -ne 0 ; then cat test.out; fail; fi 821 822# 823# check the contents of the state files 824# 825activity="check branch state 825" 826cat > ok << 'fubar' 827brief_description = "A bogus project created to test branching, branch 2."; 828description = "A bogus project created to test branching, branch 2."; 829cause = internal_enhancement; 830test_exempt = true; 831test_baseline_exempt = true; 832regression_test_exempt = true; 833architecture = 834[ 835 "unspecified", 836]; 837copyright_years = 838[ 839 YYYY, 840]; 841state = being_developed; 842build_time = TIME; 843test_time = TIME; 844test_baseline_time = TIME; 845regression_test_time = TIME; 846architecture_times = 847[ 848 { 849 variant = "unspecified"; 850 node = "NODE"; 851 build_time = TIME; 852 test_time = TIME; 853 test_baseline_time = TIME; 854 regression_test_time = TIME; 855 }, 856]; 857development_directory = "branch.2"; 858history = 859[ 860 { 861 when = TIME; 862 what = new_change; 863 who = "USER"; 864 }, 865 { 866 when = TIME; 867 what = develop_begin; 868 who = "USER"; 869 }, 870]; 871branch = 872{ 873 umask = 022; 874 developer_may_review = true; 875 developer_may_integrate = true; 876 reviewer_may_integrate = true; 877 developers_may_create_changes = false; 878 default_test_exemption = false; 879 default_test_regression_exemption = true; 880 skip_unlucky = false; 881 compress_database = false; 882 develop_end_action = goto_being_reviewed; 883 history = 884 [ 885 { 886 delta_number = 1; 887 change_number = 1; 888 uuid = "UUID"; 889 when = TIME; 890 is_a_branch = no; 891 }, 892 ]; 893 change = 894 [ 895 1, 896 ]; 897 administrator = 898 [ 899 "USER", 900 ]; 901 developer = 902 [ 903 "USER", 904 ]; 905 reviewer = 906 [ 907 "USER", 908 ]; 909 integrator = 910 [ 911 "USER", 912 ]; 913 minimum_change_number = 10; 914 reuse_change_numbers = true; 915 minimum_branch_number = 1; 916 protect_development_directory = false; 917}; 918fubar 919if test $? -ne 0 ; then cat test.out; no_result; fi 920check_it $workproj/info/change/0/002 ok 921activity="check branch file state 921" 922cat > ok << 'fubar' 923src = 924[ 925 { 926 file_name = "main.cc"; 927 uuid = "UUID"; 928 action = modify; 929 edit = 930 { 931 revision = "2"; 932 encoding = none; 933 uuid = "UUID"; 934 }; 935 edit_origin = 936 { 937 revision = "1"; 938 encoding = none; 939 uuid = "UUID"; 940 }; 941 usage = source; 942 file_fp = 943 { 944 youngest = TIME; 945 oldest = TIME; 946 crypto = "GUNK"; 947 }; 948 diff_file_fp = 949 { 950 youngest = TIME; 951 oldest = TIME; 952 crypto = "GUNK"; 953 }; 954 test = 955 [ 956 "test/00/t0001a.sh", 957 "test/00/t0002a.sh", 958 ]; 959 }, 960 { 961 file_name = "test/00/t0002a.sh"; 962 uuid = "UUID"; 963 action = create; 964 edit = 965 { 966 revision = "1"; 967 encoding = none; 968 uuid = "UUID"; 969 }; 970 edit_origin = 971 { 972 revision = "1"; 973 encoding = none; 974 uuid = "UUID"; 975 }; 976 usage = test; 977 file_fp = 978 { 979 youngest = TIME; 980 oldest = TIME; 981 crypto = "GUNK"; 982 }; 983 diff_file_fp = 984 { 985 youngest = TIME; 986 oldest = TIME; 987 crypto = "GUNK"; 988 }; 989 architecture_times = 990 [ 991 { 992 variant = "unspecified"; 993 test_time = TIME; 994 test_baseline_time = TIME; 995 }, 996 ]; 997 }, 998]; 999fubar 1000if test $? -ne 0 ; then cat test.out; no_result; fi 1001check_it $workproj/info/change/0/002.fs ok 1002 1003# 1004# end development of the branch 1005# 1006activity="devlop end 1006" 1007$bin/aegis -devend -lib $worklib -p foo -c 2 > log 2>&1 1008if test $? -ne 0 ; then cat log; fail; fi 1009 1010# 1011# check the project file state 1012# 1013cat > ok << 'fubar' 1014src = 1015[ 1016 { 1017 file_name = "aegis.conf"; 1018 uuid = "UUID"; 1019 action = create; 1020 edit = 1021 { 1022 revision = "1"; 1023 encoding = none; 1024 uuid = "UUID"; 1025 }; 1026 edit_origin = 1027 { 1028 revision = "1"; 1029 encoding = none; 1030 uuid = "UUID"; 1031 }; 1032 usage = config; 1033 file_fp = 1034 { 1035 youngest = TIME; 1036 oldest = TIME; 1037 crypto = "GUNK"; 1038 }; 1039 }, 1040 { 1041 file_name = "main.cc"; 1042 uuid = "UUID"; 1043 action = create; 1044 edit = 1045 { 1046 revision = "1"; 1047 encoding = none; 1048 uuid = "UUID"; 1049 }; 1050 edit_origin = 1051 { 1052 revision = "1"; 1053 encoding = none; 1054 uuid = "UUID"; 1055 }; 1056 usage = source; 1057 file_fp = 1058 { 1059 youngest = TIME; 1060 oldest = TIME; 1061 crypto = "GUNK"; 1062 }; 1063 locked_by = 2; 1064 test = 1065 [ 1066 "test/00/t0001a.sh", 1067 ]; 1068 }, 1069 { 1070 file_name = "test/00/t0001a.sh"; 1071 uuid = "UUID"; 1072 action = create; 1073 edit = 1074 { 1075 revision = "1"; 1076 encoding = none; 1077 uuid = "UUID"; 1078 }; 1079 edit_origin = 1080 { 1081 revision = "1"; 1082 encoding = none; 1083 uuid = "UUID"; 1084 }; 1085 usage = test; 1086 file_fp = 1087 { 1088 youngest = TIME; 1089 oldest = TIME; 1090 crypto = "GUNK"; 1091 }; 1092 architecture_times = 1093 [ 1094 { 1095 variant = "unspecified"; 1096 test_time = TIME; 1097 }, 1098 ]; 1099 }, 1100 { 1101 file_name = "test/00/t0002a.sh"; 1102 uuid = "UUID"; 1103 action = transparent; 1104 usage = test; 1105 locked_by = 2; 1106 about_to_be_created_by = 2; 1107 }, 1108]; 1109fubar 1110if test $? -ne 0 ; then no_result; fi 1111check_it $workproj/info/trunk.fs ok 1112 1113# 1114# review the branch and and start integrating it 1115# 1116activity="review pass 1116" 1117$bin/aegis -revpass -c 2 -p foo -lib $worklib > log 2>&1 1118if test $? -ne 0 ; then cat log; no_result; fi 1119activity="integrate begin 1119" 1120$bin/aegis -intbeg -c 2 -p foo -lib $worklib > test.out 2>&1 1121if test $? -ne 0 ; then cat test.out; no_result; fi 1122activity="integrate build 1122" 1123$bin/aegis -b -nl -lib $worklib -p foo > test.out 2>&1 1124if test $? -ne 0 ; then cat test.out; no_result; fi 1125activity="integrate test 1125" 1126$bin/aegis -t -nl -lib $worklib -p foo > test.out 2>&1 1127if test $? -ne 0 ; then cat test.out; no_result; fi 1128$bin/aegis -t -bl -nl -lib $worklib -p foo > test.out 2>&1 1129if test $? -ne 0 ; then cat test.out; no_result; fi 1130$bin/aegis -t -reg -nl -lib $worklib -p foo > test.out 2>&1 1131if test $? -ne 0 ; then cat test.out; no_result; fi 1132 1133# 1134# check the branch file state 1135# 1136cat > ok << 'fubar' 1137src = 1138[ 1139 { 1140 file_name = "main.cc"; 1141 uuid = "UUID"; 1142 action = modify; 1143 edit = 1144 { 1145 revision = "2"; 1146 encoding = none; 1147 uuid = "UUID"; 1148 }; 1149 edit_origin = 1150 { 1151 revision = "1"; 1152 encoding = none; 1153 uuid = "UUID"; 1154 }; 1155 usage = source; 1156 file_fp = 1157 { 1158 youngest = TIME; 1159 oldest = TIME; 1160 crypto = "GUNK"; 1161 }; 1162 diff_file_fp = 1163 { 1164 youngest = TIME; 1165 oldest = TIME; 1166 crypto = "GUNK"; 1167 }; 1168 test = 1169 [ 1170 "test/00/t0001a.sh", 1171 "test/00/t0002a.sh", 1172 ]; 1173 }, 1174 { 1175 file_name = "test/00/t0002a.sh"; 1176 uuid = "UUID"; 1177 action = create; 1178 edit = 1179 { 1180 revision = "1"; 1181 encoding = none; 1182 uuid = "UUID"; 1183 }; 1184 edit_origin = 1185 { 1186 revision = "1"; 1187 encoding = none; 1188 uuid = "UUID"; 1189 }; 1190 usage = test; 1191 file_fp = 1192 { 1193 youngest = TIME; 1194 oldest = TIME; 1195 crypto = "GUNK"; 1196 }; 1197 diff_file_fp = 1198 { 1199 youngest = TIME; 1200 oldest = TIME; 1201 crypto = "GUNK"; 1202 }; 1203 architecture_times = 1204 [ 1205 { 1206 variant = "unspecified"; 1207 test_time = TIME; 1208 test_baseline_time = TIME; 1209 }, 1210 ]; 1211 }, 1212]; 1213fubar 1214if test $? -ne 0 ; then no_result; fi 1215check_it $workproj/info/change/0/002.fs ok 1216 1217activity="integrate pass 1217" 1218$bin/aegis -intpass -nl -lib $worklib -p foo > test.out 2>&1 1219if test $? -ne 0 ; then cat test.out; no_result; fi 1220 1221# 1222# check the contents of the branch file state 1223# 1224activity="check branch file state 1224" 1225cat > ok << fubar 1226src = 1227[ 1228 { 1229 file_name = "main.cc"; 1230 uuid = "UUID"; 1231 action = modify; 1232 edit = 1233 { 1234 revision = "3"; 1235 encoding = none; 1236 uuid = "UUID"; 1237 }; 1238 edit_origin = 1239 { 1240 revision = "1"; 1241 encoding = none; 1242 uuid = "UUID"; 1243 }; 1244 usage = source; 1245 test = 1246 [ 1247 "test/00/t0001a.sh", 1248 "test/00/t0002a.sh", 1249 ]; 1250 }, 1251 { 1252 file_name = "test/00/t0002a.sh"; 1253 uuid = "UUID"; 1254 action = create; 1255 edit = 1256 { 1257 revision = "2"; 1258 encoding = none; 1259 uuid = "UUID"; 1260 }; 1261 edit_origin = 1262 { 1263 revision = "1"; 1264 encoding = none; 1265 uuid = "UUID"; 1266 }; 1267 usage = test; 1268 }, 1269]; 1270fubar 1271if test $? -ne 0 ; then no_result; fi 1272check_it $workproj/info/change/0/002.fs ok 1273 1274# 1275# the branch is in the 'completed' state, there shoud be no deveopment 1276# directory 1277# 1278if test -d $workproj/branch.2; then fail; fi 1279 1280# 1281# check the contents of the project file state 1282# 1283activity="check trunk file state 1283" 1284cat > ok << fubar 1285src = 1286[ 1287 { 1288 file_name = "aegis.conf"; 1289 uuid = "UUID"; 1290 action = create; 1291 edit = 1292 { 1293 revision = "1"; 1294 encoding = none; 1295 uuid = "UUID"; 1296 }; 1297 edit_origin = 1298 { 1299 revision = "1"; 1300 encoding = none; 1301 uuid = "UUID"; 1302 }; 1303 usage = config; 1304 file_fp = 1305 { 1306 youngest = TIME; 1307 oldest = TIME; 1308 crypto = "GUNK"; 1309 }; 1310 }, 1311 { 1312 file_name = "main.cc"; 1313 uuid = "UUID"; 1314 action = create; 1315 edit = 1316 { 1317 revision = "3"; 1318 encoding = none; 1319 uuid = "UUID"; 1320 }; 1321 edit_origin = 1322 { 1323 revision = "3"; 1324 encoding = none; 1325 uuid = "UUID"; 1326 }; 1327 usage = source; 1328 file_fp = 1329 { 1330 youngest = TIME; 1331 oldest = TIME; 1332 crypto = "GUNK"; 1333 }; 1334 test = 1335 [ 1336 "test/00/t0001a.sh", 1337 "test/00/t0002a.sh", 1338 ]; 1339 }, 1340 { 1341 file_name = "test/00/t0001a.sh"; 1342 uuid = "UUID"; 1343 action = create; 1344 edit = 1345 { 1346 revision = "1"; 1347 encoding = none; 1348 uuid = "UUID"; 1349 }; 1350 edit_origin = 1351 { 1352 revision = "1"; 1353 encoding = none; 1354 uuid = "UUID"; 1355 }; 1356 usage = test; 1357 file_fp = 1358 { 1359 youngest = TIME; 1360 oldest = TIME; 1361 crypto = "GUNK"; 1362 }; 1363 architecture_times = 1364 [ 1365 { 1366 variant = "unspecified"; 1367 test_time = TIME; 1368 }, 1369 ]; 1370 }, 1371 { 1372 file_name = "test/00/t0002a.sh"; 1373 uuid = "UUID"; 1374 action = create; 1375 edit = 1376 { 1377 revision = "2"; 1378 encoding = none; 1379 uuid = "UUID"; 1380 }; 1381 edit_origin = 1382 { 1383 revision = "2"; 1384 encoding = none; 1385 uuid = "UUID"; 1386 }; 1387 usage = test; 1388 file_fp = 1389 { 1390 youngest = TIME; 1391 oldest = TIME; 1392 crypto = "GUNK"; 1393 }; 1394 architecture_times = 1395 [ 1396 { 1397 variant = "unspecified"; 1398 test_time = TIME; 1399 test_baseline_time = TIME; 1400 }, 1401 ]; 1402 }, 1403]; 1404fubar 1405if test $? -ne 0 ; then no_result; fi 1406check_it $workproj/info/trunk.fs ok 1407 1408activity="check the trunk state 1408" 1409cat > ok <<EOF 1410brief_description = "A bogus project created to test branching."; 1411description = "The \"foo\" program."; 1412cause = internal_enhancement; 1413test_exempt = false; 1414test_baseline_exempt = false; 1415regression_test_exempt = true; 1416architecture = 1417[ 1418 "unspecified", 1419]; 1420copyright_years = 1421[ 1422 YYYY, 1423]; 1424state = being_developed; 1425build_time = TIME; 1426test_time = TIME; 1427test_baseline_time = TIME; 1428regression_test_time = TIME; 1429architecture_times = 1430[ 1431 { 1432 variant = "unspecified"; 1433 node = "NODE"; 1434 build_time = TIME; 1435 test_time = TIME; 1436 test_baseline_time = TIME; 1437 regression_test_time = TIME; 1438 }, 1439]; 1440development_directory = "."; 1441history = 1442[ 1443 { 1444 when = TIME; 1445 what = new_change; 1446 who = "USER"; 1447 }, 1448 { 1449 when = TIME; 1450 what = develop_begin; 1451 who = "USER"; 1452 }, 1453]; 1454branch = 1455{ 1456 umask = 022; 1457 developer_may_review = true; 1458 developer_may_integrate = true; 1459 reviewer_may_integrate = true; 1460 developers_may_create_changes = false; 1461 default_test_exemption = false; 1462 default_test_regression_exemption = true; 1463 skip_unlucky = false; 1464 compress_database = false; 1465 develop_end_action = goto_being_reviewed; 1466 history = 1467 [ 1468 { 1469 delta_number = 1; 1470 change_number = 1; 1471 uuid = "UUID"; 1472 when = TIME; 1473 is_a_branch = no; 1474 }, 1475 { 1476 delta_number = 2; 1477 change_number = 2; 1478 uuid = "UUID"; 1479 when = TIME; 1480 is_a_branch = yes; 1481 }, 1482 ]; 1483 change = 1484 [ 1485 1, 1486 2, 1487 ]; 1488 sub_branch = 1489 [ 1490 2, 1491 ]; 1492 administrator = 1493 [ 1494 "USER", 1495 ]; 1496 developer = 1497 [ 1498 "USER", 1499 ]; 1500 reviewer = 1501 [ 1502 "USER", 1503 ]; 1504 integrator = 1505 [ 1506 "USER", 1507 ]; 1508 minimum_change_number = 10; 1509 reuse_change_numbers = true; 1510 minimum_branch_number = 1; 1511 protect_development_directory = false; 1512}; 1513EOF 1514if test $? -ne 0 ; then no_result; fi 1515 1516check_it $workproj/info/trunk ok 1517 1518# 1519# the things tested in this test, worked 1520# 1521pass 1522 1523 1524# vim: set ts=8 sw=4 et : 1525