source: trunk/test/init.sh.in @ 1525

Last change on this file since 1525 was 1525, checked in by Peter Johansson, 9 years ago

replace recursive Makefile with one single Makefile. Keeping multiple Makefile.ams which are included into main Makefile.am.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1#!@SHELL@
2# @configure_input@
3
4# $Id: init.sh.in 1525 2012-10-01 06:31:07Z peter $
5
6# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
7# Copyright (C) 2009, 2010, 2011 Peter Johansson
8#
9# This file is part of svndigest, http://dev.thep.lu.se/svndigest
10#
11# svndigest is free software; you can redistribute it and/or modify it
12# under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 3 of the License, or
14# (at your option) any later version.
15#
16# svndigest is distributed in the hope that it will be useful, but
17# WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19# General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
23
24exit_fail ()
25{
26  set +x
27  echo "$me: failed test: $@";
28  exit 1
29}
30
31exit_skip ()
32{
33  set +x
34  echo "$me: skipped test: $@"
35  exit 77
36}
37
38exit_success ()
39{
40  set +x
41  echo "$me: successsful test: $@";
42  exit 0
43}
44
45# primary variables - set by config.status
46abs_top_builddir=@abs_top_builddir@
47abs_top_srcdir=@abs_top_srcdir@
48abs_builddir=@abs_builddir@
49mkdir_p="@MKDIR_P@"
50repo="@abs_test_repo@"
51shell=@SHELL@
52test_repo_found=@test_repo_found@
53have_svn_wc="@have_svn_wc@"
54
55test -z "$SVNDIGEST" && SVNDIGEST="${abs_top_builddir}/bin/svndigest";
56test -z "$SVNDIGEST_COPY_CACHE" \
57&& SVNDIGEST_COPY_CACHE="${abs_top_builddir}/bin/svndigest-copy-cache";
58test -z "$SVNCOPYRIGHT" && SVNCOPYRIGHT="${abs_top_builddir}/bin/svncopyright";
59test -z "$srcdir" && srcdir="@srcdir@";
60test -z "$SVN" && SVN="svn --non-interactive";
61test -z "$GREP" && GREP=@GREP@;
62
63# some helpful derived variables
64rootdir=toy_project
65repo_url="file://$repo"
66svn_update=${abs_builddir}/svn_update.sh
67
68me=$0
69
70test_dir=`echo $me.dir | sed -e 's,.*[\\/],,'`
71test_dir="test/testSubDir/$test_dir"
72$mkdir_p --verbose $test_dir
73cd $test_dir
74
75abs_wcdir=${abs_builddir}/${test_dir}/toy_project
76
77for r in : $required; do
78  case $r in
79    repo*)
80      if test x$test_repo_found = xyes; then
81        $shell ${svn_update} || 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.