1#!/bin/sh
2#
3# aegis - The "aegis" program.
4# Copyright (C) 2010 Walter Franzini
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="aenf --no-uuid"
21
22# load up standard prelude and test functions
23. test_funcs
24
25check_it()
26{
27	sed	-e "s|$work|...|g" \
28		-e 's|= [0-9][0-9]*; /.*|= TIME;|' \
29		-e "s/\"$USER\"/\"USER\"/g" \
30		-e 's/uuid = ".*"/uuid = "UUID"/' \
31		-e 's/19[0-9][0-9]/YYYY/' \
32		-e 's/20[0-9][0-9]/YYYY/' \
33		-e 's/node = ".*"/node = "NODE"/' \
34		-e 's/crypto = ".*"/crypto = "GUNK"/' \
35		< $2 > $work/sed.out
36	if test $? -ne 0; then no_result; fi
37	diff $1 $work/sed.out
38	if test $? -ne 0; then fail; fi
39}
40
41#
42# make a new project
43#
44activity="new project 44"
45aegis -newpro foo -version "" -dir $work/proj -lib $work/lib
46if test $? -ne 0 ; then fail; fi
47
48AEGIS_PROJECT=foo
49export AEGIS_PROJECT
50
51#
52# change project attributes
53#
54activity="project attributes 54"
55cat > atts << 'fubar'
56description = "The \"foo\" program.";
57developer_may_review = true;
58developer_may_integrate = true;
59reviewer_may_integrate = true;
60developers_may_create_changes = true;
61umask = 022;
62default_test_exemption = true;
63default_test_regression_exemption = true;
64minimum_change_number = 10;
65reuse_change_numbers = true;
66minimum_branch_number = 1;
67skip_unlucky = false;
68compress_database = false;
69develop_end_action = goto_awaiting_integration;
70protect_development_directory = false;
71fubar
72test $? -eq 0 || no_result
73
74aegis -proatt -f atts -proj foo -lib $work/lib
75test $? -eq 0 || no_result
76
77activity="new developer 77"
78aegis -newdev $USER
79test $? -eq 0 || no_result
80aegis -new-reviewer $USER
81test $? -eq 0 || no_result
82aegis -new-integrator $USER
83test $? -eq 0 || no_result
84
85
86#
87# create a new change
88#
89activity="new change 89"
90cat > cattr << 'end'
91brief_description = "First change.";
92cause = internal_enhancement;
93end
94test $? -eq 0 || no_result
95aegis -new_change 1 -f cattr -project $AEGIS_PROJECT
96test $? -eq 0 || no_result
97
98activity="develop begin 98"
99aegis -dev-begin 1 -dir $work/dd
100test $? -eq 0 || no_result
101
102#
103# add a new files to the change
104#
105activity="new file 105"
106aegis -new-file -no-uuid $work/dd/aegis.conf
107test $? -eq 0 || fail
108
109cat > $work/dd/aegis.conf << 'fubar'
110build_command = "exit 0";
111diff_command =
112    "set +e;"
113    "diff -a ${quote $original} ${quote $input}"
114    " > ${quote $output};"
115    "test $? -le 1";
116merge_command = "set +e; "
117    "merge -p -L baseline -L Historical -L C$c "
118    "${quote $mostrecent} ${quote $original} ${quote $input} "
119    "> ${quote $output}; "
120    "test $? -le 1";
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;
127fubar
128test $? -eq 0 || no_result
129
130activity="create barney 130"
131aegis -new-file -no-uuid $work/dd/barney
132test $? -eq 0 || fail
133
134cat > $work/dd/barney <<EOF
135Hi my name is Barney
136EOF
137test $? -eq 0 || no_result
138
139activity="create test 139"
140aegis -new-test -no-uuid
141test $? -eq 0 || fail
142
143activity="check fstate 143"
144cat > ok <<EOF
145src =
146[
147	{
148		file_name = "aegis.conf";
149		action = create;
150		usage = config;
151		attribute =
152		[
153			{
154				name = "aeipass-option:assign-file-uuid";
155				value = "false";
156			},
157		];
158	},
159	{
160		file_name = "barney";
161		action = create;
162		usage = source;
163		attribute =
164		[
165			{
166				name = "aeipass-option:assign-file-uuid";
167				value = "false";
168			},
169		];
170	},
171	{
172		file_name = "test/00/t0001a.sh";
173		action = create;
174		usage = test;
175		attribute =
176		[
177			{
178				name = "aeipass-option:assign-file-uuid";
179				value = "false";
180			},
181		];
182	},
183];
184EOF
185test $? -eq 0 || no_result
186
187check_it ok $work/proj/info/change/0/001.fs
188
189#
190# Only definite negatives are possible.
191# The functionality exercised by this test appears to work,
192# no other guarantees are made.
193#
194pass
195