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