d41b40e1a313a8b89c84e35e7c9b8cc4a5dd26f8
[platform/upstream/make.git] / tests / mkshadow
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, 2007, 2008, 2009, 2010 Free Software
8 # Foundation, Inc.
9 # This file is part of GNU Make.
10 #
11 # GNU Make is free software; you can redistribute it and/or modify it under
12 # the terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 3 of the License, or (at your option) any later
14 # version.
15 #
16 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19 # details.
20 #
21 # You should have received a copy of the GNU General Public License along with
22 # this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 case "$1" in
25   "") echo 'Usage: mkshadow <destdir>'; exit 1 ;;
26 esac
27
28 dest="$1"
29
30 if [ ! -d "$dest" ]; then
31   echo "Destination directory \`$dest' must exist!"
32   exit 1
33 fi
34
35 if [ ! -f run_make_tests ]; then
36   echo "The current directory doesn't appear to contain the test suite!"
37   exit 1
38 fi
39
40 suite=`pwd | sed 's%^/tmp_mnt%%'`
41 name=`basename "$suite"`
42
43 files=`echo *`
44
45 set -e
46
47 mkdir "$dest/$name"
48 cd "$dest/$name"
49
50 ln -s "$suite" .testdir
51
52 for f in $files; do
53   ln -s .testdir/$f .
54 done
55
56 rm -rf work
57
58 echo "Shadow test suite created in \`$dest/$name'."
59 exit 0