chiark / gitweb /
autopkgtests: Provide tests/lib, and one pari-extra based clone test.
[dgit.git] / tests / lib
1 #
2
3 exec 2>&1
4
5 root=`pwd`
6 troot=$root/tests
7 testname="${0##*/}"
8
9 tmp=$ADTTMP
10 if [ x"$tmp" = x ]; then
11         mkdir -p tests/tmp
12         tmp=tests/tmp/$testname
13         rm -rf $tmp
14         mkdir $tmp
15 fi
16 cd $tmp
17 tmp=`pwd`
18 export DGIT_TEST_DUMMY_DIR=$tmp
19 ln $troot/ssh ssh
20
21 t-git () {
22         mkdir -p git
23         cp -al $troot/git-srcs/$1 git/.
24 }
25
26 t-archive () {
27         p=$1
28         mkdir -p aq mirror
29         local dscf=${p}_$2.dsc
30         ln $troot/pkg-srcs/${p}_${2%-*}* mirror/
31         echo sid >aq/suite.unstable
32         echo "$2 $dscf" >>aq/package.sid.${p}
33         mkdir extract
34         (set -e; cd extract; dpkg-source -x ../mirror/$dscf)
35 }
36
37 t-dgit () {
38         ${DGIT_TEST-dgit} --dget:-u -dtest-dummy "$@"
39 }
40
41 t-diff-nogit () {
42         diff --exclude=.git -ruN $*
43 }
44
45 t-output () {
46         printf "%s\n" "$1" >$tmp/t.want
47         shift
48         "$@" >$tmp/t.got
49         diff $tmp/t.want $tmp/t.got
50 }
51
52 t-clean-on-branch () {
53         t-output "## $1" git status -b --porcelain
54 }
55
56 t-refs-same () {
57         local f=$1
58         git rev-parse $f >$tmp/t.ref1
59         local g
60         for g in $*; do
61                 git rev-parse $g >$tmp/t.refn
62                 diff $tmp/t.ref1 $tmp/t.refn
63         done
64 }