netcdf-c/test_cmake.sh

140 lines
2.9 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Unit tests for cmake. This script checks to see if CMake runs properly,
# and if the code compiles properly (if CMake runs properly).
#
2012-07-21 01:39:24 +08:00
#set -x
DOBUILD="NO"
DOCLEAN="NO"
if [ $# -gt 0 ]; then
while getopts "bhc" Option; do
case $Option in
b ) DOBUILD="YES";;
c ) DOCLEAN="YES";;
2012-07-21 03:43:17 +08:00
* ) echo "Usage: $0 [-h|-b|-c]"; echo -e "-h:\tShow Help\n-b:\tExecute build checks.\n-c:\tClean directory between checks.";exit;
2012-07-21 01:39:24 +08:00
esac
done
fi
echo -e "\nRunning Tests:"
echo -e "\tBuilding after cmake:\t$DOBUILD"
echo -e "\tClean between builds:\t$DOCLEAN"
echo ""
BDIR="build_test"
LOGFILE="../build_test_output.txt"
echo `date` > $LOGFILE
2012-07-21 03:17:33 +08:00
BLDTYPE=""
if [ `uname -a | cut -d" " -f 1` = "MINGW32_NT-6.1" ]; then
2012-07-21 03:43:17 +08:00
BLDTYPE="WIN"
2012-07-21 03:17:33 +08:00
fi
2012-07-21 03:17:33 +08:00
BUILDTYPE='-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=ON'
HDF5OPS='-DUSE_HDF5=OFF -DUSE_HDF5=ON'
DAPOPS='-DBUILD_DAP=OFF -DBUILD_DAP=ON'
DISKLESSOPS='-DBUILD_DISKLESS=OFF -DBUILD_DISKLESS=ON'
2012-07-25 06:53:58 +08:00
CDMROPS='-DENABLE_CDMREMOTE=OFF -DENABLE_CDMREMOTE=ON'
2012-07-21 01:39:24 +08:00
2012-07-24 03:40:08 +08:00
DOXOPS='-DENABLE_DOXYGEN=OFF -DENABLE_DOXYGEN=ON'
INTOPS='-DENABLE_INTERNAL_DOCS=OFF -DENABLE_INTERNAL_DOCS=ON'
FSYOPS='-DUSE_FSYNC=OFF -DUSE_FSYNC=ON'
VALOPS='-DVALGRIND_TESTS=OFF -DVALGRIND_TESTS=ON'
NC4OPS='-DENABLE_NETCDF_4=OFF -DENABLE_NETCDF_4=ON'
2012-07-21 01:39:24 +08:00
# Track configs which configurations fail.
CMAKEFAILS=""
BUILDFAILS=""
#mkdir -p $BDIR
#cd $BDIR
2012-07-21 01:39:24 +08:00
cmake_success=0
cmake_fail=0
build_success=0
build_fail=0
for BT in $BUILDTYPE; do
2012-07-21 01:39:24 +08:00
for HOPS in $HDF5OPS; do
for DOPS in $DAPOPS; do
for DIOPS in $DISKLESSOPS; do
2012-07-25 06:53:58 +08:00
for COPS in $CDMROPS; do
#for DOXS in $DOXOPS; do
#for IOPS in $INTOPS; do
#for FOPS in $FSYOPS; do
#for VLOPS in $VALOPS; do
#for N4OPS in $NC4OPS; do
CUROPS="$BT $HOPS $DOPS $DIOPS $MMAPOPS $COPS"
2012-07-21 01:39:24 +08:00
echo "Options: $CUROPS"
2012-07-21 03:43:17 +08:00
if [ x$BLDTYPE = "xWIN" ]; then
cmake $CUROPS .. -G"MSYS Makefiles" >> $LOGFILE
else
cmake $CUROPS .. >> $LOGFILE
fi
2012-07-21 01:39:24 +08:00
if [ $? -eq 0 ]; then
RET="PASS"
((cmake_success++))
else
RET="FAIL ($?)"
CMAKEFAILS="$CMAKEFAILS\n$CUROPS"
((cmake_fail++))
fi
echo "CMake: $RET"
RET=""
if [ x$DOBUILD = "xYES" ]; then
2012-08-04 06:24:29 +08:00
make -j >> $LOGFILE
if [ $? -eq 0 ]; then
RET="PASS"
2012-07-21 01:39:24 +08:00
((build_success++))
else
RET="FAIL ($?)"
2012-07-21 01:39:24 +08:00
((build_fail++))
BUILDFAILS="$BUILDFAILS\n$CUROPS"
fi
2012-07-21 01:39:24 +08:00
echo "Build: $RET"
make clean
fi
RET=""
echo ""
#Clean up
if [ x$DOCLEAN = "xYES" ]; then
rm -rf *
fi
2012-07-25 06:53:58 +08:00
#done
#done
#done
#done
#done
2012-07-24 03:40:08 +08:00
done
done
done
done
done
2012-07-21 01:39:24 +08:00
echo -e "CMake:\tSuccess: $cmake_success\tFail: $cmake_fail"
if [ $cmake_fail -gt 0 ]; then
echo -e "CMake Fails:$CMAKEFAILS\n\n"
fi
if [ x$DOBUILD = "xYES" ]; then
echo -e "Build:\tSuccess: $build_success\tFail: $build_fail"
if [ $build_fail -gt 0 ]; then
echo -e "Build Fails:$BUILDFAILS"
fi
fi
echo ""
echo ""