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