-
Notifications
You must be signed in to change notification settings - Fork 289
Description
Bug Report: run_reclaim_tests.sh fails when utilities are disabled
Summary
unit_test/run_reclaim_tests.sh fails with a non-zero exit code when netCDF-C is
configured with --disable-utilities. The test unconditionally invokes ${NCGEN}
and ${NCDUMP}, which are not built when utilities are disabled, causing the test
to fail immediately.
Affected file
unit_test/run_reclaim_tests.sh
Steps to reproduce
autoreconf -if
./configure --enable-hdf5 --disable-utilities
make -j4
make checkThe test suite will report:
FAIL: run_reclaim_tests.sh
Root cause
run_reclaim_tests.sh requires both ncgen and ncdump:
${NCGEN} -4 ${srcdir}/reclaim_tests.cdl # line 9
${execdir}/tst_reclaim > reclaim_tests.txt # line 10
...
${NCDUMP} reclaim_tests.nc > reclaim_tests.dmp # line 15
diff -b reclaim_tests.dmp ${srcdir}/reclaim_tests.baseline # line 16When --disable-utilities is passed to configure, ncgen and ncdump are not
built. The ${NCGEN} and ${NCDUMP} variables resolve to empty or missing paths,
and the script fails immediately.
The test is registered unconditionally under USE_HDF5 in unit_test/Makefile.am:
if USE_HDF5
check_PROGRAMS += tst_nc4internal tst_reclaim
TESTS += tst_nc4internal
TESTS += run_reclaim_tests.sh
endif # USE_HDF5There is no guard for ENABLE_UTILITIES or equivalent.
Expected behavior
run_reclaim_tests.sh should be skipped (reported as SKIP, not FAIL) when
--disable-utilities is in effect, since the test cannot run without ncgen
and ncdump.
Proposed fix
In unit_test/Makefile.am, guard the test registration behind both USE_HDF5
and BUILD_UTILITIES (or equivalent automake conditional):
if USE_HDF5
check_PROGRAMS += tst_nc4internal tst_reclaim
TESTS += tst_nc4internal
if BUILD_UTILITIES
TESTS += run_reclaim_tests.sh
endif # BUILD_UTILITIES
endif # USE_HDF5Alternatively, add a guard at the top of run_reclaim_tests.sh that checks
whether ncgen and ncdump are available and exits with code 77 (automake
SKIP) if they are not:
if ! command -v "${NCGEN}" > /dev/null 2>&1; then
echo "ncgen not available, skipping test"
exit 77
fi
if ! command -v "${NCDUMP}" > /dev/null 2>&1; then
echo "ncdump not available, skipping test"
exit 77
fiExit code 77 is the automake convention for a skipped test.
Context
This bug was discovered while running the netCDF-C test suite on a big-endian
s390x platform via QEMU emulation in GitHub Actions CI. The CI workflow uses
--disable-utilities to avoid building utility binaries that trigger GCC
internal compiler errors under QEMU emulation. The run_reclaim_tests.sh
failure is the only remaining test failure in that environment once utilities
are disabled.