source: tailor/test-scripts/test-darcs2aegis-simple.sh @ 1555

Revision 1555, 6.2 KB checked in by <walter.franzini@…>, 5 years ago (diff)

improved aegis subdir handling

Line 
1#!/bin/sh
2#
3# Copyright (C) 2008 Walter Franzini
4#
5
6
7here=`pwd`
8
9#
10# Add the development dir to the PATH
11#
12PATH=$here:$PATH
13export PATH
14
15pass()
16{
17    echo "PASSED:"
18    exit 0
19}
20
21fail()
22{
23    echo "FAILED: $activity"
24    exit 1
25}
26
27no_result()
28{
29    echo "NO_RESULT: $activity"
30    exit 2
31}
32
33work=${TMPDIR-/tmp}/TAILOR.$$
34mkdir $work
35if test $? -ne 0; then no_result; fi
36
37cd $work
38
39activity="darcs setup"
40mkdir $work/darcs-repo > log 2>&1
41if test $? -ne 0; then cat log; no_result; fi
42
43darcs initialize --repodir=$work/darcs-repo > log 2>&1
44if test $? -ne 0; then cat log; no_result; fi
45
46activity="create foo"
47mkdir $work/darcs-repo/dir
48if test $? -ne 0; then no_result; fi
49
50cat > $work/darcs-repo/dir/foo.txt <<EOF
51A simple text file
52EOF
53if test $? -ne 0; then no_result; fi
54
55darcs add dir/foo.txt --repodir=$work/darcs-repo > log 2>&1
56if test $? -ne 0; then cat log; no_result; fi
57
58darcs record --repodir=$work/darcs-repo -a -A Nobody -m "initial commit" \
59    > log 2>&1
60if test $? -ne 0; then cat log; no_result; fi
61
62cat > $work/darcs-repo/dir/foo.txt <<EOF
63A simple text file
64wit some more text.
65EOF
66if test $? -ne 0; then no_result; fi
67
68cat > $work/darcs-repo/bar.txt <<EOF
69This is bar.txt
70EOF
71if test $? -ne 0; then no_result; fi
72
73darcs add bar.txt --repodir=$work/darcs-repo > log 2>&1
74if test $? -ne 0; then cat log; no_result; fi
75
76darcs record --repodir=$work/darcs-repo -a -A Nobody --ignore-time \
77    -m "second commit" > log 2>&1
78if test $? -ne 0; then cat log; no_result; fi
79
80cat > $work/darcs-repo/dir/foo.txt <<EOF
81A simple text file
82wit some more text.
83more text again!
84EOF
85if test $? -ne 0; then no_result; fi
86
87darcs mv bar.txt baz.txt --repodir=$work/darcs-repo > log 2>&1
88if test $? -ne 0; then cat log; no_result; fi
89
90darcs record --repodir=$work/darcs-repo -a -A Nobody --ignore-time \
91    -m "third commit" > log 2>&1
92if test $? -ne 0; then cat log; no_result; fi
93
94#
95# Initialize the aegis repository
96#
97
98unset AEGIS_PROJECT
99unset AEGIS_CHANGE
100unset AEGIS_PATH
101unset AEGIS
102umask 022
103
104LINES=24
105export LINES
106COLS=80
107export COLS
108
109USER=${USER:-${LOGNAME:-`whoami`}}
110
111PAGER=cat
112export PAGER
113AEGIS_THROTTLE=-1
114export AEGIS_THROTTLE
115
116# This tells aeintegratq that it is being used by a test.
117AEGIS_TEST_DIR=$work
118export AEGIS_TEST_DIR
119
120if test $? -ne 0; then exit 2; fi
121
122AEGIS_DATADIR=$here/lib
123export AEGIS_DATADIR
124
125AEGIS_MESSAGE_LIBRARY=$work/no-such-dir
126export AEGIS_MESSAGE_LIBRARY
127unset LANG
128unset LANGUAGE
129unset LC_ALL
130
131AEGIS_PROJECT=example
132export AEGIS_PROJECT
133AEGIS_PATH=$work/lib
134export AEGIS_PATH
135
136mkdir $AEGIS_PATH
137
138chmod 777 $AEGIS_PATH
139if test $? -ne 0; then no_result; cat log; fi
140
141workproj=$work/foo.proj
142workchan=$work/foo.chan
143
144activity="new project"
145aegis -npr $AEGIS_PROJECT -version "" -lib $AEGIS_PATH \
146    -dir $workproj/ > log 2>&1
147if test $? -ne 0; then cat log; no_result; fi
148
149activity="project_acttributes"
150cat > $work/pa <<EOF
151description = "A bogus project created to test tailor functionality.";
152developer_may_review = true;
153developer_may_integrate = true;
154reviewer_may_integrate = true;
155default_test_exemption = true;
156develop_end_action = goto_awaiting_integration;
157EOF
158if test $? -ne 0 ; then no_result; fi
159
160aegis -pa -f $work/pa > log 2>&1
161if test $? -ne 0 ; then cat log; no_result; fi
162
163#
164# add the staff
165#
166activity="staff 62"
167aegis -nd $USER > log 2>&1
168if test $? -ne 0 ; then cat log; no_result; fi
169aegis -nrv $USER > log 2>&1
170if test $? -ne 0 ; then cat log; no_result; fi
171aegis -ni $USER > log 2>&1
172if test $? -ne 0 ; then cat log; no_result; fi
173
174#
175# tailor config
176#
177cat > $work/tailor.conf <<EOF
178[DEFAULT]
179verbose = True
180Debug = True
181
182[project]
183patch-name-format = %(revision)s
184root-directory = $PWD/rootdir
185source = darcs:source
186target = aegis:target
187
188[darcs:source]
189repository = $work/darcs-repo
190#module = project
191subdir = darcs1side
192
193[aegis:target]
194module = $AEGIS_PROJECT
195subdir = aegisside
196EOF
197if test $? -ne 0; then no_result; fi
198
199activity="run tailor"
200python $here/tailor -c $work/tailor.conf > tailor.log 2>&1
201if test $? -ne 0; then cat tailor.log; fail; fi
202
203cat > $work/ok <<EOF
2041 10 initial commit
2052 11 second commit
2063 12 third commit
207EOF
208if test $? -ne 0; then no_result; fi
209
210activity="check aegis project history"
211aegis -list project_history -unformatted 2> log | cut -d\  -f 1,7- > history
212if test $? -ne 0; then cat log; no_result; fi
213
214diff ok history
215if test $? -ne 0; then cat tailor.log; fail; fi
216
217#
218# add more darcs changes
219#
220cat > $work/darcs-repo/bar.txt <<EOF
221A simple text file
222wit some more text.
223more text again!
224ancora piu\` test
225EOF
226if test $? -ne 0; then no_result; fi
227
228darcs remove dir/foo.txt --repodir=$work/darcs-repo > log 2>&1
229if test $? -ne 0; then cat log; no_result; fi
230
231cat > $work/logfile <<EOF
232fourth commit
233This text is now
234the description of the aegis change
235splitted on multiple lines.
236EOF
237if test $? -ne 0; then no_result; fi
238
239darcs record --repodir=$work/darcs-repo -a -A Nobody --ignore-time \
240    --logfile $work/logfile > log 2>&1
241if test $? -ne 0; then cat log; no_result; fi
242
243activity="run tailor again"
244python $here/tailor -c $work/tailor.conf > log 2>&1
245if test $? -ne 0; then cat log; fail; fi
246
247cat > $work/ok <<EOF
2481 10 initial commit
2492 11 second commit
2503 12 third commit
2514 13 fourth commit
252EOF
253if test $? -ne 0; then no_result; fi
254
255activity="check aegis project history"
256aegis -list project_history -unformatted 2> log | cut -d\  -f 1,7- > history
257if test $? -ne 0; then cat log; no_result; fi
258
259diff ok history
260if test $? -ne 0; then fail; fi
261
262cat > $work/ok <<EOF
263brief_description = "fourth commit";
264description = "This text is now the description of the aegis change splitted on\n\\
265multiple lines.";
266cause = external_improvement;
267test_exempt = true;
268test_baseline_exempt = true;
269regression_test_exempt = true;
270architecture =
271[
272        "unspecified",
273];
274copyright_years =
275[
276        `date +%Y`,
277];
278EOF
279if test $? -ne 0; then no_result; fi
280
281activity="check project content"
282aegis -ca -l 13 > $work/change_attr 2> log
283if test $? -ne 0; then cat log; no_result; fi
284
285diff ok change_attr
286if test $? -ne 0; then fail; fi
287
288#
289# test change content
290#
291activity="change 10"
292cat > $work/ok <<EOF
293config create 1 aegis.conf
294source create 1 dir/foo.txt
295EOF
296if test $? -ne 0; then no_result; fi
297
298aegis -list change_files -unf -c 10 > $work/out
299if test $? -ne 0; then no_result; fi
300
301diff $work/ok $work/out
302if test $? -ne 0; then fail; fi
303
304pass
Note: See TracBrowser for help on using the repository browser.