netcdf-c/ncdap_test/tst_ncdap3.sh
Dennis Heimbigner 7be9506aac Modified ncdap_test to allow a different method
to get TOPSRCDIR that avoids use of
TEST_ENVIRONMENT and makes automake and cmake
more consistent.

Basic assumption is that abs_top_srcdir (and
cmake equivalent) is known at 'make check' time,
so we can use -D flag to compile a program that
has the value of abs_top_srcdir embedded into it
as a constant.

We define two new files in ncdap_test:
1. t_srcdir.h -- provide a gettopsrcdir() function
   to return the topsrcdir value to the test program.
2. topsrcdir.c -- a program that calls gettopsrcdir()
   and prints its output (minus any newline) on stdout.
   This is used in .sh files to get topsrcdir.
2017-01-18 21:46:47 -07:00

45 lines
918 B
Bash
Executable File

#!/bin/sh
set -e
#X="-x"
#grind="checkleaks"
# if this is part of a distcheck action, then this script
# will be executed in a different directory
# than the one containing it; so capture the path to this script
# as the location of the source directory.
if test "x$topsrcdir" != x ; then
srcdir="$topsrcdir/ncdap_test"
else
srcdir=`dirname $0`
fi
#set -x
# compute the build directory
# Do a hack to remove e.g. c: for MSYS
cd `pwd`
builddir=`pwd`/..
# Hack for MSYS
cd $srcdir
srcdir=`pwd`
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
srcdir=`pwd | sed 's/\/c\//c:\//g'`
builddir=`echo $builddir | sed 's/\/c\//c:\//g'`
srcdir=`pwd | sed 's/\/g\//g:\//g'`
builddir=`echo $builddir | sed 's/\/g\//g:\//g'`
fi
cd ${builddir}/ncdap_test
#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file3" $grind
exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds3" $grind