1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 2004, 2010 Walter Franzini 5# Copyright (C) 2007, 2008, 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 18# along with this program. If not, see <http://www.gnu.org/licenses/>. 19# 20 21TEST_SUBJECT="aed" 22 23# load up standard prelude and test functions 24. test_funcs 25 26workproj=$work/proj 27workchan=$work/chan 28tmp=${work}/tmp 29 30AEGIS_PROJECT=foo 31export AEGIS_PROJECT 32 33# 34# make a new project 35# 36activity="new project 36" 37aegis -npr ${AEGIS_PROJECT} -vers "" -dir $workproj > log 2>&1 38if test $? -ne 0 ; then cat log; no_result; fi 39 40# 41# change project attributes 42# 43activity="project attributes 43" 44cat > $tmp << 'end' 45description = "A bogus project created to test the aepatch -send functionality."; 46developer_may_review = true; 47developer_may_integrate = true; 48reviewer_may_integrate = true; 49end 50if test $? -ne 0 ; then no_result; fi 51aegis -pa -f $tmp > log 2>&1 52if test $? -ne 0 ; then cat log; no_result; fi 53 54# 55# create a new change 56# 57activity="new change 57" 58cat > $tmp << 'end' 59brief_description = "The first change"; 60cause = internal_bug; 61end 62if test $? -ne 0 ; then no_result; fi 63aegis -nc 1 -f $tmp -p ${AEGIS_PROJECT} > log 2>&1 64if test $? -ne 0 ; then cat log; no_result; fi 65 66# 67# add the staff 68# 69activity="staff 69" 70aegis -nd $USER > log 2>&1 71if test $? -ne 0 ; then cat log; no_result; fi 72aegis -nrv $USER > log 2>&1 73if test $? -ne 0 ; then cat log; no_result; fi 74aegis -ni $USER > log 2>&1 75if test $? -ne 0 ; then cat log; no_result; fi 76 77# 78# begin development of a change 79# 80aegis -db 1 -dir $workchan > log 2>&1 81if test $? -ne 0 ; then cat log; no_result; fi 82 83# 84# add a new files to the change 85# 86activity="new file 86" 87aegis -c 1 -nf $workchan/main.c $workchan/test.c $workchan/Makefile \ 88 $workchan/aegis.conf -nl > log 2>&1 89if test $? -ne 0 ; then cat log; no_result; fi 90cat > $workchan/main.c << 'end' 91int 92main(argc, argv) 93 int argc; 94 char **argv; 95{ 96 test(); 97 exit(0); 98 return 0; 99} 100end 101if test $? -ne 0 ; then no_result; fi 102cat > $workchan/test.c << 'end' 103void test() { } 104end 105if test $? -ne 0 ; then no_result; fi 106 107TAB=`awk 'BEGIN{printf("%c", 9)}' /dev/null` 108sed "s/{TAB}/${TAB}/g" > $workchan/Makefile << 'end' 109.c.o: 110{TAB}date > $@ 111 112foo: main.o test.o 113{TAB}date > $@ 114end 115if test $? -ne 0 ; then no_result; fi 116cat > $workchan/aegis.conf << 'end' 117build_command = "make -f \\${source Makefile}"; 118create_symlinks_before_build = true; 119link_integration_directory = true; 120 121history_get_command = "aesvt -check-out -edit ${quote $edit} " 122 "-history ${quote $history} -f ${quote $output}"; 123history_put_command = "aesvt -check-in -history ${quote $history} " 124 "-f ${quote $input}"; 125history_query_command = "aesvt -query -history ${quote $history}"; 126history_content_limitation = binary_capable; 127 128diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 129diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 130 echo '1,$$p' ) | ed - $mr > $out"; 131 132end 133if test $? -ne 0 ; then no_result; fi 134 135# 136# create a new test 137# 138activity="new test 138" 139aegis -c 1 -nt > log 2>&1 140if test $? -ne 0 ; then cat log; no_result; fi 141cat > $workchan/test/00/t0001a.sh << 'end' 142#!/bin/sh 143exit 0 144end 145if test $? -ne 0 ; then no_result; fi 146 147# 148# build the change 149# 150activity="build 150" 151aegis -c 1 -build -nl -v > log 2>&1 152if test $? -ne 0 ; then cat log; no_result; fi 153 154# 155# difference the change 156# 157activity="diff 157" 158aegis -diff -c 1 > log 2>&1 159if test $? -ne 0 ; then cat log; no_result; fi 160 161# 162# test the change 163# 164activity="test 164" 165aegis -t -c 1 -v > log 2>&1 166if test $? -ne 0 ; then cat log; no_result; fi 167 168# 169# finish development of the 1st change 170# 171activity="develop end 171" 172aegis -de -c 1 > log 2>&1 173if test $? -ne 0 ; then cat log; no_result; fi 174 175# 176# pass the review of the 1st change 177# 178activity="review pass 178" 179aegis -rpass -c 1 > log 2>&1 180if test $? -ne 0 ; then cat log; no_result; fi 181 182# 183# start integrating 184# 185activity="integrate begin 185" 186aegis -ib 1 > log 2>&1 187if test $? -ne 0 ; then cat log; no_result; fi 188 189# 190# integrate build 191# 192activity="build 192" 193aegis -b -c 1 -nl -v > log 2>&1 194if test $? -ne 0 ; then cat log; no_result; fi 195 196# 197# integrate test 198# 199activity="test 199" 200aegis -t -c 1 -nl -v > log 2>&1 201if test $? -ne 0 ; then cat log; no_result; fi 202 203# 204# pass the integration 205# 206activity="integrate pass 206" 207aegis -intpass -c 1 -nl -v > log 2>&1 208if test $? -ne 0 ; then cat log; no_result; fi 209 210# 211# create the second change 212# 213activity="new change 213" 214cat > $tmp << 'end' 215brief_description = "The second change"; 216cause = internal_bug; 217test_exempt = true; 218test_baseline_exempt = true; 219regression_test_exempt = true; 220end 221if test $? -ne 0 ; then no_result; fi 222aegis -nc 2 -f $tmp -p ${AEGIS_PROJECT} > log 2>&1 223if test $? -ne 0 ; then cat log; no_result; fi 224 225# 226# begin development of a change 227# 228aegis -db 2 -dir $workchan.2 > log 2>&1 229if test $? -ne 0 ; then cat log; no_result; fi 230 231# 232# add a new files to the change 233# 234 235activity="new file 235" 236aegis -c 2 -nf $workchan.2/dummy.c -nl > log 2>&1 237if test $? -ne 0 ; then cat log; no_result; fi 238cat > $workchan.2/dummy.c << 'end' 239int 240dummy (argc, argv) 241 int argc; 242 char **argv; 243{ 244 test(); 245 exit(0); 246 return 0; 247} 248end 249if test $? -ne 0 ; then no_result; fi 250 251# 252# new build file to 2nd change 253# 254activity="new build file 254" 255aegis -c 2 -nf -build $workchan.2/foo 256if test $? -ne 0 ; then cat log; no_result; fi 257 258# 259# build the 2nd change 260# 261activity="build 261" 262aegis -c 2 -build -nl -v > log 2>&1 263if test $? -ne 0 ; then cat log; no_result; fi 264 265# 266# difference the change 267# 268activity="diff 268" 269aegis -diff -c 2 > log 2>&1 270if test $? -ne 0 ; then cat log; no_result; fi 271 272# 273# 3rd change 274# 275activity="new change 275" 276cat > $tmp << 'end' 277brief_description = "The second change"; 278cause = internal_bug; 279test_exempt = true; 280test_baseline_exempt = true; 281regression_test_exempt = true; 282end 283if test $? -ne 0 ; then no_result; fi 284aegis -nc 3 -f $tmp -p ${AEGIS_PROJECT} > log 2>&1 285if test $? -ne 0 ; then cat log; no_result; fi 286 287# 288# begin development of the 3rd change 289# 290aegis -db 3 -dir $workchan.3 > log 2>&1 291if test $? -ne 0 ; then cat log; no_result; fi 292 293# 294# new build file to 3rd change 295# 296activity="new build file 296" 297aegis -c 3 -nf -build $workchan.3/foo 298if test $? -ne 0 ; then cat log; no_result; fi 299 300# 301# build the 3nd change 302# 303activity="build 303" 304aegis -c 3 -build -nl -v > log 2>&1 305if test $? -ne 0 ; then cat log; no_result; fi 306 307# 308# finish development of the 2nd change 309# 310activity="develop end 310" 311aegis -de -c 2 > log 2>&1 312if test $? -ne 0 ; then cat log; no_result ; fi 313 314activity="review pass 2nd 314" 315aegis -rpass -c 2 > log 2>&1 316if test $? -ne 0 ; then cat log ; no_result; fi 317 318activity="integrate begin 2nd 318" 319aegis -ib -c 2 > log 2>&1 320if test $? -ne 0 ; then cat log ; no_result; fi 321 322activity="integrate build 2nd 322" 323aegis -b -c 2 -nl -v > log 2>&1 324if test $? -ne 0 ; then cat log ; no_result ; fi 325 326activity="integrate diff 2nd 326" 327aegis -diff -c 2 -nl -v > log 2>&1 328if test $? -ne 0 ; then cat log ; no_result ; fi 329 330activity="integrate pass 2nd 330" 331aegis -ipass -c 2 > log 2>&1 332if test $? -ne 0 ; then cat log ; no_result ; fi 333 334# 335# go ahead with the 3rd change 336# 337 338activity="diff 3rd change 338" 339aegis -diff -c 3 -nl -v > log 2>&1 340if test $? -ne 0 ; then cat log ; no_result ; fi 341 342activity="develop end 3rd 342" 343aegis -de -c 3 > log 2>&1 344if test $? -ne 0 ; then cat log ; fail ; fi 345 346# 347# Only definite negatives are possible. 348# The functionality exercised by this test appears to work, 349# no other guarantees are made. 350# 351pass 352# vim: set ts=8 sw=4 et : 353