Changeset 952 for trunk/test


Ignore:
Timestamp:
Dec 6, 2009, 8:42:30 AM (12 years ago)
Author:
Peter Johansson
Message:

introducing init.sh and using it. Added a README file in test directory including info on how to use init.sh. refs #418

Location:
trunk/test
Files:
1 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r938 r952  
    2020# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2121
    22 check_SCRIPTS = svn_update.sh
     22check_SCRIPTS = svn_update.sh init.sh
    2323
    2424check_PROGRAMS = cache_partial_test color_test \
  • trunk/test/check_repo_status.sh.in

    r847 r952  
    2121# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2222
    23 wc_found="@wc_found@"
    24 if test $wc_found = "no"; then
    25     exit 77;
    26 fi
     23required="wc"
     24. ./init.sh
    2725
     26set -e
    2827
    2928# assume test repository and svndigest repository are synchronized
     
    3130
    3231# retrieve last revision in test repository
    33 rev=`cat @srcdir@/repo/db/current`
     32rev=`cat ${repo}/db/current`
    3433rev=${rev%% *}
    3534
    3635# check if the last test revision is a part of the svndigest repository
    37 status_return=`svn status -v @srcdir@/repo/db/revs/$rev`
     36status_return=`$SVN status -v ${repo}/db/revs/$rev`
    3837# logic: (file does not exist) || (file exists but not in revision control)
    3938if [[ ${#status_return} -eq 0 || ${status_return:0:1} = "?" ]]; then
     
    5453    echo "ERROR:    svn add test/repo/db/revs/$rev test/repo/db/revprops/$rev"
    5554    let rev--
    56     status_return=`svn status -v @srcdir@/repo/db/revs/$rev`
     55    status_return=`$SVN status -v ${repo}/db/revs/$rev`
    5756done
    5857
    5958if [ $repository_status -eq 0 ]; then
    60     exit -1;    # test failed.
     59    exit_fail;    # test failed.
    6160fi
     61
     62exit_success
  • trunk/test/copyright_test2.sh.in

    r938 r952  
    2222# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2323
    24 abs_top_builddir=@abs_top_builddir@
    25 abs_builddir=@abs_builddir@
    26 # this test has its own wc since it modifies wc
    27 rootdir=$abs_builddir/.toy_project2
    28 repo="@abs_test_repo@";
     24required="repo"
    2925
    30 test_repo_found=@test_repo_found@
    31 if test x$test_repo_found != xyes; then
    32     exit 77;
    33 fi
    34 
    35 while test $# -gt 0; do
    36     case "$1" in
    37     -v)
    38     VERBOSE=1
    39     ;;
    40     esac
    41     shift
    42 done
    43 
    44 if test -z "$VERBOSE"; then
    45   exec > /dev/null
    46 fi
     26. ./init.sh || exit 1
    4727
    4828# exit if cmd fails
    4929set -e
    5030
     31# this test has its own wc since it modifies wc
     32rootdir=$abs_builddir/.toy_project2
     33
    5134rm -rf $rootdir
    52 svn co file://$repo/trunk $rootdir -r 45
    53 svn update $rootdir/lib
     35$SVN co ${repo_url}/trunk $rootdir -r 45
     36$SVN update $rootdir/lib
    5437# cannot use old config file because it's invalid
    55 svn update $rootdir/.svndigest
     38$SVN update $rootdir/.svndigest
    5639
    57 $abs_top_builddir/bin/svndigest -r $rootdir --copyright \
    58 --ignore-cache --no-report --verbose
     40$SVNDIGEST -r $rootdir --copyright --ignore-cache --no-report || exit_fail
    5941
    6042# remove wc to avoid someone being tempted to modify it
    6143rm -rf $rootdir
     44
     45exit_success;
  • trunk/test/init.sh.in

    r947 r952  
    2222# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2323
     24exit_fail ()
     25{
     26  echo "$me: failed test: $@" 1>&2;
     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
    2443abs_top_builddir=@abs_top_builddir@
    2544abs_builddir=@abs_builddir@
     45mkdir_p="@MKDIR_P@"
     46repo="@abs_test_repo@"
     47shell=@SHELL@
     48test_repo_found=@test_repo_found@
     49wc_found="@wc_found@"
     50
     51test -z "$SVNDIGEST" && SVNDIGEST="@top_builddir@/bin/svndigest --verbose";
     52test -z "$srcdir" && srcdir="@srcdir@";
     53test -z "$SVN" && SVN=svn;
     54
     55# some helpful derived variables
    2656rootdir=$abs_builddir/toy_project
    2757targetdir=$abs_builddir/generated_output
    28 
    29 test_repo_found=@test_repo_found@
    30 if test x$test_repo_found != xyes; then
    31     exit 77;
    32 fi
     58repo_url="file://$repo"
    3359
    3460while test $# -gt 0; do
     
    4167done
    4268
    43 if test -z "$VERBOSE"; then
    44   exec > /dev/null
     69# redirect output unless in verbose mode
     70test -z "$VERBOSE" && exec > /dev/null;
     71
     72me=$0
     73
     74for r in : $required; do
     75  echo $r
     76  case $r in
     77    repo*)
     78      if test x$test_repo_found = xyes; then
     79        cd $abs_builddir && $shell svn_update.sh || exit 1;
     80      else
     81        exit_skip "no test repository available";
     82      fi;;
     83    wc)
     84      if test x$wc_found = xno; then
     85        exit_skip "not subversion working copy";
     86      fi;;
     87    *)
     88    :
     89  esac
     90done
     91
     92echo "=== running $me ==="
     93
     94# turn on trace in verbose mode
     95if test -n "$VERBOSE"; then
     96  set -x;
    4597fi
    4698
    47 cd $abs_builddir && @SHELL@ svn_update.sh || exit 1;
    48 
    49 @MKDIR_P@ $targetdir;
    50 
    51 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir \
    52 --ignore-cache --no-report --verbose;
    53 
    54 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir -vf;
  • trunk/test/svn_update.sh.in

    r847 r952  
    2222# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2323
     24test -z "$SVN" && SVN=svn
    2425rootdir=@abs_builddir@/toy_project
    2526
    2627if test ! -e $rootdir; then
    2728    repo="@abs_test_repo@";
    28     svn co file://$repo/trunk $rootdir > /dev/null;
     29    $SVN co file://$repo/trunk $rootdir > /dev/null;
    2930fi
    3031
    31 svn update $rootdir > /dev/null;
     32$SVN update $rootdir > /dev/null;
  • trunk/test/svndigest_copy_cache_test.sh

    r912 r952  
    1919# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2020
    21 while test $# -gt 0; do
    22     case "$1" in
    23     -v)
    24     VERBOSE=1
    25     ;;
    26     esac
    27     shift
    28 done
     21required=
    2922
    30 if test -z "$VERBOSE"; then
    31   exec > /dev/null
    32 else
    33   set -x
    34 fi
    35 
    36 echo "=== running test $0 ==="
    37 
     23. ./init.sh || exit 1
    3824set -e
    3925
    4026for opt in --version --help; do
    4127  ../bin/svndigest-copy-cache $opt > out.tmp 2> error.tmp
    42   test -n "`cat out.tmp`"
    43   test -z "`cat error.tmp`"
     28  test -n "`cat out.tmp`" || exit_fail
     29  test -z "`cat error.tmp`" || exit_fail
    4430  rm -f *.tmp
    4531done
    4632
    47 exit 0
     33exit_success
  • trunk/test/test_repo.sh.in

    r847 r952  
    2222# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2323
    24 abs_top_builddir=@abs_top_builddir@
    25 abs_builddir=@abs_builddir@
    26 rootdir=$abs_builddir/toy_project
    27 targetdir=$abs_builddir/generated_output
     24required="repo"
    2825
    29 test_repo_found=@test_repo_found@
    30 if test x$test_repo_found != xyes; then
    31     exit 77;
    32 fi
     26. ./init.sh || exit 1
    3327
    34 while test $# -gt 0; do
    35     case "$1" in
    36     -v)
    37     VERBOSE=1
    38     ;;
    39     esac
    40     shift
    41 done
     28$mkdir_p $targetdir;
    4229
    43 if test -z "$VERBOSE"; then
    44   exec > /dev/null
    45 fi
     30$SVNDIGEST -r $rootdir -t $targetdir --ignore-cache --no-report || exit_fail;
    4631
    47 cd $abs_builddir && @SHELL@ svn_update.sh || exit 1;
     32$SVNDIGEST -r $rootdir -t $targetdir --force || exit_fail;
    4833
    49 @MKDIR_P@ $targetdir;
    50 
    51 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir \
    52 --ignore-cache --no-report --verbose;
    53 
    54 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir -vf;
     34exit_success;
Note: See TracChangeset for help on using the changeset viewer.