L4Re/departure

libe2access/host/run_test

391:bc65615a8fed
2022-06-30 Paul Boddie Added missing structure members. mmap-region-flags
     1 #!/bin/sh     2      3 # Run a test program with its own image.     4 #     5 # Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>     6 #     7 # This program is free software; you can redistribute it and/or     8 # modify it under the terms of the GNU General Public License as     9 # published by the Free Software Foundation; either version 2 of    10 # the License, or (at your option) any later version.    11 #    12 # This program is distributed in the hope that it will be useful,    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    15 # GNU General Public License for more details.    16 #    17 # You should have received a copy of the GNU General Public License    18 # along with this program; if not, write to the Free Software    19 # Foundation, Inc., 51 Franklin Street, Fifth Floor,    20 # Boston, MA  02110-1301, USA    21     22 THISDIR=`dirname "$0"`    23 PROGNAME=`basename "$0"`    24     25 # Obtain any option.    26     27 if [ "$1" = '-k' ] ; then    28     KEEP_IMAGE="$1"    29     shift 1    30 else    31     KEEP_IMAGE=    32 fi    33     34 # Obtain the test name.    35     36 TEST="$1"    37 TESTPROG="$THISDIR/$TEST"    38     39 if [ ! "$TEST" ] || [ ! -e "$TESTPROG" ] ; then    40     echo "Usage: $PROGNAME [ -k ] <test>" 1>&2    41     exit 1    42 fi    43     44 # Indicate the library location.    45     46 export LD_LIBRARY_PATH="$THISDIR":"$LD_LIBRARY_PATH"    47     48 # Make an image to use for testing.    49     50 IMAGE=`"$THISDIR/mkfs"`    51     52 # Run the test program.    53     54 "$TESTPROG" "$IMAGE"    55     56 # Show the image filename or remove the image.    57     58 if [ "$KEEP_IMAGE" ] ; then    59     echo "$IMAGE"    60 else    61     rm "$IMAGE"    62 fi    63     64 # vim: tabstop=4 expandtab shiftwidth=4