Fix file mode.
[llvm-testsuite.git] / External / SPEC / Sandbox.sh
blob2af4ecca7ba60502df7f427f008d03e01309918a
1 #!/bin/sh
3 # Program: Sandbox.sh
5 # Synopsis: This script is used to provide a sandbox for SPEC programs to
6 # execute in. It provides an isolated environment, the input files
7 # necessary, and then finally runs the program.
9 # Syntax: ./Sandbox.sh <uid> <output_file> <ref input> <program> <arguments>
12 TEST_UID=$1
13 OUTPUT_FILE=$2
14 INPUT_DIR=$3
15 shift;shift;shift
17 mkdir Output/$TEST_UID 2> /dev/null
18 cd Output/$TEST_UID
19 rm -rf *
21 # Copy all of the test input files into the current directory.
22 cp -r $INPUT_DIR/* .
24 # If there is an "all" input directory, take it as well. This
25 # effectively copies over $INPUT_DIR/../../all/input, but works if the
26 # actual $INPUT_DIR directory doesn't exist, as is the case with 444.namd.
27 UP1=`dirname $INPUT_DIR`
28 UP2=`dirname $UP1`
29 cp -r $UP2/all/input/* . > /dev/null 2>&1
31 # If any of the input files is a .bz2 file, uncompress it now.
32 bunzip2 *.bz2 > /dev/null 2>&1
34 # Run the program now.
35 echo Running: "$@"
36 exec "$@"