Skip to content

Commit

Permalink
Merge pull request #2628 from WardF/gh2627.wif
Browse files Browse the repository at this point in the history
Unit Testing, Performance Testing infrastructure options.
  • Loading branch information
WardF committed Feb 17, 2023
2 parents 678f632 + 49c71a5 commit bb81ab3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,14 @@ IF(ENABLE_TESTS)
# Option to turn on unit testing. See
# https://github.com/Unidata/netcdf-c/pull/1472 for more information.
###
OPTION(ENABLE_UNIT_TESTS "Run Unit Tests." OFF)
OPTION(ENABLE_UNIT_TESTS "Run Unit Tests." ON)

###
# Option to turn on performance testing.
# See https://github.com/Unidata/netcdf-c/issues/2627 for more information.
###
OPTION(ENABLE_BENCHMARKS "Run benchmark Tests." OFF)


###
# End known-failures.
Expand Down Expand Up @@ -2364,6 +2371,9 @@ IF(ENABLE_TESTS)
IF(ENABLE_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF()
IF(ENABLE_BENCHMARKS)
ADD_SUBDIRECTORY(nc_perf)
ENDIF(ENABLE_BENCHMARKS)
IF(ENABLE_UNIT_TESTS)
ADD_SUBDIRECTORY(unit_test)
ENDIF(ENABLE_UNIT_TESTS)
Expand Down Expand Up @@ -2604,6 +2614,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURREN
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/plugins/findplugin.sh @ONLY NEWLINE_STYLE LF)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/examples/C/findplugin.sh @ONLY NEWLINE_STYLE LF)

IF(ENABLE_BENCHMARKS)
IF(ENABLE_PARALLEL4)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nc_perf/run_par_bm_test.sh.in ${CMAKE_CURRENT_BINARY_DIR}/nc_perf/run_par_bm_test.sh @ONLY NEWLINE_STYLE LF)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nc_perf/run_gfs_test.sh.in ${CMAKE_CURRENT_BINARY_DIR}/nc_perf/run_gfs_test.sh @ONLY NEWLINE_STYLE LF)
ENDIF(ENABLE_PARALLEL4)
ENDIF(ENABLE_BENCHMARKS)

IF(ENABLE_TESTS)
#####
# Build ncdap_test|dap4_test/findtestserver[4].c
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ fi

# Does the user want to turn off unit tests (useful for test coverage
# analysis).
AC_MSG_CHECKING([if unit tests should be disabled])
AC_MSG_CHECKING([if unit tests should be enabled])
AC_ARG_ENABLE([unit-tests],
[AS_HELP_STRING([--disable-unit-tests],
[AS_HELP_STRING([--enable-unit-tests],
[Disable tests in unit_test directory. Other tests still run.])])
test "x$enable_unit_tests" = xno || enable_unit_tests=yes
AC_MSG_RESULT($enable_unit_tests)
AM_CONDITIONAL([BUILD_UNIT_TESTS], [test "x$enable_unit_tests" = xyes])
AM_CONDITIONAL(BUILD_UNIT_TESTS, [test "x$enable_unit_tests" = xyes])

# Does the user require dynamic loading?
# This is only for those hdf5 installs that support it.
Expand Down
14 changes: 9 additions & 5 deletions nc_perf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ add_bin_test(nc_perf tst_files3 tst_utils.c)
add_bin_test(nc_perf tst_mem tst_utils.c)
add_bin_test(nc_perf tst_wrf_reads tst_utils.c)
add_bin_test(nc_perf tst_attsperf tst_utils.c)
add_bin_test(nc_perf tst_bm_rando tst_utils.c)
add_bin_test(nc_perf tst_compress tst_utils.c)

add_sh_test(nc_perf run_knmi_bm)
#add_sh_test(nc_perf run_knmi_bm)
add_sh_test(nc_perf perftest)
add_sh_test(nc_perf run_tst_chunks)
add_sh_test(nc_perf run_bm_elena)
Expand All @@ -36,9 +38,11 @@ add_sh_test(nc_perf run_bm_test2)

# This will run a parallel I/O benchmark for parallel builds.
IF(TEST_PARALLEL4)
add_bin_test(nc_perf tst_compress_par tst_utils.c)
add_sh_test(nc_perf run_par_bm_test)
ENDIF()
ENDIF()
ENDIF(TEST_PARALLEL4)
ENDIF(BUILD_UTILITIES)

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

ADD_EXTRA_DIST(run_par_bm_test.sh.in run_knmi_bm.sh CMakeLists.txt
perftest.sh run_bm_test1.sh run_bm_test2.sh)
Empty file modified nc_perf/run_gfs_test.sh.in
100644 → 100755
Empty file.
Empty file modified nc_perf/run_par_bm_test.sh.in
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion nc_perf/tst_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <string.h>
#include <math.h>
#include <netcdf.h>
#include <netcdf_par.h>
#include <netcdf_meta.h>

#define TEST_NAME "tst_compress"
Expand Down

0 comments on commit bb81ab3

Please sign in to comment.