chiark / gitweb /
Test suite: unrepresentable: New test
[dgit.git] / tests / tests / quilt-splitbrains
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 # This test script tests each of the split brain quilt modes, and
6 # --quilt=linear, with a tree suitable for each of those, and pushes
7 # them in sequence.  The idea is to check that each tree is rejected
8 # by the wrong quilt modes, and accepted and processed correctly by
9 # the right ones.
10
11 t-tstunt-parsechangelog
12
13 t-newtag
14
15 # Easiest way to make a patches-unapplied but not-gbp tree is
16 # to take the patches-unapplied tree and by-hand commit the .gitignore
17 # changes as a debian patch.
18 t-gbp-example-prep
19
20 suite=sid
21
22 want-success () {
23         local qmode=$1; shift
24         t-dgit "$@" --quilt=$qmode build-source
25
26         t-refs-same-start
27         t-ref-head
28         t-dgit "$@" --quilt=$qmode push
29         t-$qmode-pushed-good
30 }
31
32
33 echo "===== testing tree suitable for --quilt=gbp (only) ====="
34
35 t-expect-fail 'grep: new-upstream-file: No such file or directory' \
36 t-dgit --quilt=dpm build-source
37
38 t-expect-fail 'git tree differs from result of applying' \
39 t-dgit -wgf --quilt=dpm build-source
40
41 t-expect-fail 'git tree differs from orig in upstream files' \
42 t-dgit -wgf --quilt=unapplied build-source
43
44 t-expect-fail 'This might be a patches-unapplied branch' \
45 t-dgit -wgf build-source
46
47 # testing success with --quilt=gbp are done in quilt-gbp test case
48
49
50 echo "===== making tree suitable for --quilt=unapplied (only) ====="
51
52 pf=debian/patches/test-gitignore
53
54 cat >$pf <<END
55 From: Senatus <spqr@example.com>
56 Subject: Add .gitignore
57
58 ---
59 END
60
61 git diff /dev/null .gitignore >>$pf || test $? = 1
62 echo ${pf##*/} >>debian/patches/series
63
64 git add debian/patches
65 git rm -f .gitignore
66 git commit -m 'Turn gitignore into a debian patch'
67 gitigncommit=`git rev-parse HEAD`
68
69 t-commit unapplied 1.0-3
70
71 echo "----- testing tree suitable for --quilt=unapplied (only) -----"
72
73 t-expect-fail 'git tree differs from result of applying' \
74 t-dgit -wgf --quilt=dpm build-source
75
76 t-expect-fail 'gitignores: but, such patches exist' \
77 t-dgit -wgf --quilt=gbp build-source
78
79 t-expect-fail 'This might be a patches-unapplied branch' \
80 t-dgit -wgf build-source
81
82 want-success unapplied -wgf
83
84
85 echo "===== making fully-applied tree suitable for --quilt-check ====="
86
87 git checkout master
88 git merge --ff-only dgit/dgit/sid
89
90 t-commit vanilla 1.0-4
91
92 echo "----- testing fully-applied tree suitable for --quilt-check -----"
93
94 t-expect-fail 'gitignores: but, such patches exist' \
95 t-dgit --quilt=dpm build-source
96
97 t-expect-fail 'git tree differs from orig in upstream files' \
98 t-dgit --quilt=gbp build-source
99
100 t-expect-fail 'git tree differs from orig in upstream files' \
101 t-dgit --quilt=unapplied build-source
102
103 t-dgit --quilt=nofix build-source
104 t-refs-same-start
105 t-ref-head
106 t-dgit --quilt=nofix push
107 t-pushed-good-core
108
109
110 echo "===== making tree suitable for --quilt=dpm (only) ====="
111
112 git checkout master
113 git merge --ff-only dgit/dgit/sid
114
115 git revert --no-edit $gitigncommit
116
117 t-commit dpmish 1.0-5
118
119 echo "----- testing tree suitable for --quilt=dpm (only) -----"
120
121 t-expect-fail 'git tree differs from orig in upstream files' \
122 t-dgit -wgf --quilt=gbp build-source
123
124 t-expect-fail 'git tree differs from orig in upstream files' \
125 t-dgit -wgf --quilt=unapplied build-source
126
127 t-expect-fail 'This might be a patches-applied branch' \
128 t-dgit -wgf build-source
129
130 want-success dpm
131
132
133 echo ok.