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 | |
---|
23 | exit_fail () |
---|
24 | { |
---|
25 | set +x |
---|
26 | echo "$me: failed test: $@"; |
---|
27 | exit 1 |
---|
28 | } |
---|
29 | |
---|
30 | exit_skip () |
---|
31 | { |
---|
32 | set +x |
---|
33 | echo "$me: skipped test: $@" |
---|
34 | exit 77 |
---|
35 | } |
---|
36 | |
---|
37 | exit_success () |
---|
38 | { |
---|
39 | set +x |
---|
40 | echo "$me: successsful test: $@"; |
---|
41 | exit 0 |
---|
42 | } |
---|
43 | |
---|
44 | # primary variables - set by config.status |
---|
45 | abs_top_builddir=@abs_top_builddir@ |
---|
46 | abs_top_srcdir=@abs_top_srcdir@ |
---|
47 | abs_builddir=@abs_builddir@ |
---|
48 | mkdir_p="@MKDIR_P@" |
---|
49 | repo="@abs_test_repo@" |
---|
50 | shell=@SHELL@ |
---|
51 | test_repo_found=@test_repo_found@ |
---|
52 | have_svn_wc="@have_svn_wc@" |
---|
53 | |
---|
54 | test -z "$SVNDIGEST" && SVNDIGEST="${abs_top_builddir}/bin/svndigest"; |
---|
55 | test -z "$SVNDIGEST_COPY_CACHE" \ |
---|
56 | && SVNDIGEST_COPY_CACHE="${abs_top_builddir}/bin/svndigest-copy-cache"; |
---|
57 | test -z "$SVNCOPYRIGHT" && SVNCOPYRIGHT="${abs_top_builddir}/bin/svncopyright"; |
---|
58 | test -z "$srcdir" && srcdir="@srcdir@"; |
---|
59 | test -z "$SVN" && SVN="svn --non-interactive"; |
---|
60 | test -z "$GREP" && GREP=@GREP@; |
---|
61 | |
---|
62 | # some helpful derived variables |
---|
63 | rootdir=toy_project |
---|
64 | repo_url="file://$repo" |
---|
65 | svn_update=${abs_builddir}/svn_update.sh |
---|
66 | |
---|
67 | me=$0 |
---|
68 | |
---|
69 | test_dir=`echo $me.dir | sed -e 's,.*[\\/],,'` |
---|
70 | test_dir="test/testSubDir/$test_dir" |
---|
71 | $mkdir_p --verbose $test_dir |
---|
72 | cd $test_dir |
---|
73 | |
---|
74 | abs_wcdir=${abs_builddir}/${test_dir}/toy_project |
---|
75 | |
---|
76 | for 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 |
---|
92 | done |
---|
93 | |
---|
94 | |
---|
95 | foo_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 | |
---|
106 | SVNDIGEST_run () |
---|
107 | { |
---|
108 | foo_prog="$SVNDIGEST --verbose" |
---|
109 | foo_run $@ |
---|
110 | } |
---|
111 | |
---|
112 | SVNDIGEST_COPY_CACHE_run () |
---|
113 | { |
---|
114 | foo_prog="$SVNDIGEST_COPY_CACHE --verbose" |
---|
115 | foo_run $@ |
---|
116 | } |
---|
117 | |
---|
118 | SVNCOPYRIGHT_run () |
---|
119 | { |
---|
120 | foo_prog="$SVNCOPYRIGHT" |
---|
121 | foo_run $@ |
---|
122 | } |
---|
123 | |
---|
124 | |
---|
125 | echo "=== running $me ===" |
---|
126 | |
---|
127 | # turn on trace |
---|
128 | set -x; |
---|