1#!/bin/sh 2# 3# aegis - The "aegis" program. 4# Copyright (C) 2008 Walter Franzini 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 3 of the License, or (at 9# your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License along 17# with this program. If not, see <http://www.gnu.org/licenses/>. 18# 19 20TEST_SUBJECT=".pfs filtering at aeipass" 21 22# load up standard prelude and test functions 23. test_funcs 24 25check_it() 26{ 27 sed -e "s|$work|...|g" \ 28 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 29 -e "s/\"$USER\"/\"USER\"/g" \ 30 -e 's/uuid = ".*"/uuid = "UUID"/' \ 31 -e 's/19[0-9][0-9]/YYYY/' \ 32 -e 's/20[0-9][0-9]/YYYY/' \ 33 -e 's/node = ".*"/node = "NODE"/' \ 34 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 35 < $2 > $work/sed.out 36 if test $? -ne 0; then no_result; fi 37 diff $1 $work/sed.out 38 if test $? -ne 0; then fail; fi 39} 40 41# 42# test the functionality 43# 44# 45# make a new project 46# 47activity="new project 47" 48aegis -newpro foo -version "" -dir $work/proj -lib $work/lib 49if test $? -ne 0 ; then fail; fi 50 51AEGIS_PROJECT=foo 52export AEGIS_PROJECT 53 54# 55# change project attributes 56# 57activity="project attributes 57" 58cat > atts << 'fubar' 59description = "The \"foo\" program."; 60developer_may_review = true; 61developer_may_integrate = true; 62reviewer_may_integrate = true; 63developers_may_create_changes = true; 64umask = 022; 65default_test_exemption = true; 66default_test_regression_exemption = true; 67minimum_change_number = 10; 68reuse_change_numbers = true; 69minimum_branch_number = 1; 70skip_unlucky = false; 71compress_database = false; 72develop_end_action = goto_awaiting_integration; 73protect_development_directory = false; 74fubar 75test $? -eq 0 || no_result 76 77aegis -proatt -f atts -proj foo -lib $work/lib 78test $? -eq 0 || no_result 79 80activity="new developer 80" 81aegis -newdev $USER 82test $? -eq 0 || no_result 83aegis -new-reviewer $USER 84test $? -eq 0 || no_result 85aegis -new-integrator $USER 86test $? -eq 0 || no_result 87 88activity="create branch 88" 89aegis -new-br 1 -p $AEGIS_PROJECT > LOG 2>&1 90if test $? -ne 0; then cat LOG; no_result; fi 91 92AEGIS_PROJECT=foo.1 93 94# 95# create a new change 96# 97activity="new change 97" 98cat > cattr << 'end' 99brief_description = "First change."; 100cause = internal_enhancement; 101end 102test $? -eq 0 || no_result 103aegis -new_change 1 -f cattr -project $AEGIS_PROJECT 104test $? -eq 0 || no_result 105 106activity="develop begin 106" 107aegis -dev-begin 1 -dir $work/dd 108test $? -eq 0 || no_result 109 110# 111# add a new files to the change 112# 113activity="new file 113" 114aegis -new-file $work/dd/aegis.conf 115test $? -eq 0 || no_result 116 117cat > $work/dd/aegis.conf << 'fubar' 118build_command = "exit 0"; 119diff_command = 120 "set +e;" 121 "diff -a ${quote $original} ${quote $input}" 122 " > ${quote $output};" 123 "test $? -le 1"; 124merge_command = "set +e; " 125 "merge -p -L baseline -L Historical -L C$c " 126 "${quote $mostrecent} ${quote $original} ${quote $input} " 127 "> ${quote $output}; " 128 "test $? -le 1"; 129history_get_command = "aesvt -check-out -edit ${quote $edit} " 130 "-history ${quote $history} -f ${quote $output}"; 131history_put_command = "aesvt -check-in -history ${quote $history} " 132 "-f ${quote $input}"; 133history_query_command = "aesvt -query -history ${quote $history}"; 134history_content_limitation = binary_capable; 135cache_project_file_list_for_each_delta = true; 136fubar 137test $? -eq 0 || no_result 138 139activity="new file 139" 140aegis -new-file $work/dd/fred 141test $? -eq 0 || no_result 142 143cat > $work/dd/fred <<EOF 144Hi, I'm Fred 145EOF 146test $? -eq 0 || no_result 147 148activity="new file 148" 149aegis -new-file $work/dd/barney 150test $? -eq 0 || no_result 151 152cat > $work/dd/fred <<EOF 153Hi, I'm Barney 154EOF 155test $? -eq 0 || no_result 156 157# 158# finish development of the change 159# 160activity="finish dev 160" 161aefinish 1 > LOG 2>&1 162if test $? -ne 0; then cat LOG; no_result; fi 163 164# 165# integrate the change 166# 167activity="finis int 167" 168aefinish 1 > LOG 2>&1 169if test $? -ne 0; then cat LOG; no_result; fi 170 171 172# 173# create a new branch 174# 175activity="new branch 175" 176aegis -nbr 10 -p $AEGIS_PROJECT 177test $? -eq 0 || no_result 178 179AEGIS_PROJECT=foo.1.10 180 181activity="new change 181" 182cat > cattr << 'end' 183brief_description = "First change."; 184cause = internal_enhancement; 185end 186test $? -eq 0 || no_result 187 188aegis -nc 1 -f cattr -p $AEGIS_PROJECT 189test $? -eq 0 || no_result 190 191aegis -db 1 -dir $work/dd1 192test $? -eq 0 || no_result 193 194activity="modify fred 194" 195aegis -cp 1 $work/dd1/fred 196test $? -eq 0 || no_result 197 198cat > $work/dd1/fred <<EOF 199Hi, 200I am Fred Flintstone. 201EOF 202test $? -eq 0 || no_result 203 204activity="develop end 204" 205aefinish 1 > LOG 2>&1 206if test $? -ne 0; then cat LOG; no_result; fi 207 208 209# 210# Do not integrate the change, yet. 211# 212activity="2nd change 212" 213cat > cattr << 'end' 214brief_description = "Second change."; 215cause = internal_enhancement; 216end 217test $? -eq 0 || no_result 218 219aegis -nc 2 -f cattr -p $AEGIS_PROJECT 220test $? -eq 0 || no_result 221 222aegis -db 2 -dir $work/dd 223test $? -eq 0 || no_result 224 225activity="modify barney 225" 226aegis -cp $work/dd/barney 227test $? -eq 0 || no_result 228 229cat > $work/dd/barney <<EOF 230Hi, 231I'm Barney! 232EOF 233test $? -eq 0 || no_result 234 235activity="finish the change 235" 236aefinish 2 > LOG 2>&1 237if test $? -ne 0; then cat LOG; no_result; fi 238 239activity="integrate the 2nd change 239" 240aefinish 2 > LOG 2>&1 241if test $? -ne 0; then cat LOG; exit 2; fi 242 243activity="check branch fstate 243" 244cat > ok <<EOF 245src = 246[ 247 { 248 file_name = "barney"; 249 uuid = "UUID"; 250 action = modify; 251 edit = 252 { 253 revision = "2"; 254 encoding = none; 255 uuid = "UUID"; 256 }; 257 edit_origin = 258 { 259 revision = "1"; 260 encoding = none; 261 uuid = "UUID"; 262 }; 263 usage = source; 264 file_fp = 265 { 266 youngest = TIME; 267 oldest = TIME; 268 crypto = "GUNK"; 269 }; 270 diff_file_fp = 271 { 272 youngest = TIME; 273 oldest = TIME; 274 crypto = "GUNK"; 275 }; 276 }, 277 { 278 file_name = "fred"; 279 uuid = "UUID"; 280 action = transparent; 281 edit = 282 { 283 revision = "1"; 284 encoding = none; 285 uuid = "UUID"; 286 }; 287 edit_origin = 288 { 289 revision = "1"; 290 encoding = none; 291 uuid = "UUID"; 292 }; 293 usage = source; 294 locked_by = 1; 295 about_to_be_copied_by = 1; 296 }, 297]; 298EOF 299test $? -eq 0 || no_result 300 301check_it ok $work/proj/info/change/0/001.branch/0/010.fs 302 303activity="check 2nd change pfstate 303" 304cat > ok <<EOF 305src = 306[ 307 { 308 file_name = "barney"; 309 uuid = "UUID"; 310 action = modify; 311 edit = 312 { 313 revision = "2"; 314 encoding = none; 315 uuid = "UUID"; 316 }; 317 edit_origin = 318 { 319 revision = "1"; 320 encoding = none; 321 uuid = "UUID"; 322 }; 323 usage = source; 324 file_fp = 325 { 326 youngest = TIME; 327 oldest = TIME; 328 crypto = "GUNK"; 329 }; 330 diff_file_fp = 331 { 332 youngest = TIME; 333 oldest = TIME; 334 crypto = "GUNK"; 335 }; 336 }, 337]; 338EOF 339test $? -eq 0 || no_result 340 341check_it ok $work/proj/info/change/0/001.branch/0/010.branch/0/002.pfs 342 343activity="the 3rd change 343" 344cat > cattr << 'end' 345brief_description = "Third change."; 346cause = internal_enhancement; 347end 348test $? -eq 0 || no_result 349 350aegis -nc 3 -f cattr -p $AEGIS_PROJECT 351test $? -eq 0 || no_result 352 353aegis -db 3 -dir $work/dd 354test $? -eq 0 || no_result 355 356activity="make barney transparent 356" 357aegis -mt $work/dd/barney 358test $? -eq 0 || no_result 359 360activity="finish the change 360" 361aefinish 3 > LOG 2>&1 362if test $? -ne 0; then cat LOG; no_result; fi 363 364activity="integrate the change 364" 365aefinish 3 > LOG 2>&1 366if test $? -ne 0; then cat LOG; no_result; fi 367 368activity="check branch fstate 368" 369cat > ok <<EOF 370src = 371[ 372 { 373 file_name = "barney"; 374 uuid = "UUID"; 375 action = transparent; 376 edit = 377 { 378 revision = "2"; 379 encoding = none; 380 uuid = "UUID"; 381 }; 382 edit_origin = 383 { 384 revision = "1"; 385 encoding = none; 386 uuid = "UUID"; 387 }; 388 usage = source; 389 }, 390 { 391 file_name = "fred"; 392 uuid = "UUID"; 393 action = transparent; 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 locked_by = 1; 408 about_to_be_copied_by = 1; 409 }, 410]; 411EOF 412test $? -eq 0 || no_result 413 414check_it ok $work/proj/info/change/0/001.branch/0/010.fs 415 416activity="check 3rd change pfstate 416" 417cat > ok <<EOF 418src = 419[ 420 { 421 file_name = "barney"; 422 uuid = "UUID"; 423 action = transparent; 424 edit = 425 { 426 revision = "2"; 427 encoding = none; 428 uuid = "UUID"; 429 }; 430 edit_origin = 431 { 432 revision = "1"; 433 encoding = none; 434 uuid = "UUID"; 435 }; 436 usage = source; 437 }, 438]; 439EOF 440test $? -eq 0 || no_result 441 442check_it ok $work/proj/info/change/0/001.branch/0/010.branch/0/003.pfs 443 444activity="the 4th change 444" 445cat > cattr << 'end' 446brief_description = "Fourth change."; 447cause = internal_enhancement; 448end 449test $? -eq 0 || no_result 450 451aegis -nc 4 -f cattr -p $AEGIS_PROJECT 452test $? -eq 0 || no_result 453 454aegis -db 4 -dir $work/dd 455test $? -eq 0 || no_result 456 457activity="modify barney again 457" 458aegis -cp $work/dd/barney 459test $? -eq 0 || no_result 460 461cat > $work/dd/barney <<EOF 462I'm NOT Barney. Really! 463EOF 464test $? -eq 0 || no_result 465 466activity="dev_end the change 466" 467aefinish 4 > LOG 2>&1 468if test $? -ne 0; then cat LOG; no_result; fi 469 470activity="check branch fstate file 470" 471cat > ok <<EOF 472src = 473[ 474 { 475 file_name = "barney"; 476 uuid = "UUID"; 477 action = transparent; 478 edit = 479 { 480 revision = "2"; 481 encoding = none; 482 uuid = "UUID"; 483 }; 484 edit_origin = 485 { 486 revision = "1"; 487 encoding = none; 488 uuid = "UUID"; 489 }; 490 usage = source; 491 locked_by = 4; 492 }, 493 { 494 file_name = "fred"; 495 uuid = "UUID"; 496 action = transparent; 497 edit = 498 { 499 revision = "1"; 500 encoding = none; 501 uuid = "UUID"; 502 }; 503 edit_origin = 504 { 505 revision = "1"; 506 encoding = none; 507 uuid = "UUID"; 508 }; 509 usage = source; 510 locked_by = 1; 511 about_to_be_copied_by = 1; 512 }, 513]; 514EOF 515test $? -eq 0 || no_result 516 517check_it ok $work/proj/info/change/0/001.branch/0/010.fs 518 519activity="integrate the 1st change 519" 520aefinish 1 > LOG 2>&1 521if test $? -ne 0; then cat LOG; no_result; fi 522 523activity="check branch fstate 523" 524cat > ok <<EOF 525src = 526[ 527 { 528 file_name = "barney"; 529 uuid = "UUID"; 530 action = transparent; 531 edit = 532 { 533 revision = "2"; 534 encoding = none; 535 uuid = "UUID"; 536 }; 537 edit_origin = 538 { 539 revision = "1"; 540 encoding = none; 541 uuid = "UUID"; 542 }; 543 usage = source; 544 locked_by = 4; 545 }, 546 { 547 file_name = "fred"; 548 uuid = "UUID"; 549 action = modify; 550 edit = 551 { 552 revision = "2"; 553 encoding = none; 554 uuid = "UUID"; 555 }; 556 edit_origin = 557 { 558 revision = "1"; 559 encoding = none; 560 uuid = "UUID"; 561 }; 562 usage = source; 563 file_fp = 564 { 565 youngest = TIME; 566 oldest = TIME; 567 crypto = "GUNK"; 568 }; 569 diff_file_fp = 570 { 571 youngest = TIME; 572 oldest = TIME; 573 crypto = "GUNK"; 574 }; 575 }, 576]; 577EOF 578test $? -eq 0 || no_result 579 580check_it ok $work/proj/info/change/0/001.branch/0/010.fs 581 582activity="check 1st change pfstate 582" 583cat > ok <<EOF 584src = 585[ 586 { 587 file_name = "barney"; 588 uuid = "UUID"; 589 action = transparent; 590 edit = 591 { 592 revision = "2"; 593 encoding = none; 594 uuid = "UUID"; 595 }; 596 edit_origin = 597 { 598 revision = "1"; 599 encoding = none; 600 uuid = "UUID"; 601 }; 602 usage = source; 603 }, 604 { 605 file_name = "fred"; 606 uuid = "UUID"; 607 action = modify; 608 edit = 609 { 610 revision = "2"; 611 encoding = none; 612 uuid = "UUID"; 613 }; 614 edit_origin = 615 { 616 revision = "1"; 617 encoding = none; 618 uuid = "UUID"; 619 }; 620 usage = source; 621 file_fp = 622 { 623 youngest = TIME; 624 oldest = TIME; 625 crypto = "GUNK"; 626 }; 627 diff_file_fp = 628 { 629 youngest = TIME; 630 oldest = TIME; 631 crypto = "GUNK"; 632 }; 633 }, 634]; 635EOF 636test $? -eq 0 || no_result 637 638check_it ok $work/proj/info/change/0/001.branch/0/010.branch/0/001.pfs 639 640# 641# Only definite negatives are possible. 642# The functionality exercised by this test appears to work, 643# no other guarantees are made. 644# 645pass 646