1#!/bin/sh
2#
3#       aegis - project change supervisor
4#       Copyright (C) 2003-2008, 2012 Peter Miller
5#       Copyright (C) 2008, 2010 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}/$$
33
34here=`pwd`
35if test $? -ne 0 ; then exit 2; fi
36
37if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi
38
39if test "$EXEC_SEARCH_PATH" != ""
40then
41    tpath=
42    hold="$IFS"
43    IFS=":$IFS"
44    for tpath2 in $EXEC_SEARCH_PATH
45    do
46        tpath=${tpath}${tpath2}/${1-.}/bin:
47    done
48    IFS="$hold"
49    PATH=${tpath}${PATH}
50else
51    PATH=${bin}:${PATH}
52fi
53export PATH
54
55check_it()
56{
57        sed     -e "s|$work|...|g" \
58                -e 's|= 0; /.*|= TIME_NOT_SET;|' \
59                -e 's|= [0-9][0-9]*; /.*|= TIME;|' \
60                -e "s/\"$USER\"/\"USER\"/g" \
61                -e 's/19[0-9][0-9]/YYYY/' \
62                -e 's/20[0-9][0-9]/YYYY/' \
63                -e 's/node = ".*"/node = "NODE"/' \
64                -e 's/crypto = ".*"/crypto = "GUNK"/' \
65                -e 's/uuid = ".*"/uuid = "UUID"/' \
66                < $2 > $work/sed.out
67        if test $? -ne 0; then no_result; fi
68        diff -b $1 $work/sed.out
69        if test $? -ne 0; then fail; fi
70}
71
72no_result()
73{
74        set +x
75        echo "NO RESULT for test of aemt functionality ($activity)" 1>&2
76        cd $here
77        find $work -type d -user $USER -exec chmod u+w {} \;
78        rm -rf $work
79        exit 2
80}
81fail()
82{
83        set +x
84        echo "FAILED test of aemt functionality ($activity)" 1>&2
85        cd $here
86        find $work -type d -user $USER -exec chmod u+w {} \;
87        rm -rf $work
88        exit 1
89}
90pass()
91{
92        set +x
93        echo PASSED 1>&2
94        cd $here
95        find $work -type d -user $USER -exec chmod u+w {} \;
96        rm -rf $work
97        exit 0
98}
99trap "no_result" 1 2 3 15
100
101#
102# some variable to make things earier to read
103#
104PAGER=cat
105export PAGER
106
107AEGIS_FLAGS="delete_file_preference = no_keep; \
108        lock_wait_preference = always; \
109        diff_preference = automatic_merge; \
110        pager_preference = never; \
111        persevere_preference = all; \
112        log_file_preference = never;"
113export AEGIS_FLAGS
114AEGIS_THROTTLE=-1
115export AEGIS_THROTTLE
116
117worklib=$work/lib
118workproj=$work/foo.proj
119workchan=$work/foo.chan
120tmp=$work/tmp
121AEGIS_PATH=$worklib ; export AEGIS_PATH
122AEGIS_PROJECT=foo ; export AEGIS_PROJECT
123
124#
125# make the directories
126#
127activity="working directory 127"
128mkdir $work $work/lib
129if test $? -ne 0 ; then no_result; fi
130chmod 777 $work/lib
131if test $? -ne 0 ; then no_result; fi
132cd $work
133if test $? -ne 0 ; then no_result; fi
134
135#
136# use the built-in error messages
137#
138AEGIS_MESSAGE_LIBRARY=$work/no-such-dir
139export AEGIS_MESSAGE_LIBRARY
140unset LANG
141unset LANGUAGE
142
143#
144# make a new project
145#
146activity="new project 146"
147$bin/aegis -npr foo -vers "" -dir $workproj > log 2>&1
148if test $? -ne 0 ; then cat log; no_result; fi
149
150#
151# change project attributes
152#
153activity="project attributes 153"
154cat > $tmp << 'end'
155description = "A bogus project created to test the aemt functionality.";
156developer_may_review = true;
157developer_may_integrate = true;
158reviewer_may_integrate = true;
159default_test_exemption = true;
160end
161if test $? -ne 0 ; then no_result; fi
162$bin/aegis -pa -f $tmp > log 2>&1
163if test $? -ne 0 ; then cat log; no_result; fi
164
165#
166# add the staff
167#
168activity="staff 168"
169$bin/aegis -nd $USER > log 2>&1
170if test $? -ne 0 ; then cat log; no_result; fi
171$bin/aegis -nrv $USER > log 2>&1
172if test $? -ne 0 ; then cat log; no_result; fi
173$bin/aegis -ni $USER > log 2>&1
174if test $? -ne 0 ; then cat log; no_result; fi
175
176# --------------------------------------------------------------------------
177
178#
179# create a new change
180#
181activity="new change 181"
182cat > $tmp << 'end'
183brief_description = "The first change";
184cause = internal_bug;
185end
186if test $? -ne 0 ; then no_result; fi
187$bin/aegis -nc 1 -f $tmp -p foo > log 2>&1
188if test $? -ne 0 ; then cat log; no_result; fi
189
190#
191# begin development of a change
192#
193$bin/aegis -db 1 -dir $workchan > log 2>&1
194if test $? -ne 0 ; then cat log; no_result; fi
195
196#
197# add a new files to the change
198#
199activity="new file 199"
200$bin/aegis -nf  $workchan/aegis.conf $workchan/bogus -nl > log 2>&1
201if test $? -ne 0 ; then cat log; no_result; fi
202
203cat > $workchan/bogus << 'end'
204the trunk version
205end
206if test $? -ne 0 ; then no_result; fi
207
208cat > $workchan/aegis.conf << 'end'
209build_command = "echo no build required";
210create_symlinks_before_build = true;
211remove_symlinks_after_build = false;
212link_integration_directory = true;
213
214history_get_command = "aesvt -check-out -edit ${quote $edit} "
215    "-history ${quote $history} -f ${quote $output}";
216history_put_command = "aesvt -check-in -history ${quote $history} "
217    "-f ${quote $input}";
218history_query_command = "aesvt -query -history ${quote $history}";
219history_content_limitation = binary_capable;
220
221diff_command = "set +e; diff $orig $i > $out; test $$? -le 1";
222diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \
223        echo '1,$$p' ) | ed - $mr > $out";
224patch_diff_command = "set +e; diff -C0 -L $index -L $index $orig $i > $out; \
225test $$? -le 1";
226end
227if test $? -ne 0 ; then no_result; fi
228
229#
230# build the change
231#
232activity="build 232"
233$bin/aegis -build -nl -v > log 2>&1
234if test $? -ne 0 ; then cat log; fail; fi
235
236#
237# difference the change
238#
239activity="diff 239"
240$bin/aegis -diff > log 2>&1
241if test $? -ne 0 ; then cat log; no_result; fi
242
243#
244# finish development of the change
245#
246activity="develop end 246"
247$bin/aegis -de > log 2>&1
248if test $? -ne 0 ; then cat log; fail; fi
249
250#
251# pass the review
252#
253activity="review pass 253"
254$bin/aegis -rpass -c 1 > log 2>&1
255if test $? -ne 0 ; then cat log; no_result; fi
256
257#
258# start integrating
259#
260activity="integrate begin 260"
261$bin/aegis -ib 1 > log 2>&1
262if test $? -ne 0 ; then cat log; no_result; fi
263
264#
265# integrate build
266#
267activity="build 267"
268$bin/aegis -b -nl -v > log 2>&1
269if test $? -ne 0 ; then cat log; no_result; fi
270
271#
272# pass the integration
273#
274activity="integrate pass 274"
275$bin/aegis -intpass -nl > log 2>&1
276if test $? -ne 0 ; then cat log; no_result; fi
277
278# --------------------------------------------------------------------------
279
280#
281# create a branch
282#
283activity="new branch 283"
284$bin/aegis -nbr -p foo 2 > log 2>&1
285if test $? -ne 0 ; then cat log; no_result; fi
286
287AEGIS_PROJECT=foo.2
288export AEGIS_PROJECT
289
290# --------------------------------------------------------------------------
291
292#
293# create a new change
294#
295activity="new change 295"
296cat > $tmp << 'end'
297brief_description = "The second change";
298cause = internal_bug;
299end
300if test $? -ne 0 ; then no_result; fi
301$bin/aegis -nc 3 -f $tmp -p foo.2 > log 2>&1
302if test $? -ne 0 ; then cat log; no_result; fi
303
304#
305# begin development of a change
306#
307$bin/aegis -db 3 -dir $workchan > log 2>&1
308if test $? -ne 0 ; then cat log; no_result; fi
309
310#
311# add files to the change
312#
313activity="copy file 313"
314$bin/aegis -cp  $workchan/bogus -nl > log 2>&1
315if test $? -ne 0 ; then cat log; no_result; fi
316
317cat > $workchan/bogus << 'end'
318the branch version
319end
320if test $? -ne 0 ; then no_result; fi
321
322#
323# build the change
324#
325activity="build 325"
326$bin/aegis -build -nl -v > log 2>&1
327if test $? -ne 0 ; then cat log; fail; fi
328
329#
330# difference the change
331#
332activity="diff 332"
333$bin/aegis -diff > log 2>&1
334if test $? -ne 0 ; then cat log; no_result; fi
335
336#
337# finish development of the change
338#
339activity="develop end 339"
340$bin/aegis -de > log 2>&1
341if test $? -ne 0 ; then cat log; fail; fi
342
343#
344# pass the review
345#
346activity="review pass 346"
347$bin/aegis -rpass -c 3 > log 2>&1
348if test $? -ne 0 ; then cat log; no_result; fi
349
350#
351# start integrating
352#
353activity="integrate begin 353"
354$bin/aegis -ib 3 > log 2>&1
355if test $? -ne 0 ; then cat log; no_result; fi
356
357#
358# integrate build
359#
360activity="build 360"
361$bin/aegis -b -nl -v > log 2>&1
362if test $? -ne 0 ; then cat log; no_result; fi
363
364#
365# integrate diff
366#
367activity="diff 367"
368$bin/aegis -diff -nl -v > log 2>&1
369if test $? -ne 0 ; then cat log; no_result; fi
370
371#
372# pass the integration
373#
374activity="integrate pass 374"
375$bin/aegis -intpass -nl > log 2>&1
376if test $? -ne 0 ; then cat log; no_result; fi
377
378# --------------------------------------------------------------------------
379
380#
381# create a new change
382#
383activity="new change 383"
384cat > $tmp << 'end'
385brief_description = "The third change";
386cause = internal_bug;
387end
388if test $? -ne 0 ; then no_result; fi
389$bin/aegis -nc 4 -f $tmp -p foo.2 > log 2>&1
390if test $? -ne 0 ; then cat log; no_result; fi
391
392#
393# begin development of a change
394#
395$bin/aegis -db 4 -dir $workchan > log 2>&1
396if test $? -ne 0 ; then cat log; no_result; fi
397
398#
399# add files to the change
400#
401activity="make transparent 401"
402$bin/aegis -mt $workchan/bogus -nl > log 2>&1
403if test $? -ne 0 ; then cat log; fail; fi
404
405activity="check file contents 405"
406cat > ok << 'end'
407the trunk version
408end
409if test $? -ne 0 ; then no_result; fi
410
411diff ok $workchan/bogus
412if test $? -ne 0 ; then fail; fi
413
414activity="check change file state 414"
415cat > ok << 'end'
416src =
417[
418        {
419                file_name = "bogus";
420                uuid = "UUID";
421                action = transparent;
422                edit_origin =
423                {
424                        revision = "2";
425                        encoding = none;
426                        uuid = "UUID";
427                };
428                usage = source;
429        },
430];
431end
432if test $? -ne 0 ; then no_result; fi
433
434check_it ok $workproj/info/change/0/002.branch/0/004.fs
435
436#
437# remove the bogus file before the build,
438# and a symlink to the correct place should be constructed
439# during the build
440#
441rm -f $workchan/bogus
442if test $? -ne 0 ; then no_result; fi
443
444#
445# build
446#
447activity="build 447"
448$bin/aegis -build -nl > log 2>&1
449if test $? -ne 0 ; then cat log; fail; fi
450
451#
452# now chek the bogus file again
453# the symlink should point to the right place.
454#
455activity="check symlinks 455"
456cat > ok << 'end'
457the trunk version
458end
459if test $? -ne 0 ; then no_result; fi
460
461diff ok $workchan/bogus
462if test $? -ne 0 ; then fail; fi
463
464activity="check change state 464"
465cat > ok << 'end'
466brief_description = "The third change";
467description = "The third change";
468cause = internal_bug;
469test_exempt = true;
470test_baseline_exempt = true;
471regression_test_exempt = true;
472architecture =
473[
474        "unspecified",
475];
476state = being_developed;
477given_test_exemption = true;
478given_regression_test_exemption = true;
479project_file_command_sync = 88;
480build_time = TIME;
481architecture_times =
482[
483        {
484                variant = "unspecified";
485                node = "NODE";
486                build_time = TIME;
487        },
488];
489development_directory = ".../foo.chan";
490history =
491[
492        {
493                when = TIME;
494                what = new_change;
495                who = "USER";
496        },
497        {
498                when = TIME;
499                what = develop_begin;
500                who = "USER";
501        },
502];
503end
504if test $? -ne 0 ; then no_result; fi
505
506check_it ok $workproj/info/change/0/002.branch/0/004
507
508#
509# diff
510#
511activity="diff 511"
512$bin/aegis -diff -nl > log 2>&1
513if test $? -ne 0 ; then cat log; fail; fi
514
515activity="check change state 515"
516cat > ok << 'end'
517brief_description = "The third change";
518description = "The third change";
519cause = internal_bug;
520test_exempt = true;
521test_baseline_exempt = true;
522regression_test_exempt = true;
523architecture =
524[
525        "unspecified",
526];
527state = being_developed;
528given_test_exemption = true;
529given_regression_test_exemption = true;
530project_file_command_sync = 88;
531build_time = TIME;
532architecture_times =
533[
534        {
535                variant = "unspecified";
536                node = "NODE";
537                build_time = TIME;
538        },
539];
540development_directory = ".../foo.chan";
541history =
542[
543        {
544                when = TIME;
545                what = new_change;
546                who = "USER";
547        },
548        {
549                when = TIME;
550                what = develop_begin;
551                who = "USER";
552        },
553];
554end
555if test $? -ne 0 ; then no_result; fi
556
557check_it ok $workproj/info/change/0/002.branch/0/004
558
559activity="check change file state 559"
560cat > ok << 'end'
561src =
562[
563        {
564                file_name = "bogus";
565                uuid = "UUID";
566                action = transparent;
567                edit_origin =
568                {
569                        revision = "2";
570                        encoding = none;
571                        uuid = "UUID";
572                };
573                usage = source;
574                file_fp =
575                {
576                        youngest = TIME;
577                        oldest = TIME;
578                        crypto = "GUNK";
579                };
580                diff_file_fp =
581                {
582                        youngest = TIME;
583                        oldest = TIME;
584                        crypto = "GUNK";
585                };
586        },
587];
588end
589if test $? -ne 0 ; then no_result; fi
590
591check_it ok $workproj/info/change/0/002.branch/0/004.fs
592
593#
594# develop end
595#
596activity="develop end 596"
597$bin/aegis -de > log 2>&1
598if test $? -ne 0 ; then cat log; fail; fi
599
600activity="check change file state 600"
601cat > ok << 'end'
602src =
603[
604        {
605                file_name = "bogus";
606                uuid = "UUID";
607                action = transparent;
608                edit_origin =
609                {
610                        revision = "2";
611                        encoding = none;
612                        uuid = "UUID";
613                };
614                usage = source;
615                file_fp =
616                {
617                        youngest = TIME;
618                        oldest = TIME;
619                        crypto = "GUNK";
620                };
621                diff_file_fp =
622                {
623                        youngest = TIME;
624                        oldest = TIME;
625                        crypto = "GUNK";
626                };
627        },
628];
629end
630if test $? -ne 0 ; then no_result; fi
631
632check_it ok $workproj/info/change/0/002.branch/0/004.fs
633
634activity="check change state 634"
635cat > ok << 'end'
636brief_description = "The third change";
637description = "The third change";
638cause = internal_bug;
639test_exempt = true;
640test_baseline_exempt = true;
641regression_test_exempt = true;
642architecture =
643[
644        "unspecified",
645];
646state = being_reviewed;
647given_test_exemption = true;
648given_regression_test_exemption = true;
649project_file_command_sync = 88;
650build_time = TIME;
651architecture_times =
652[
653        {
654                variant = "unspecified";
655                node = "NODE";
656                build_time = TIME;
657        },
658];
659development_directory = ".../foo.chan";
660history =
661[
662        {
663                when = TIME;
664                what = new_change;
665                who = "USER";
666        },
667        {
668                when = TIME;
669                what = develop_begin;
670                who = "USER";
671        },
672        {
673                when = TIME;
674                what = develop_end;
675                who = "USER";
676        },
677];
678end
679if test $? -ne 0 ; then no_result; fi
680
681check_it ok $workproj/info/change/0/002.branch/0/004
682
683activity="check branch file state 683"
684cat > ok << 'end'
685src =
686[
687        {
688                file_name = "bogus";
689                uuid = "UUID";
690                action = modify;
691                edit =
692                {
693                        revision = "2";
694                        encoding = none;
695                        uuid = "UUID";
696                };
697                edit_origin =
698                {
699                        revision = "1";
700                        encoding = none;
701                        uuid = "UUID";
702                };
703                usage = source;
704                file_fp =
705                {
706                        youngest = TIME;
707                        oldest = TIME;
708                        crypto = "GUNK";
709                };
710                diff_file_fp =
711                {
712                        youngest = TIME;
713                        oldest = TIME;
714                        crypto = "GUNK";
715                };
716                locked_by = 4;
717        },
718];
719end
720if test $? -ne 0 ; then no_result; fi
721
722check_it ok $workproj/info/change/0/002.fs
723
724#
725# review pass
726#
727activity="review pass 727"
728$bin/aegis --review-pass 4 > log 2>&1
729if test $? -ne 0 ; then cat log; fail; fi
730
731#
732# integrate begin
733#
734activity="integrate begin 734"
735$bin/aegis --integrate-begin 4 > log 2>&1
736if test $? -ne 0 ; then cat log; fail; fi
737
738#
739# build
740#
741activity="build 741"
742$bin/aegis -build -nl > log 2>&1
743if test $? -ne 0 ; then cat log; fail; fi
744
745#
746# diff
747#
748activity="diff 748"
749$bin/aegis -diff -nl > log 2>&1
750if test $? -ne 0 ; then cat log; fail; fi
751
752#
753# pass the integration
754#
755activity="integrate pass 755"
756$bin/aegis -intpass -nl > log 2>&1
757if test $? -ne 0 ; then cat log; no_result; fi
758
759activity="check change file state 759"
760cat > ok << 'end'
761src =
762[
763        {
764                file_name = "bogus";
765                uuid = "UUID";
766                action = transparent;
767                edit_origin =
768                {
769                        revision = "2";
770                        encoding = none;
771                        uuid = "UUID";
772                };
773                usage = source;
774        },
775];
776end
777if test $? -ne 0 ; then no_result; fi
778
779check_it ok $workproj/info/change/0/002.branch/0/004.fs
780
781activity="check change state 781"
782cat > ok << 'end'
783brief_description = "The third change";
784description = "The third change";
785cause = internal_bug;
786test_exempt = true;
787test_baseline_exempt = true;
788regression_test_exempt = true;
789architecture =
790[
791        "unspecified",
792];
793copyright_years =
794[
795        YYYY,
796];
797attribute =
798[
799        {
800                name = "aegis:history_get_command";
801                value = "aesvt -check-out -edit ${quote $edit} -history ${quote $history} -f ${quote $output}";
802        },
803];
804state = completed;
805given_test_exemption = true;
806given_regression_test_exemption = true;
807delta_number = 2;
808delta_uuid = "UUID";
809minimum_integration = true;
810project_file_command_sync = 88;
811history =
812[
813        {
814                when = TIME;
815                what = new_change;
816                who = "USER";
817        },
818        {
819                when = TIME;
820                what = develop_begin;
821                who = "USER";
822        },
823        {
824                when = TIME;
825                what = develop_end;
826                who = "USER";
827        },
828        {
829                when = TIME;
830                what = review_pass;
831                who = "USER";
832        },
833        {
834                when = TIME;
835                what = integrate_begin;
836                who = "USER";
837        },
838        {
839                when = TIME;
840                what = integrate_pass;
841                who = "USER";
842        },
843];
844uuid = "UUID";
845end
846if test $? -ne 0 ; then no_result; fi
847
848check_it ok $workproj/info/change/0/002.branch/0/004
849
850activity="check branch file state 850"
851cat > ok << 'end'
852src =
853[
854        {
855                file_name = "bogus";
856                uuid = "UUID";
857                action = transparent;
858                edit =
859                {
860                        revision = "2";
861                        encoding = none;
862                        uuid = "UUID";
863                };
864                edit_origin =
865                {
866                        revision = "1";
867                        encoding = none;
868                        uuid = "UUID";
869                };
870                usage = source;
871        },
872];
873end
874if test $? -ne 0 ; then no_result; fi
875
876check_it ok $workproj/info/change/0/002.fs
877
878# ==========================================================================
879#
880# Now the tricky part: ending the branch.
881#
882AEGIS_PROJECT=foo
883export AEGIS_PROJECT
884
885#
886# develop end
887#
888activity="develop end 888"
889$bin/aegis -de 2 > log 2>&1
890if test $? -ne 0 ; then cat log; fail; fi
891
892activity="check change file state 892"
893cat > ok << 'end'
894src =
895[
896        {
897                file_name = "bogus";
898                uuid = "UUID";
899                action = transparent;
900                edit =
901                {
902                        revision = "2";
903                        encoding = none;
904                        uuid = "UUID";
905                };
906                edit_origin =
907                {
908                        revision = "1";
909                        encoding = none;
910                        uuid = "UUID";
911                };
912                usage = source;
913        },
914];
915end
916if test $? -ne 0 ; then no_result; fi
917
918check_it ok $workproj/info/change/0/002.fs
919
920activity="check change state 920"
921cat > ok << 'end'
922brief_description = "A bogus project created to test the aemt functionality, branch 2.";
923description = "A bogus project created to test the aemt functionality, branch 2.";
924cause = internal_enhancement;
925test_exempt = true;
926test_baseline_exempt = true;
927regression_test_exempt = true;
928architecture =
929[
930        "unspecified",
931];
932copyright_years =
933[
934        YYYY,
935];
936state = being_reviewed;
937build_time = TIME;
938architecture_times =
939[
940        {
941                variant = "unspecified";
942                node = "NODE";
943                build_time = TIME;
944        },
945];
946development_directory = "branch.2";
947history =
948[
949        {
950                when = TIME;
951                what = new_change;
952                who = "USER";
953        },
954        {
955                when = TIME;
956                what = develop_begin;
957                who = "USER";
958        },
959        {
960                when = TIME;
961                what = develop_end;
962                who = "USER";
963        },
964];
965branch =
966{
967        umask = 022;
968        developer_may_review = true;
969        developer_may_integrate = true;
970        reviewer_may_integrate = true;
971        developers_may_create_changes = false;
972        default_test_exemption = true;
973        default_test_regression_exemption = true;
974        skip_unlucky = false;
975        compress_database = false;
976        develop_end_action = goto_being_reviewed;
977        history =
978        [
979                {
980                        delta_number = 1;
981                        change_number = 3;
982                        uuid = "UUID";
983                        when = TIME;
984                        is_a_branch = no;
985                },
986                {
987                        delta_number = 2;
988                        change_number = 4;
989                        uuid = "UUID";
990                        when = TIME;
991                        is_a_branch = no;
992                },
993        ];
994        change =
995        [
996                3,
997                4,
998        ];
999        administrator =
1000        [
1001                "USER",
1002        ];
1003        developer =
1004        [
1005                "USER",
1006        ];
1007        reviewer =
1008        [
1009                "USER",
1010        ];
1011        integrator =
1012        [
1013                "USER",
1014        ];
1015        minimum_change_number = 10;
1016        reuse_change_numbers = true;
1017        minimum_branch_number = 1;
1018        protect_development_directory = false;
1019};
1020end
1021if test $? -ne 0 ; then no_result; fi
1022
1023check_it ok $workproj/info/change/0/002
1024
1025# The transparent file should NOT be locked
1026# when its coming from a branch that it was transparent in.
1027activity="check trunk file state 1027"
1028cat > ok << 'end'
1029src =
1030[
1031        {
1032                file_name = "aegis.conf";
1033                uuid = "UUID";
1034                action = create;
1035                edit =
1036                {
1037                        revision = "1";
1038                        encoding = none;
1039                        uuid = "UUID";
1040                };
1041                edit_origin =
1042                {
1043                        revision = "1";
1044                        encoding = none;
1045                        uuid = "UUID";
1046                };
1047                usage = config;
1048                file_fp =
1049                {
1050                        youngest = TIME;
1051                        oldest = TIME;
1052                        crypto = "GUNK";
1053                };
1054        },
1055        {
1056                file_name = "bogus";
1057                uuid = "UUID";
1058                action = create;
1059                edit =
1060                {
1061                        revision = "1";
1062                        encoding = none;
1063                        uuid = "UUID";
1064                };
1065                edit_origin =
1066                {
1067                        revision = "1";
1068                        encoding = none;
1069                        uuid = "UUID";
1070                };
1071                usage = source;
1072                file_fp =
1073                {
1074                        youngest = TIME;
1075                        oldest = TIME;
1076                        crypto = "GUNK";
1077                };
1078        },
1079];
1080end
1081if test $? -ne 0 ; then no_result; fi
1082
1083check_it ok $workproj/info/trunk.fs
1084
1085#
1086# review pass
1087#
1088activity="review pass 1088"
1089$bin/aegis --review-pass 2 > log 2>&1
1090if test $? -ne 0 ; then cat log; fail; fi
1091
1092#
1093# integrate begin
1094#
1095activity="integrate begin 1095"
1096$bin/aegis --integrate-begin 2 > log 2>&1
1097if test $? -ne 0 ; then cat log; fail; fi
1098
1099#
1100# build
1101#
1102activity="build 1102"
1103$bin/aegis -build -nl > log 2>&1
1104if test $? -ne 0 ; then cat log; fail; fi
1105
1106#
1107# pass the integration
1108#
1109activity="integrate pass 1109"
1110$bin/aegis -intpass -nl 2 > log 2>&1
1111if test $? -ne 0 ; then cat log; no_result; fi
1112
1113activity="check change file state 1113"
1114cat > ok << 'end'
1115src =
1116[
1117        {
1118                file_name = "bogus";
1119                uuid = "UUID";
1120                action = transparent;
1121                edit =
1122                {
1123                        revision = "2";
1124                        encoding = none;
1125                        uuid = "UUID";
1126                };
1127                edit_origin =
1128                {
1129                        revision = "1";
1130                        encoding = none;
1131                        uuid = "UUID";
1132                };
1133                usage = source;
1134        },
1135];
1136end
1137if test $? -ne 0 ; then no_result; fi
1138
1139check_it ok $workproj/info/change/0/002.fs
1140
1141activity="check change state 1141"
1142cat > ok << 'end'
1143brief_description = "A bogus project created to test the aemt functionality, branch 2.";
1144description = "A bogus project created to test the aemt functionality, branch 2.";
1145cause = internal_enhancement;
1146test_exempt = true;
1147test_baseline_exempt = true;
1148regression_test_exempt = true;
1149architecture =
1150[
1151        "unspecified",
1152];
1153copyright_years =
1154[
1155        YYYY,
1156];
1157attribute =
1158[
1159        {
1160                name = "aegis:history_get_command";
1161                value = "aesvt -check-out -edit ${quote $edit} -history ${quote $history} -f ${quote $output}";
1162        },
1163];
1164state = completed;
1165delta_number = 2;
1166delta_uuid = "UUID";
1167minimum_integration = true;
1168history =
1169[
1170        {
1171                when = TIME;
1172                what = new_change;
1173                who = "USER";
1174        },
1175        {
1176                when = TIME;
1177                what = develop_begin;
1178                who = "USER";
1179        },
1180        {
1181                when = TIME;
1182                what = develop_end;
1183                who = "USER";
1184        },
1185        {
1186                when = TIME;
1187                what = review_pass;
1188                who = "USER";
1189        },
1190        {
1191                when = TIME;
1192                what = integrate_begin;
1193                who = "USER";
1194        },
1195        {
1196                when = TIME;
1197                what = integrate_pass;
1198                who = "USER";
1199        },
1200];
1201uuid = "UUID";
1202branch =
1203{
1204        umask = 022;
1205        developer_may_review = true;
1206        developer_may_integrate = true;
1207        reviewer_may_integrate = true;
1208        developers_may_create_changes = false;
1209        default_test_exemption = true;
1210        default_test_regression_exemption = true;
1211        skip_unlucky = false;
1212        compress_database = false;
1213        develop_end_action = goto_being_reviewed;
1214        history =
1215        [
1216                {
1217                        delta_number = 1;
1218                        change_number = 3;
1219                        uuid = "UUID";
1220                        when = TIME;
1221                        is_a_branch = no;
1222                },
1223                {
1224                        delta_number = 2;
1225                        change_number = 4;
1226                        uuid = "UUID";
1227                        when = TIME;
1228                        is_a_branch = no;
1229                },
1230        ];
1231        change =
1232        [
1233                3,
1234                4,
1235        ];
1236        administrator =
1237        [
1238                "USER",
1239        ];
1240        developer =
1241        [
1242                "USER",
1243        ];
1244        reviewer =
1245        [
1246                "USER",
1247        ];
1248        integrator =
1249        [
1250                "USER",
1251        ];
1252        minimum_change_number = 10;
1253        reuse_change_numbers = true;
1254        minimum_branch_number = 1;
1255        protect_development_directory = false;
1256};
1257end
1258if test $? -ne 0 ; then no_result; fi
1259
1260check_it ok $workproj/info/change/0/002
1261
1262activity="check trunk file state 1262"
1263cat > ok << 'end'
1264src =
1265[
1266        {
1267                file_name = "aegis.conf";
1268                uuid = "UUID";
1269                action = create;
1270                edit =
1271                {
1272                        revision = "1";
1273                        encoding = none;
1274                        uuid = "UUID";
1275                };
1276                edit_origin =
1277                {
1278                        revision = "1";
1279                        encoding = none;
1280                        uuid = "UUID";
1281                };
1282                usage = config;
1283                file_fp =
1284                {
1285                        youngest = TIME;
1286                        oldest = TIME;
1287                        crypto = "GUNK";
1288                };
1289        },
1290        {
1291                file_name = "bogus";
1292                uuid = "UUID";
1293                action = create;
1294                edit =
1295                {
1296                        revision = "1";
1297                        encoding = none;
1298                        uuid = "UUID";
1299                };
1300                edit_origin =
1301                {
1302                        revision = "1";
1303                        encoding = none;
1304                        uuid = "UUID";
1305                };
1306                usage = source;
1307        },
1308];
1309end
1310if test $? -ne 0 ; then no_result; fi
1311
1312check_it ok $workproj/info/trunk.fs
1313
1314#
1315# the things tested in this test, worked
1316# can't speak for the rest of the code
1317#
1318pass
1319# vim: set ts=8 sw=4 et :
1320