chiark / gitweb /
Test suite: unapplied-pq2qc: move into lib as a t- subroutine
[dgit.git] / tests / lib
index e81a62ad3dd381f438c39d2435e64280db39eba6..0b8836266fbfc1746a16a09a2d71c10205a19a06 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -5,12 +5,16 @@ set -x
 set -o pipefail
 
 . tests/lib-core
+. tests/lib-restricts
 
 t-set-intree
 
-: ${DGIT_TEST_DEBUG:=-D}
+: ${DGIT_TEST_DEBUG=-D}
 export DGIT_TEST_DEBUG
 
+export GIT_COMMITTER_DATE='1440253867 +0100'
+export GIT_AUTHOR_DATE='1440253867 +0100'
+
 root=`pwd`
 troot=$root/tests
 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
@@ -44,6 +48,11 @@ incoming             = $tmp/incoming
 run_dinstall           = 0
 END
 
+t-git-next-date () {
+       GIT_COMMITTER_DATE="$(( ${GIT_COMMITTER_DATE%% *} + 1 )) ${GIT_COMMITTER_DATE#* }"
+       GIT_AUTHOR_DATE="$GIT_COMMITTER_DATE"
+}
+
 t-expect-fail () {
        local mpat="$1"; shift
 
@@ -125,7 +134,7 @@ t-untar () {
        local tarfile=$1.tar
        local edittree=$1.edit
        if test -d "$edittree"; then
-               cp -al "$edittree"/* .
+               cp -a "$edittree"/* .
        else
                tar xf "$tarfile"
        fi
@@ -503,6 +512,28 @@ t-apply-diff () {
         | patch -p1 -u
 }
 
+t-gbp-unapplied-pq2qc () {
+       # does `gbp pq export' (leaving us on BRANCH (eg "quilt-tip"))
+       # commits the resulting debian/patches on  qc/BRANCH
+       # goes back to patch-queue/BRANCH
+       # qc/BRANCH is not fast-forwarding
+
+       gbp pq export
+
+       branch=`git symbolic-ref HEAD`
+       branch=${branch#refs/heads/}
+
+       case "$branch" in
+       */*) fail "unexpected branch $branch" ;;
+       esac
+
+       git branch -f qc/$branch
+       git checkout qc/$branch
+       git add debian/patches
+       git commit -m 'Commit patch queue'
+       git checkout patch-queue/$branch
+}
+
 t-commit () {
        local msg=$1
        v=${2-1.$revision}
@@ -596,6 +627,15 @@ t-policy-periodic () {
                test-dummy $drs_dispatch '' --cron
 }
 
+t-restrict () {
+       local restriction=$1
+       (cd $root; t-restriction-$restriction >&2)
+}
+
+t-dependencies () {
+       : "Hopefully installed: $*"
+}
+
 t-chain-test () {
        local ct=$1
        local d=${0%/*}