1#!/bin/sh 2# 3# aegis - project change supervisor. 4# Copyright (C) 2008 Peter Miller 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="aexml project-files-by-delta" 21 22# load up standard prelude and test functions 23. test_funcs 24 25# 26# some variables to make things earier to read 27# 28worklib=$work/lib 29workproj=$work/example.proj 30workchan=$work/example.chan 31tmp=$work/tmp 32export tmp 33 34AEGIS_PROJECT=example 35export AEGIS_PROJECT 36 37# 38# make a new project 39# 40activity="new project 40" 41aegis -newpro $AEGIS_PROJECT -version - -dir $workproj -v > log 2>&1 42if test $? -ne 0 ; then cat log; fail; fi 43 44# 45# change project attributes 46# 47activity="project attributes 47" 48cat > $tmp << 'TheEnd' 49description = "aexml testing"; 50developer_may_review = true; 51developer_may_integrate = true; 52reviewer_may_integrate = true; 53develop_end_action = goto_awaiting_integration; 54default_test_exemption = true; 55default_test_regression_exemption = true; 56TheEnd 57if test $? -ne 0 ; then no_result; fi 58 59aegis -proatt -f $tmp -proj $AEGIS_PROJECT -v > log 2>&1 60if test $? -ne 0 ; then cat log; fail; fi 61 62# 63# add staff 64# 65activity="new developer 65" 66aegis -newdev $USER -proj $AEGIS_PROJECT -v > log 2>&1 67if test $? -ne 0 ; then cat log; fail; fi 68 69activity="new integrator 69" 70aegis -newint $USER -proj $AEGIS_PROJECT -v > log 2>&1 71if test $? -ne 0 ; then cat log; fail; fi 72 73# 74# create a new change 75# 76activity="new change 76" 77cat > $tmp << 'TheEnd' 78brief_description = "first"; 79description = "The first change"; 80cause = internal_enhancement; 81TheEnd 82if test $? -ne 0 ; then no_result; fi 83 84aegis -new_change 1 -f $tmp -project $AEGIS_PROJECT -v > log 2>&1 85if test $? -ne 0 ; then cat log; fail; fi 86 87# 88# begin development of the change 89# 90activity="develop begin 90" 91aegis -devbeg -c 1 -dir $workchan -v > log 2>&1 92if test $? -ne 0 ; then cat log; no_result; fi 93 94# 95# add the new files to the change 96# 97activity="new file 97" 98aegis -new_file $workchan/aegis.conf -nl -c 1 -v > log 2>&1 99if test $? -ne 0 ; then cat log; no_result; fi 100 101# Add the config file content. 102cat > $workchan/aegis.conf << 'fubar' 103build_command = "exit 0"; 104diff_command = "exit 0"; 105merge_command = "exit 0"; 106history_get_command = "aesvt -check-out -edit ${quote $edit} " 107 "-history ${quote $history} -f ${quote $output}"; 108history_put_command = "aesvt -check-in -history ${quote $history} " 109 "-f ${quote $input}"; 110history_query_command = "aesvt -query -history ${quote $history}"; 111history_content_limitation = binary_capable; 112fubar 113if test $? -ne 0 ; then no_result; fi 114 115activity="new file 115" 116aegis -new_file $workchan/a $workchan/b $workchan/c $workchan/d -nl -c 1 -v \ 117 > log 2>&1 118if test $? -ne 0 ; then cat log; no_result; fi 119 120echo first > $workchan/a 121if test $? -ne 0 ; then no_result; fi 122 123echo first > $workchan/b 124if test $? -ne 0 ; then no_result; fi 125 126echo first > $workchan/c 127if test $? -ne 0 ; then no_result; fi 128 129echo first > $workchan/d 130if test $? -ne 0 ; then no_result; fi 131 132activity="finish development 132" 133aefinish -c 1 -v > log 2>&1 134if test $? -ne 0 ; then cat log; no_result; fi 135 136activity="integrate 136" 137aefinish -c 1 -v > log 2>&1 138if test $? -ne 0 ; then cat log; no_result; fi 139 140# -------------------------------------------------------------------------- 141 142# 143# create another new change 144# 145activity="new change 145" 146cat > $tmp << 'TheEnd' 147brief_description = "second"; 148description = "The second change set"; 149cause = internal_enhancement; 150TheEnd 151if test $? -ne 0 ; then no_result; fi 152 153aegis -new_change 2 -f $tmp -project $AEGIS_PROJECT -v > log 2>&1 154if test $? -ne 0 ; then cat log; fail; fi 155 156# 157# begin development of the change 158# 159workchan=$work/example.chan.2 160activity="develop begin 160" 161aegis -devbeg -c 2 -dir $workchan -v > log 2>&1 162if test $? -ne 0 ; then cat log; no_result; fi 163 164# 165# create a file 166# 167activity="new file 167" 168aegis -new-file -c 2 $workchan/e -v > log 2>&1 169if test $? -ne 0 ; then cat log; no_result; fi 170 171echo second > $workchan/e 172if test $? -ne 0 ; then no_result; fi 173 174# 175# modify a file 176# 177activity="copy file 177" 178aegis -copy-file -c 2 $workchan/a -v > log 2>&1 179if test $? -ne 0 ; then cat log; no_result; fi 180 181echo second > $workchan/a 182if test $? -ne 0 ; then no_result; fi 183 184# 185# remove a file 186# 187activity="remove file 187" 188aegis -remove-file -c 2 $workchan/b -v > log 2>&1 189if test $? -ne 0 ; then cat log; no_result; fi 190 191# 192# finish the change 193# 194activity="finish development 194" 195aefinish 2 -v > log 2>&1 196if test $? -ne 0 ; then cat log; no_result; fi 197 198# 199# integrate the change 200# 201activity="integrate 201" 202aefinish 2 -v > log 2>&1 203if test $? -ne 0 ; then cat log; no_result; fi 204 205# -------------------------------------------------------------------------- 206 207# 208# create another new change 209# 210activity="new change 210" 211cat > $tmp << 'TheEnd' 212brief_description = "third"; 213description = "The third change set"; 214cause = internal_enhancement; 215TheEnd 216if test $? -ne 0 ; then no_result; fi 217 218aegis -new-change 3 -f $tmp -project $AEGIS_PROJECT -v > log 2>&1 219if test $? -ne 0 ; then cat log; fail; fi 220 221# 222# begin development of the change 223# 224workchan=$work/example.chan.3 225activity="develop begin 225" 226aegis -devbeg -c 3 -dir $workchan -v > log 2>&1 227if test $? -ne 0 ; then cat log; no_result; fi 228 229# 230# create a file 231# 232activity="new file 232" 233aegis -new-file -c 3 $workchan/f -v > log 2>&1 234if test $? -ne 0 ; then cat log; no_result; fi 235 236echo third > $workchan/f 237if test $? -ne 0 ; then no_result; fi 238 239# 240# modify a file 241# 242activity="modify file 242" 243aegis -copy-file -c 3 $workchan/c -v > log 2>&1 244if test $? -ne 0 ; then cat log; no_result; fi 245 246echo third > $workchan/c 247if test $? -ne 0 ; then no_result; fi 248 249# 250# remove a file 251# 252activity="remove file 252" 253aegis -remove-file -c 3 $workchan/d -v > log 2>&1 254if test $? -ne 0 ; then cat log; no_result; fi 255 256# 257# finish the change 258# 259activity="finish development 259" 260aefinish 3 -v > log 2>&1 261if test $? -ne 0 ; then cat log; no_result; fi 262 263# 264# integrate the change 265# 266activity="integrate 266" 267aefinish 3 -v > log 2>&1 268if test $? -ne 0 ; then cat log; no_result; fi 269 270# -------------------------------------------------------------------------- 271 272# 273# run aexml project-files-by-delta to obtain historical project file lists 274# 275 276cat > ok << 'fubar' 277<fstate> 278<src> 279<fstate_src> 280<file_name>a</file_name> 281<edit> 282<revision>1</revision> 283</edit> 284</fstate_src> 285<fstate_src> 286<file_name>aegis.conf</file_name> 287<edit> 288<revision>1</revision> 289</edit> 290<usage>config</usage> 291</fstate_src> 292<fstate_src> 293<file_name>b</file_name> 294<edit> 295<revision>1</revision> 296</edit> 297</fstate_src> 298<fstate_src> 299<file_name>c</file_name> 300<edit> 301<revision>1</revision> 302</edit> 303</fstate_src> 304<fstate_src> 305<file_name>d</file_name> 306<edit> 307<revision>1</revision> 308</edit> 309</fstate_src> 310</src> 311</fstate> 312fubar 313if test $? -ne 0 ; then no_result; fi 314 315aexml project-files-by-delta -c 1 -o test.out.1 316if test $? -ne 0 ; then fail; fi 317 318sed '/uuid/d' < test.out.1 > test.out 319if test $? -ne 0 ; then no_result; fi 320 321diff ok test.out 322if test $? -ne 0 ; then fail; fi 323 324# -------------------------------------------------------------------------- 325 326# 327# run aexml project-files-by-delta to obtain historical project file lists 328# 329 330cat > ok << 'fubar' 331<fstate> 332<src> 333<fstate_src> 334<file_name>a</file_name> 335<action>modify</action> 336<edit> 337<revision>2</revision> 338</edit> 339<edit_origin> 340<revision>1</revision> 341</edit_origin> 342</fstate_src> 343<fstate_src> 344<file_name>aegis.conf</file_name> 345<edit> 346<revision>1</revision> 347</edit> 348<usage>config</usage> 349</fstate_src> 350<fstate_src> 351<file_name>b</file_name> 352<action>remove</action> 353<edit_origin> 354<revision>1</revision> 355</edit_origin> 356</fstate_src> 357<fstate_src> 358<file_name>c</file_name> 359<edit> 360<revision>1</revision> 361</edit> 362</fstate_src> 363<fstate_src> 364<file_name>d</file_name> 365<edit> 366<revision>1</revision> 367</edit> 368</fstate_src> 369<fstate_src> 370<file_name>e</file_name> 371<edit> 372<revision>1</revision> 373</edit> 374</fstate_src> 375</src> 376</fstate> 377fubar 378if test $? -ne 0 ; then no_result; fi 379 380aexml project-files-by-delta -c 2 -o test.out.1 381if test $? -ne 0 ; then fail; fi 382 383sed '/uuid/d' < test.out.1 > test.out 384if test $? -ne 0 ; then no_result; fi 385 386diff ok test.out 387if test $? -ne 0 ; then fail; fi 388 389# 390# Only definite negatives are possible. 391# The functionality exercised by this test appears to work, 392# no other guarantees are made. 393# 394pass 395