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

Last change on this file since 1337 was 1337, checked in by Peter Johansson, 11 years ago

using macros from yat to create files .release and .release_year

  • 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 1337 2011-02-12 23:57:58Z peter $
5
6# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
7# Copyright (C) 2009, 2010 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  echo "$me: failed test: $@";
27  exit 1
28}
29
30exit_skip ()
31{
32  echo "$me: skipped test: $@"
33  exit 77
34}
35
36exit_success ()
37{
38  echo "$me: successsful test: $@";
39  exit 0
40}
41
42# primary variables - set by config.status
43abs_top_builddir=@abs_top_builddir@
44abs_top_srcdir=@abs_top_srcdir@
45abs_builddir=@abs_builddir@
46mkdir_p="@MKDIR_P@"
47repo="@abs_test_repo@"
48shell=@SHELL@
49test_repo_found=@test_repo_found@
50have_svn_wc="@have_svn_wc@"
51
52test -z "$SVNDIGEST" && SVNDIGEST="${abs_top_builddir}/bin/svndigest";
53test -z "$SVNDIGEST_COPY_CACHE" \
54&& SVNDIGEST_COPY_CACHE="${abs_top_builddir}/bin/svndigest-copy-cache";
55test -z "$SVNCOPYRIGHT" && SVNCOPYRIGHT="${abs_top_builddir}/bin/svncopyright";
56test -z "$srcdir" && srcdir="@srcdir@";
57test -z "$SVN" && SVN="svn --non-interactive";
58test -z "$GREP" && GREP=@GREP@;
59
60# some helpful derived variables
61rootdir=toy_project
62repo_url="file://$repo"
63svn_update=${abs_builddir}/svn_update.sh
64
65me=$0
66
67test_dir=`echo $me.dir | sed -e 's,.*[\\/],,'`
68test_dir="testSubDir/$test_dir"
69$mkdir_p --verbose $test_dir
70cd $test_dir
71
72abs_wcdir=${abs_builddir}/${test_dir}/toy_project
73
74for r in : $required; do
75  case $r in
76    repo*)
77      if test x$test_repo_found = xyes; then
78        $shell ${svn_update} || exit_fail;
79      else
80        exit_skip "no test repository available";
81      fi;;
82    wc)
83      if test x$have_svn_wc = xno; then
84        exit_skip "not subversion working copy";
85      fi;;
86    *)
87    :
88  esac
89done
90
91
92foo_run ()
93{
94    expected_exitcode=$1
95    shift
96    exitcode=0
97    $foo_prog ${1+"$@"} > stdout 2>stderr || exitcode=$?
98    cat stderr >&2
99    cat stdout
100    test $exitcode = $expected_exitcode || exit_fail
101}
102
103SVNDIGEST_run ()
104{
105    foo_prog="$SVNDIGEST --verbose"
106    foo_run $@
107}
108
109SVNDIGEST_COPY_CACHE_run ()
110{
111    foo_prog="$SVNDIGEST_COPY_CACHE --verbose"
112    foo_run $@
113}
114
115SVNCOPYRIGHT_run ()
116{
117    foo_prog="$SVNCOPYRIGHT"
118    foo_run $@
119}
120
121
122echo "=== running $me ==="
123
124# turn on trace
125set -x;
Note: See TracBrowser for help on using the repository browser.