1#!/bin/sh 2# 3# aegis - The "aegis" program. 4# Copyright (C) 2008 Walter Franzini 5# Copyright (C) 2012 Peter Miller 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 (at 10# 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 GNU 15# General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with this program. If not, see <http://www.gnu.org/licenses/>. 19# 20 21TEST_SUBJECT="aedist -send vs. aemv" 22 23# load up standard prelude and test functions 24. test_funcs 25 26check_it() 27{ 28 sed -e "s|$work|...|g" \ 29 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 30 -e "s/\"$USER\"/\"USER\"/g" \ 31 -e 's/uuid = ".*"/uuid = "UUID"/' \ 32 -e 's/19[0-9][0-9]/YYYY/' \ 33 -e 's/20[0-9][0-9]/YYYY/' \ 34 -e 's/node = ".*"/node = "NODE"/' \ 35 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 36 < $2 > $work/sed.out 37 if test $? -ne 0; then no_result; fi 38 diff -b $1 $work/sed.out 39 if test $? -ne 0; then fail; fi 40} 41 42# 43# test the aedist/aemv functionality 44# 45workproj=$work/proj 46workchan=$work/chan 47 48AEGIS_PROJECT=example ; export AEGIS_PROJECT 49 50# 51# make a new project 52# 53activity="new project 52" 54aegis -npr $AEGIS_PROJECT -vers "" -dir $workproj > log 2>&1 55if test $? -ne 0 ; then cat log; no_result; fi 56 57# 58# change project attributes 59# 60activity="project attributes 59" 61cat > tmp << 'end' 62description = "A bogus project created to test the aedist/aemv " 63 "functionality."; 64developer_may_review = true; 65developer_may_integrate = true; 66reviewer_may_integrate = true; 67default_test_exemption = true; 68develop_end_action = goto_awaiting_integration; 69end 70if test $? -ne 0 ; then no_result; fi 71aegis -pa -f tmp > log 2>&1 72if test $? -ne 0 ; then cat log; no_result; fi 73 74# 75# add the staff 76# 77activity="staff 76" 78aegis -nd $USER > log 2>&1 79if test $? -ne 0 ; then cat log; no_result; fi 80aegis -nrv $USER > log 2>&1 81if test $? -ne 0 ; then cat log; no_result; fi 82aegis -ni $USER > log 2>&1 83if test $? -ne 0 ; then cat log; no_result; fi 84 85# 86# create a new change 87# 88activity="new change 87" 89cat > tmp << 'end' 90brief_description = "The first change"; 91cause = internal_bug; 92end 93if test $? -ne 0 ; then no_result; fi 94aegis -nc 1 -f tmp -p $AEGIS_PROJECT > log 2>&1 95if test $? -ne 0 ; then cat log; no_result; fi 96 97# 98# begin development of a change 99# 100aegis -db 1 -dir $workchan > log 2>&1 101if test $? -ne 0 ; then cat log; no_result; fi 102 103# 104# add a new files to the change 105# 106activity="new files 105" 107aegis -nf $workchan/bogus1 -nl \ 108 --uuid aaaaaaaa-bbbb-4bbb-8ccc-ccccddddddd1 > log 2>&1 109if test $? -ne 0 ; then cat log; no_result; fi 110aegis -nf $workchan/aegis.conf -nl \ 111 --uuid aaaaaaaa-bbbb-4bbb-8ccc-ccccddddddd3 > log 2>&1 112if test $? -ne 0 ; then cat log; no_result; fi 113 114cat > $workchan/bogus1 << 'end' 115OLD CONTENT 116bogus1, line 1 117bogus1, line 2 118end 119if test $? -ne 0 ; then no_result; fi 120 121# 122# Save the content of bogus1 for future use 123# 124cp $workchan/bogus1 $work/bogus2 125if test $? -ne 0 ; then no_result; fi 126 127cat > $workchan/aegis.conf << 'end' 128build_command = "exit 0"; 129link_integration_directory = true; 130 131history_get_command = "aesvt -check-out -edit ${quote $edit} " 132 "-history ${quote $history} -f ${quote $output}"; 133history_put_command = "aesvt -check-in -history ${quote $history} " 134 "-f ${quote $input}"; 135history_query_command = "aesvt -query -history ${quote $history}"; 136history_content_limitation = binary_capable; 137 138diff_command = "set +e; $diff $orig $i > $out; test $$? -le 1"; 139merge_command = "(diff3 -e $i $orig $mr | sed -e '/^w$$/d' -e '/^q$$/d'; \ 140 echo '1,$$p' ) | ed - $i > $out"; 141patch_diff_command = "set +e; $diff -C0 -L $index -L $index $orig $i > $out; \ 142test $$? -le 1"; 143end 144if test $? -ne 0 ; then no_result; fi 145 146# 147# build the change 148# 149activity="finish the change 148" 150aefinish -v > log 2>&1 151if test $? -ne 0 ; then cat log; no_result; fi 152 153# 154# start integrating 155# 156activity="integrate begin 155" 157aegis -ib 1 > log 2>&1 158if test $? -ne 0 ; then cat log; no_result; fi 159 160# 161# finish integration 162# 163activity="integrate the change 162" 164aefinish -c 1 > log 2>&1 165if test $? -ne 0 ; then cat log; no_result; fi 166 167activity="send c1 166" 168aedist -send -c 1 -o $work/c1.ae -v > log 2>&1 169if test $? -ne 0 ; then cat log; no_result; fi 170 171# 172# Alter the project to simulate the integration with an older 173# (pre-UUID) Aegis version 174# 175cat > clean_uuid.sed <<EOF 176/uuid = "aaaaaaaa-bbbb-4bbb-8ccc-ccccddddddd1";/d 177EOF 178if test $? -ne 0 ; then no_result; fi 179 180activity="uuid reset 001.fs 179" 181sed -f clean_uuid.sed < $work/proj/info/change/0/001.fs \ 182 > $work/proj/info/change/0/001.fs.new 183if test $? -ne 0 ; then no_result; fi 184 185mv $work/proj/info/change/0/001.fs.new $work/proj/info/change/0/001.fs 186if test $? -ne 0 ; then no_result; fi 187 188activity="uuid reset 001.pfs 187" 189sed -f clean_uuid.sed < $work/proj/info/change/0/001.pfs \ 190 > $work/proj/info/change/0/001.pfs.new 191if test $? -ne 0 ; then no_result; fi 192 193mv $work/proj/info/change/0/001.pfs.new $work/proj/info/change/0/001.pfs 194if test $? -ne 0 ; then no_result; fi 195 196activity="UUID reset trunk.fs 195" 197sed -f clean_uuid.sed < $work/proj/info/trunk.fs \ 198 > $work/proj/info/trunk.fs.new 199if test $? -ne 0 ; then no_result; fi 200 201mv $work/proj/info/trunk.fs.new $work/proj/info/trunk.fs 202if test $? -ne 0 ; then no_result; fi 203 204# 205# create a new change 206# 207activity="new change 206" 208cat > tmp << 'end' 209brief_description = "The second change"; 210cause = internal_bug; 211end 212if test $? -ne 0 ; then no_result; fi 213aegis -nc 2 -f tmp -p $AEGIS_PROJECT > log 2>&1 214if test $? -ne 0 ; then cat log; no_result; fi 215 216# 217# begin development of a change 218# 219activity="develop begin 218" 220aegis -db 2 -dir $workchan > log 2>&1 221if test $? -ne 0 ; then cat log; no_result; fi 222 223# 224# Use the second change to move bogus1 to bogus2 225# 226activity="move files 225" 227aegis -c 2 -mv -baserel bogus1 bogus2 > log 2>&1 228if test $? -ne 0 ; then cat log; no_result; fi 229 230# 231# Modify bogus2 232# 233activity="modify bogus2 232" 234cat > $workchan/bogus2 <<EOF 235NEW CONTENT 236this file is now named bogus2 237EOF 238if test $? -ne 0 ; then no_result; fi 239 240# 241# develop_end the change 242# 243activity="aefinish 242" 244aefinish > log 2>&1 245if test $? -ne 0 ; then cat log; no_result; fi 246 247acctivity="integrate begin" 248aegis -ibegin 2 -verb > log 2>&1 249if test $? -ne 0 ; then cat log; no_result; fi 250 251activity="integrate the change 250" 252aefinish -c 2 > log 2>&1 253if test $? -ne 0 ; then cat log; no_result; fi 254 255activity="check 002.fs 254" 256cat > ok <<EOF 257src = 258[ 259 { 260 file_name = "bogus1"; 261 action = remove; 262 edit_origin = 263 { 264 revision = "1"; 265 encoding = none; 266 uuid = "UUID"; 267 }; 268 usage = source; 269 move = "bogus2"; 270 }, 271 { 272 file_name = "bogus2"; 273 uuid = "UUID"; 274 action = create; 275 edit = 276 { 277 revision = "1"; 278 encoding = none; 279 uuid = "UUID"; 280 }; 281 usage = source; 282 move = "bogus1"; 283 }, 284]; 285EOF 286if test $? -ne 0 ; then no_result; fi 287 288check_it ok $work/proj/info/change/0/002.fs 289 290activity="send the completed change 287" 291aedist -send -c 2 -ndh -nmh -out $work/c02.ae > log 2>&1 292if test $? -ne 0 ; then cat log ; no_result; fi 293 294# 295# make a new project 296# 297AEGIS_PROJECT=foo 298export AEGIS_PROJECT 299 300workproj=$work/foo.proj 301 302activity="new project 299" 303aegis -npr $AEGIS_PROJECT -vers "" -dir $workproj > log 2>&1 304if test $? -ne 0 ; then cat log; no_result; fi 305 306# 307# change project attributes 308# 309activity="project attributes 306" 310cat > tmp << 'end' 311description = "A bogus project created to test the aedist/aemv " 312 "functionality."; 313developer_may_review = true; 314developer_may_integrate = true; 315reviewer_may_integrate = true; 316default_test_exemption = true; 317develop_end_action = goto_awaiting_integration; 318end 319if test $? -ne 0 ; then no_result; fi 320aegis -pa -f tmp > log 2>&1 321if test $? -ne 0 ; then cat log; no_result; fi 322 323# 324# add the staff 325# 326activity="staff 323" 327aegis -nd $USER > log 2>&1 328if test $? -ne 0 ; then cat log; no_result; fi 329aegis -nrv $USER > log 2>&1 330if test $? -ne 0 ; then cat log; no_result; fi 331aegis -ni $USER > log 2>&1 332if test $? -ne 0 ; then cat log; no_result; fi 333 334activity="receive c1 331" 335aedist -rec -p $AEGIS_PROJECT -f $work/c1.ae -no_trojan -v > log 2>&1 336if test $? -ne 0 ; then cat log; no_result; fi 337 338activity="integrate the change 335" 339aegis -ib -c 1 -v > log 2>&1 340if test $? -ne 0 ; then cat log; no_result; fi 341 342activity="finish the change 339" 343aefinish 1 -v > log 2>&1 344if test $? -ne 0 ; then cat log; no_result; fi 345 346activity="receive c2 343" 347aedist -rec -p $AEGIS_PROJECT -f $work/c02.ae -c 2 \ 348 -dir $workchan -v > log 2>&1 349if test $? -ne 0 ; then cat log; no_result; fi 350 351cat > ok <<EOF 352NEW CONTENT 353this file is now named bogus2 354EOF 355if test $? -ne 0 ; then cat log; no_result; fi 356 357cmp $workchan/bogus2 ok 358if test $? -ne 0 ; then fail; fi 359 360# 361# Only definite negatives are possible. 362# The functionality exercised by this test appears to work, 363# no other guarantees are made. 364# 365pass 366# vim: set ts=8 sw=4 et : 367