Skip to content

Commit 1e88c94

Browse files
committed
Add test script for make install when prefix and DESTDIR are used
1 parent 0ba34d1 commit 1e88c94

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

test/tst_install.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (C) 2024, Northwestern University and Argonne National Laboratory
4+
# See COPYRIGHT notice in top-level directory.
5+
#
6+
7+
# Exit immediately if a command exits with a non-zero status.
8+
set -e
9+
10+
# This requires one command-line option, the installation path
11+
if [ "x$1" = x ] ; then
12+
echo "Usage: $0 /pnetcdf/install/path"
13+
exit 1
14+
fi
15+
16+
installation_path=$1
17+
18+
# check if folder installation_path exists
19+
if [ ! -d $installation_path ]; then
20+
echo "Error: folder $installation_path cannot be found"
21+
exit 1
22+
fi
23+
24+
# remove trailing '/' character
25+
installation_path=$(realpath -s $installation_path)
26+
27+
# check if pnetcdf_version exists in the install folder
28+
if [ ! -x $installation_path/bin/pnetcdf_version ]; then
29+
echo "Error: pnetcdf_version not found in $installation_path/bin"
30+
exit 1
31+
fi
32+
33+
# check if pnetcdf.pc exists in the install folder
34+
if [ ! -f $installation_path/lib/pkgconfig/pnetcdf.pc ]; then
35+
echo "Error: pnetcdf.pc not found in $installation_path/lib/pkgconfig"
36+
exit 1
37+
fi
38+
39+
# check if pnetcdf-config exists in the install folder
40+
if [ ! -x $installation_path/bin/pnetcdf-config ]; then
41+
echo "Error: pnetcdf-config not found in $installation_path/bin"
42+
exit 1
43+
else
44+
# check if --prefix is correctly reflecting the install path
45+
prefixdir=`$installation_path/bin/pnetcdf-config --prefix`
46+
if [ $prefixdir != $installation_path ] ; then
47+
echo "Error: expecting '$installation_path' from 'pnetcdf-config --prefix' but got $prefixdir"
48+
exit 1
49+
fi
50+
# check if --libdir is correctly reflecting the install path
51+
libdir=`$installation_path/bin/pnetcdf-config --libdir`
52+
if [ $libdir != $installation_path/lib ] ; then
53+
echo "Error: expecting '$installation_path/lib' from 'pnetcdf-config --libdir' but got $libdir"
54+
exit 1
55+
fi
56+
# check if --includedir is correctly reflecting the install path
57+
incdir=`$installation_path/bin/pnetcdf-config --includedir`
58+
if [ $incdir != $installation_path/include ] ; then
59+
echo "Error: expecting '$installation_path/include' from 'pnetcdf-config --includedir' but got $incdir"
60+
exit 1
61+
fi
62+
fi
63+

0 commit comments

Comments
 (0)