Home | History | Annotate | Download | only in tests
      1 #!/bin/sh
      2 #
      3 # Simple script to make a "shadow" test directory, using symbolic links.
      4 # Typically you'd put the shadow in /tmp or another local disk
      5 #
      6 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
      7 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
      8 # This file is part of GNU Make.
      9 #
     10 # GNU Make is free software; you can redistribute it and/or modify it under the
     11 # terms of the GNU General Public License as published by the Free Software
     12 # Foundation; either version 2, or (at your option) any later version.
     13 #
     14 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     17 #
     18 # You should have received a copy of the GNU General Public License along with
     19 # GNU Make; see the file COPYING.  If not, write to the Free Software
     20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     21 
     22 case "$1" in
     23   "") echo 'Usage: mkshadow <destdir>'; exit 1 ;;
     24 esac
     25 
     26 dest="$1"
     27 
     28 if [ ! -d "$dest" ]; then
     29   echo "Destination directory \`$dest' must exist!"
     30   exit 1
     31 fi
     32 
     33 if [ ! -f run_make_tests ]; then
     34   echo "The current directory doesn't appear to contain the test suite!"
     35   exit 1
     36 fi
     37 
     38 suite=`pwd | sed 's%^/tmp_mnt%%'`
     39 name=`basename "$suite"`
     40 
     41 files=`echo *`
     42 
     43 set -e
     44 
     45 mkdir "$dest/$name"
     46 cd "$dest/$name"
     47 
     48 ln -s "$suite" .testdir
     49 
     50 for f in $files; do
     51   ln -s .testdir/$f .
     52 done
     53 
     54 rm -rf work
     55 
     56 echo "Shadow test suite created in \`$dest/$name'."
     57 exit 0
     58