chiark / gitweb /
Test suite: import-nonnative: Prepare for more tests
[dgit.git] / tests / tests / import-nonnative
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-tstunt-parsechangelog
6
7 chk1 () {
8         p=$1
9         v=$2
10
11         t-archive $p $v
12 }
13 chk2() {
14         t-git-none
15         rm -rf $p
16         t-dgit --no-rm-on-error clone $p
17
18         # And now we make an update using the same orig tarball, and
19         # check that the orig import is stable.
20
21         cd $p
22
23         git branch first-import
24
25         m='Commit for import check'
26         echo "$m" >>import-check
27
28         v=${v%-*}-99
29         dch -v $v -D unstable -m "$m"
30
31         git add import-check debian/changelog
32         git commit -m "$m"
33
34         t-dgit -wgf quilt-fixup
35         t-dgit -wgf build-source
36
37         # The resulting .dsc does not have a Dgit line (because dgit push
38         # puts that in).  So we just shove it in the archive now
39
40         ln ../${p}_${v}.* $tmp/mirror/pool/main/
41         t-archive-query
42
43         t-dgit fetch
44
45         git branch first-2nd-import remotes/dgit/dgit/sid
46
47         t-git-next-date
48
49         git update-ref refs/remotes/dgit/dgit/sid first-import
50
51         t-dgit fetch
52
53         t-refs-same-start
54         t-ref-same refs/remotes/dgit/dgit/sid
55         t-ref-same refs/heads/first-2nd-import
56
57         for orig in ../${p}_${v%-*}.orig*.tar.*; do
58                 orig=${orig#../}
59                 pat="^Import ${orig//./\\.}\$"
60                 t-refs-same-start
61                 for start in first-import first-2nd-import; do
62                         git log --pretty='tformat:%H' --grep "$pat" $start \
63                                 >../t.imp
64                         test $(wc -l <../t.imp) = 1
65                         imp=$(cat ../t.imp)
66                         t-ref-same-val "$orig $start" "$imp"
67                 done
68         done
69         cd ..
70 }
71
72 chk() { chk1 "$@"; chk2; }
73
74 # 1.0 with diff
75 chk pari-extra 3-1
76
77 # 3.0 (quilt), multiple patches, multiple origs
78 chk example 1.0-1
79
80 # 3.0 (quilt), single-debian-patch, one orig
81 chk sunxi-tools 1.2-2.~~dgittest
82
83 echo done.