chiark / gitweb /
test suite: gdr-import-dgitview: New test for dgit dsc imports
[dgit.git] / tests / lib-core
1 #
2
3 fail () {
4         echo >&2 "failed: $*"
5         exit 1
6 }
7
8 t-set-intree () {
9         if [ "x$DGIT_TEST_INTREE" = x ]; then return; fi
10         : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit}
11         : ${DGIT_BADCOMMIT_FIXUP:=$DGIT_TEST_INTREE/dgit-badcommit-fixup}
12         : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server}
13         : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch}
14         : ${DGIT_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}}
15         : ${DGIT_GITDEBREBASE_TEST:=$DGIT_TEST_INTREE/git-debrebase}
16         : ${DGIT_MANPAGES_SOURCE_DIR:=$DGIT_TEST_INTREE}
17         export DGIT_TEST DGIT_BADCOMMIT_FIXUP
18         export DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
19         export DGIT_MANPAGES_SOURCE_DIR
20         export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}"
21 }
22
23 t-set-using-tmp () {
24         export HOME=$tmp
25         export DGIT_TEST_DUMMY_DIR=$tmp
26         export DGIT_TEST_TMP=$tmp
27         export GNUPGHOME=$tmp/nonexistent
28         git config --global user.email 'dgit-test@debian.example.net'
29         git config --global user.name 'dgit test git user'
30         git config --global protocol.ext.allow always
31 }
32
33 t-filter-out-git-hyphen-dir () {
34         local pathent; pathent=$(type -p git-rev-parse ||:)
35         case "$pathent" in '') return ;; esac
36         pathent=${pathent%/*}
37         local path=":$PATH:"
38         path="${path//:$pathent:/}"
39         path="${path#:}"
40         path="${path%:}"
41         PATH="$path"
42 }
43
44 t-sort () {
45         LC_COLLATE=C sort "$@"
46 }