mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
90fd1406bc
Re: GH Issue https://github.com/Unidata/netcdf-c/issues/1900 Apparently the clock_gettime() function is not always available. It is used in unit_test/tst_exhash.c and unit_test/tst_xcache.c. To solve this, a number of things were changed: * Move the timing code to a new file unit_tests/timer_utils.[ch] * Modify the timing code to choose one of several timing methods depending on availability. The prioritized order is as follows: 1. If Windows, use the QueryPerformanceCounter mechanism else 2. Use clock_gettime if available else 3. Use gettimeofday if available else 4. Use getrusage if available Note that the resolution of 3 and 4 is less than 1 or 2. Misc. Other Changes: * Move the test in CMakeLists.txt that disables unit tests for WIN32 to unit_test/CMakeLists.txt since some unit tests actually work under Visual Studio. * Fix some of the unit tests to work under visual studio * Fix problem with using remove() in zmap_nzf.c * Remove some warning about use of EXTERNL
32 lines
955 B
CMake
32 lines
955 B
CMake
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
|
# 2015, 2016, 2017, 2018, 2019
|
|
# University Corporation for Atmospheric Research/Unidata.
|
|
|
|
# See netcdf-c/COPYRIGHT file for more info.
|
|
|
|
# This is the cmake build file for unit_test/ directory.
|
|
# @author Ward Fisher
|
|
|
|
# Currently (August 21, 2019): Some tests will not work with
|
|
# Visual Studio. The unit tests are for internal netCDF functions,
|
|
# so we don't want to make them external, which would be required to
|
|
# run on Windows.
|
|
|
|
SET(UNIT_TESTS test_ncuri test_pathcvt)
|
|
|
|
IF(NOT MSVC)
|
|
IF(ENABLE_NETCDF_4)
|
|
SET(UNIT_TESTS ${UNIT_TESTS} tst_nclist tst_nc4internal)
|
|
ENDIF(ENABLE_NETCDF_4)
|
|
ENDIF(NOT MSVC)
|
|
|
|
FOREACH(CTEST ${UNIT_TESTS})
|
|
add_bin_test(unit_test ${CTEST})
|
|
ENDFOREACH()
|
|
|
|
# Performance tests
|
|
add_bin_test(unit_test tst_exhash timer_utils.c)
|
|
add_bin_test(unit_test tst_xcache timer_utils.c)
|
|
|