source: trunk/test/init.sh.in

Last change on this file was 1601, checked in by Peter Johansson, 8 years ago

allow test to require a wc in different rev than HEAD.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1# @configure_input@
2
3# $Id: init.sh.in 1601 2015-09-06 02:45:30Z peter $
4
5# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
6# Copyright (C) 2009, 2010, 2011, 2012, 2015 Peter Johansson
7#
8# This file is part of svndigest, http://dev.thep.lu.se/svndigest
9#
10# svndigest is free software; you can redistribute it and/or modify it
11# under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3 of the License, or
13# (at your option) any later version.
14#
15# svndigest is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18# General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
22
23exit_fail ()
24{
25  set +x
26  echo "$me: failed test: $@";
27  exit 1
28}
29
30exit_skip ()
31{
32  set +x
33  echo "$me: skipped test: $@"
34  exit 77
35}
36
37exit_success ()
38{
39  set +x
40  echo "$me: successsful test: $@";
41  exit 0
42}
43
44# primary variables - set by config.status
45abs_top_builddir=@abs_top_builddir@
46abs_top_srcdir=@abs_top_srcdir@
47abs_builddir=@abs_builddir@
48mkdir_p="@MKDIR_P@"
49repo="@abs_test_repo@"
50shell=@SHELL@
51test_repo_found=@test_repo_found@
52have_svn_wc="@have_svn_wc@"
53
54test -z "$SVNDIGEST" && SVNDIGEST="${abs_top_builddir}/bin/svndigest";
55test -z "$SVNDIGEST_COPY_CACHE" \
56&& SVNDIGEST_COPY_CACHE="${abs_top_builddir}/bin/svndigest-copy-cache";
57test -z "$SVNCOPYRIGHT" && SVNCOPYRIGHT="${abs_top_builddir}/bin/svncopyright";
58test -z "$srcdir" && srcdir="@srcdir@";
59test -z "$SVN" && SVN="svn --non-interactive";
60test -z "$GREP" && GREP=@GREP@;
61
62# some helpful derived variables
63rootdir=toy_project
64repo_url="file://$repo"
65svn_update=${abs_builddir}/svn_update.sh
66
67me=$0
68
69test_dir=`echo $me.dir | sed -e 's,.*[\\/],,'`
70test_dir="test/testSubDir/$test_dir"
71$mkdir_p --verbose $test_dir
72cd $test_dir
73
74abs_wcdir=${abs_builddir}/${test_dir}/toy_project
75
76for r in : $required; do
77  case $r in
78    repo*)
79      if test x$test_repo_found = xyes; then
80        # test can set wc_revision if it requires different rev than HEAD
81        $shell ${svn_update} $wc_revision || exit_fail;
82      else
83        exit_skip "no test repository available";
84      fi;;
85    wc)
86      if test x$have_svn_wc = xno; then
87        exit_skip "not subversion working copy";
88      fi;;
89    *)
90    :
91  esac
92done
93
94
95foo_run ()
96{
97    expected_exitcode=$1
98    shift
99    exitcode=0
100    $foo_prog ${1+"$@"} > stdout 2>stderr || exitcode=$?
101    cat stderr >&2
102    cat stdout
103    test $exitcode = $expected_exitcode || exit_fail
104}
105
106SVNDIGEST_run ()
107{
108    foo_prog="$SVNDIGEST --verbose"
109    foo_run $@
110}
111
112SVNDIGEST_COPY_CACHE_run ()
113{
114    foo_prog="$SVNDIGEST_COPY_CACHE --verbose"
115    foo_run $@
116}
117
118SVNCOPYRIGHT_run ()
119{
120    foo_prog="$SVNCOPYRIGHT"
121    foo_run $@
122}
123
124
125echo "=== running $me ==="
126
127# turn on trace
128set -x;
Note: See TracBrowser for help on using the repository browser.