|
From: <kin...@us...> - 2025-09-08 23:29:08
|
Revision: 7372
http://sourceforge.net/p/teem/code/7372
Author: kindlmann
Date: 2025-09-08 23:29:06 +0000 (Mon, 08 Sep 2025)
Log Message:
-----------
may have finally figured out issue with RPATH on repeated make install: just remove old bins and libs before installing them. Testing framework slowly coming back to life; old testDataPath.h.in out of service but remembers contributions
Modified Paths:
--------------
teem/trunk/CMakeLists-v2.txt
teem/trunk/tests/ctest/CMakeLists.txt
teem/trunk/tests/ctest/air/CMakeLists.txt
teem/trunk/tests/ctest/air/amath.c
teem/trunk/tests/ctest/air/miscAir.c
teem/trunk/tests/ctest/air/mtrand.c
teem/trunk/tests/ctest/air/pptest.c
teem/trunk/tests/ctest/air/string.c
teem/trunk/tests/ctest/air/strtok.c
teem/trunk/tests/ctest/testDataPath.h.in
teem/trunk/tests/ctest/testutil.c
Modified: teem/trunk/CMakeLists-v2.txt
===================================================================
--- teem/trunk/CMakeLists-v2.txt 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/CMakeLists-v2.txt 2025-09-08 23:29:06 UTC (rev 7372)
@@ -19,7 +19,7 @@
# along with this library; if not, see <https://www.gnu.org/licenses/>.
#
-# Teem/CMakeLists.txt Version 10.92
+# Teem/CMakeLists.txt Version 10.94
# This CMakeLists.txt describes a Teem package that contains:
# (1) a library ("libteem" on unix) and
@@ -33,7 +33,7 @@
# development, but there's no reason to complicate this CMakeLists.txt with describing
# those smaller libraries and their inter-dependencies.
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Project setup: version, metadata, and language
# CMake Version 3.25 came out November 16, 2022
@@ -64,12 +64,12 @@
")
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Include helpers and module paths
# include(CTest) will create the BUILD_TESTING option, turn it ON, hook into CTest, and
# in turn include(CTestConfig.cmake). Most of which is fine, but we want to turn
-# BUILD_TESTING OFF and give a better description
+# BUILD_TESTING OFF by default and give a better description
set(BUILD_TESTING OFF CACHE BOOL "Build Teem's *meagre* ctests")
include(CTest)
@@ -81,7 +81,7 @@
# CMake modules path (for e.g. FindLEVMAR.cmake)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Project options, including choosing dependencies
# - canonical list of optional dependencies
# - option() flags for enabling/disabling them
@@ -124,59 +124,40 @@
option(Teem_BUILD_HEX_UTILS "Build stand-alone raw<-->hex decoder/encoder" OFF)
option(Teem_INSTALL_VERSIONED_PREFIX "Install bin/,lib/,include/ in install/Teem-X.Y.Z subdir" OFF)
-###-----------------------------------------------------------------------------
-# RPATH taming
+###-------------------------------------------------------------------------------------
+# RPATH configuration
-if(UNIX AND NOT APPLE)
- # Linux, BSD, etc.
- if(BUILD_SHARED_LIBS)
- # Executables in bin/ will find libs in ../lib
- set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
+# Earlier versions of this tried to do clever things so that "make install; make install"
+# would not generate errors (on Mac) like:
+# install_name_tool: for: <bin> (for architecture arm64) option
+# "-add_rpath @loader_path/../lib" would duplicate path, file already has LC_RPATH ...
+# But it is just too fussy and becomes too complicated. So instead, see comment later
+# below about "clean out old installed RPATH-aware files" in installdir/{bin,lib}:
+# we just erase those files first as part of "make install"
- # Let CMake add additional transitive dependency paths
- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
- # Separate build-tree vs install-tree RPATHs
- set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-
- set(CMAKE_SKIP_BUILD_RPATH FALSE)
- set(CMAKE_SKIP_INSTALL_RPATH FALSE)
- else()
- # Static build: no RPATH needed
- set(CMAKE_SKIP_BUILD_RPATH TRUE)
- set(CMAKE_SKIP_INSTALL_RPATH TRUE)
+if(BUILD_SHARED_LIBS)
+ # set(CMAKE_SKIP_RPATH FALSE) # "This is the default unless you explicitly set it TRUE somewhere else. You can drop it"
+ if(APPLE)
+ # Enable MacOS RPATH support
+ set(CMAKE_MACOSX_RPATH ON)
endif()
-elseif(APPLE)
- set(CMAKE_MACOSX_RPATH ON)
- if(BUILD_SHARED_LIBS)
- # Build artifacts already contain the desired *install* RPATH,
- # so the install step won't need to patch anything.
- set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
- # For Teem’s own executables (in bin) to find Teem’s dylibs (in lib)
- # in the *installed* tree. In the Teem build tree this usually also works
- # because the relative layout is the same.
- # HEY build bin fail, but install bin ok + ok post mv installdir
+ # - - - - - - - - - - - - -
+ # Install-tree settings
+ #
+ # Executables and libraries after 'make install' should be relocatable:
+ # - libraries go in install/lib
+ # - tools in install/bin use @loader_path/../lib (Mac) or $ORIGIN/../lib (Linux)
+ set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) # Avoid adding system paths
+ if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
- # With this, both build bin works and install bin works, but can't move installdir
- #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
- # Make the install step idempotent: do not try to re-edit LC_RPATH.
- # set(CMAKE_SKIP_INSTALL_RPATH TRUE) # HEY with this, nothing has an RPATH!
- set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-
- # Do not strip build-tree RPATH (we’re *using* the install rpath in the build tree)
- set(CMAKE_SKIP_BUILD_RPATH FALSE)
-
- else()
- # Static build: no RPATH needed
- set(CMAKE_SKIP_BUILD_RPATH TRUE)
- set(CMAKE_SKIP_INSTALL_RPATH TRUE)
+ elseif(UNIX)
+ set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()
endif()
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Dependency discovery
# - normalize names/targets/FOUND vars
# - run find_package() for requested DEPs
@@ -232,7 +213,7 @@
#get_target_property(_png_libs PNG::PNG INTERFACE_LINK_LIBRARIES)
#message(STATUS "PNG::PNG links to: ${_png_libs}")
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Describe install directory layout with variables:
# HEADERS_INSTALL_DIR, LIB_INSTALL_DIR, BIN_INSTALL_DIR, CONFIG_INSTALL_DIR
# which are paths to the different things relative to the install prefix
@@ -254,7 +235,7 @@
# so that BIN_INSTALL_DIR can be seen by src/bin/CMakeLists.txt
set(BIN_INSTALL_DIR "${BIN_INSTALL_DIR}" CACHE INTERNAL "Install dir for binaries")
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Configure-time test: does AIR_EXISTS() work like isfinite()?
# A lot of work for one little macro (which GLK started using before the functionally
@@ -355,8 +336,8 @@
endif()
# AIR_EXISTS_MACRO_FAILS is used indirectly, below, by configure_file(airExistsConf.h)
-###-----------------------------------------------------------------------------
-# Describe the Teem library
+###-------------------------------------------------------------------------------------
+# Describe the (monolithic) Teem library
add_library(Teem "")
@@ -442,8 +423,8 @@
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
)
-###-----------------------------------------------------------------------------
-# Collect sources from Teem's component libraries
+###-------------------------------------------------------------------------------------
+# Collect sources from Teem's component libraries (to make single Teem library)
# Each component library will append its public headers to global property
# "Teem_HEADER_FILES". For clarity, we initialize it to empty string now.
@@ -517,7 +498,7 @@
message(STATUS "Teem INTERFACE_COMPILE_DEFINITIONS: ${teem_inter_compdefs}")
endif()
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Declare Teem's public headers
# Set *variable* _Teem_headers from previously set *property* Teem_HEADER_FILES
@@ -562,12 +543,37 @@
FILES ${_Teem_headers_full} # the list of header files
)
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Describe Teem's command-line executables (e.g. "unu")
+# Only on Mac with shared libraries: clean out old installed RPATH-aware files before
+# installing new ones, because getting the RPATH stuff to be set correctly after the
+# first "make install", but *not* modified after a second "make install", is just too
+# annoying to figure out. This hack has to *precede* any other install() commands, which
+# is why this shows up here, before src/bin/CMakeLists.txt's teem_add_executable() can
+# call install()
+if(BUILD_SHARED_LIBS)
+ if(APPLE)
+ install(CODE "
+ file(GLOB old_bins \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/*\")
+ file(GLOB old_libs \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/*\")
+ if(old_bins OR old_libs)
+ message(STATUS \"Removing prior \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/{bin,lib}/* rather than attempt RPATH surgery\")
+ endif()
+ if(old_bins)
+ file(REMOVE \${old_bins})
+ endif()
+ if(old_libs)
+ file(REMOVE \${old_libs})
+ endif()
+ ")
+ endif()
+endif()
+
+# Describe all the command-line tools (unu and friends)
add_subdirectory(src/bin)
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Optional helper tools (hex/dehex)
# If requested, helper dehex/exhex programs
@@ -575,7 +581,7 @@
add_subdirectory(src/hex)
endif()
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Testing via CTest
# Note: these tests are very incomplete. It is unclear how much of Teem's future
# development will hinge on CTest-based testing, now that the Python/CFFI bindings
@@ -585,7 +591,7 @@
add_subdirectory(tests/ctest)
endif()
-###-----------------------------------------------------------------------------
+###-------------------------------------------------------------------------------------
# Install rules
# Declare how Teem should be installed, and hang all this off the "TeemTargets" export
@@ -601,14 +607,14 @@
include(CMakePackageConfigHelpers)
-# Generate TeemConfig.cmake from template CMake/TeemConfig.cmake.in
+# Generate TeemConfig.cmake from template CMake/TeemConfig.cmake.in.
# We have to do some work to teach Teem to pull in its own dependencies.
-# First build up list of find_dependency() calls for TeemConfig.cmake:
+# First, build up list of find_dependency() calls for TeemConfig.cmake:
set(_Teem_find_deps "")
foreach(_tdep IN LISTS _Teem_DEPS)
if(Teem_USE_${_tdep})
if(NOT _Teem_find_deps)
- # before first dependency we have to say what find_dependency() means
+ # before first dependency, we have to say how to find_dependency()
string(APPEND _Teem_find_deps "include(CMakeFindDependencyMacro)\n")
endif()
# Map to CMake package name
Modified: teem/trunk/tests/ctest/CMakeLists.txt
===================================================================
--- teem/trunk/tests/ctest/CMakeLists.txt 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/CMakeLists.txt 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,68 +1,111 @@
+# tests/ctest/CMakeLists.txt: Test driver for Teem's CTest-based tests
+# Copyright (C) 2025 University of Chicago
+# See ../../LICENSE.txt for licensing terms
#
-# Teem: Tools to process and visualize scientific data and images
-# Copyright (C) 2009--2025 University of Chicago
-# Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
-# Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+# Note: these tests are very incomplete. It is unclear how much of Teem's future
+# development will hinge on CTest-based testing, now that the Python/CFFI bindings
+# offer a more convenient way to call into Teem. But to use them (from top-level):
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# (LGPL) as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# The terms of redistributing and/or modifying this software also
-# include exceptions to the LGPL that facilitate static linking.
+# # for running tests locally
+# cmake -S . -B <builddir> -DBUILD_TESTING=ON
+# cmake --build <builddir>
+# cd <builddir>
+# ctest # run all tests
+# ctest -V # verbose
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <https://www.gnu.org/licenses/>.
+# # for submitting dashboard
+# cd build
+# ctest -D Nightly # or Experimental, Continuous
+
+###-------------------------------------------------------------------------------------
+# Basic set-up
+
+message(STATUS "Setting up testing")
+
+# Make sure tests can see headers generated by the build system
+include_directories(${CMAKE_BINARY_DIR}/include)
+
+# Create a small *static* "testutil" library from testutil.{c,h}
+add_library(teem_testutil STATIC testutil.c)
+target_include_directories(teem_testutil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(teem_testutil PRIVATE Teem)
+
+###-------------------------------------------------------------------------------------
+# Two helper functions for creating and describing tests:
+# teem_create_test_executable: creates the executable test program
+# teem_add_test: uses the executable to declare a new test
+
+# teem_create_test_executable(<target> <src> [USE_TMPDIR]):
+# From test program source file <src> create executable, hereafter referred to as
+# <target>. If USE_TMPDIR, then create a tmp directory "<target>_tmp" that the test can
+# use for writing files. Attach the necessary environment variables to the target, to be
+# re-used by teem_add_test. It makes more sense to "attach" the tmp dir to the target
+# than to the test, because needing and using tmp dir is more directly a consequence of
+# the source code of the test program, than the circumstances of how the test executable
+# is run.
#
+function(teem_create_test_executable target src)
+ set(options USE_TMPDIR)
+ # this sets TCTE_USE_TMPDIR if "USE_TMPDIR" was passed
+ cmake_parse_arguments(TCTE "${options}" "" "" ${ARGN})
-project(TEEMTesting)
+ add_executable(${target} ${src})
+ target_link_libraries(${target} PRIVATE Teem teem_testutil)
-# Create a header file with the path to the data in it. Note that we don't
-# have to make these paths "windows friendly" as it turns out windows can read
-# forward slashed paths.
-set(TESTING_DATA_PATH "${CMAKE_SOURCE_DIR}/data" CACHE PATH
- "Path to testing data")
-mark_as_advanced(TESTING_DATA_PATH)
+ # Always store the data dir for later
+ set_property(TARGET ${target} PROPERTY TEEM_TEST_DATA_DIR "${CMAKE_SOURCE_DIR}/data")
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/testDataPath.h.in"
- "${CMAKE_BINARY_DIR}/include/testDataPath.h"
+ # Optionally create a tmpdir and remember it
+ if(TCTE_USE_TMPDIR)
+ set(tmpdir "${CMAKE_CURRENT_BINARY_DIR}/${target}_tmp")
+ file(MAKE_DIRECTORY "${tmpdir}")
+ set_property(TARGET ${target} PROPERTY TEEM_TEST_TMP_DIR "${tmpdir}")
+ endif()
+endfunction()
+
+# teem_add_test(<target> [NAME <name>] [ARGS <args>...])
+# This creates the CTest test via add_test() around the <target> created by
+# teem_create_test_executable above. The NAME option, if used, creates a name for the
+# test different than ${target} The ARGS option says how to run it on the command-line.
+#
+function(teem_add_test target)
+ set(options) # no boolean options to parse
+ set(oneValueArgs NAME)
+ set(multiValueArgs ARGS)
+ # this sets TAT_NAME to argument after "NAME" (if any),
+ # and TAT_ARGS to list of args after "ARGS" (if any).
+ cmake_parse_arguments(TAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(NOT TARGET ${target})
+ message(FATAL_ERROR "teem_add_test: target ${target} not found")
+ endif()
+
+ # Compute test name
+ if(TAT_NAME)
+ set(test_name "${TAT_NAME}")
+ else()
+ set(test_name "${target}")
+ endif()
+
+ # Get stored metadata from the target
+ get_property(data_dir TARGET ${target} PROPERTY TEEM_TEST_DATA_DIR)
+ get_property(tmp_dir TARGET ${target} PROPERTY TEEM_TEST_TMP_DIR)
+
+ # Build up environment string
+ set(env_list "TEEM_TEST_DATA_DIR=${data_dir}")
+ if(tmp_dir)
+ list(APPEND env_list "TEEM_TEST_TMP_DIR=${tmp_dir}")
+ endif()
+
+ # Register the test
+ add_test(NAME ${test_name} COMMAND ${target} ${TAT_ARGS})
+ set_tests_properties(${test_name} PROPERTIES
+ ENVIRONMENT "${env_list}"
)
+endfunction()
-# nrrdSanity the executable is no longer (as of Teem v2) built;
-# so this is being removed. Lots of tests will immediately fail
-# if nrrdSanity() (the function) fails.
-## This just runs nrrdSanity as test called "nrrd.Sanity"
-## We don't do the same for airSanity because that's an
-## "experimental app" . . .
-# add_test(NAME nrrd.Sanity COMMAND $<TARGET_FILE:nrrdSanity>)
-
-# Hope to eventually have tests in all directories; until then
-# many of these are commented out. (TEEM_LIB_LIST)
+###-------------------------------------------------------------------------------------
+# The Tests!
+#
+# These are the component libraries that have tests; more added as time permits
add_subdirectory(air)
-# add_subdirectory(hest)
-add_subdirectory(biff)
-add_subdirectory(nrrd)
-# add_subdirectory(ell)
-# add_subdirectory(moss)
-add_subdirectory(unrrdu)
-# add_subdirectory(alan)
-# add_subdirectory(tijk)
-add_subdirectory(gage)
-# add_subdirectory(dye)
-# add_subdirectory(bane)
-# add_subdirectory(limn)
-# add_subdirectory(echo)
-# add_subdirectory(hoover)
-# add_subdirectory(seek)
-add_subdirectory(ten)
-# add_subdirectory(elf)
-# add_subdirectory(pull)
-# add_subdirectory(coil)
-# add_subdirectory(push)
-# add_subdirectory(mite)
-add_subdirectory(meet)
Modified: teem/trunk/tests/ctest/air/CMakeLists.txt
===================================================================
--- teem/trunk/tests/ctest/air/CMakeLists.txt 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/CMakeLists.txt 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,44 +1,18 @@
-#
-# Teem: Tools to process and visualize scientific data and images
-# Copyright (C) 2009--2019 University of Chicago
-# Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
-# Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# (LGPL) as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# The terms of redistributing and/or modifying this software also
-# include exceptions to the LGPL that facilitate static linking.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <https://www.gnu.org/licenses/>.
-#
-add_executable(test_miscAir miscAir.c)
-target_link_libraries(test_miscAir teem)
-add_test(NAME misc COMMAND $<TARGET_FILE:test_miscAir>)
+teem_create_test_executable(test_miscAir miscAir.c)
+teem_add_test(test_miscAir)
-add_executable(test_mtrand mtrand.c)
-target_link_libraries(test_mtrand teem)
-add_test(NAME mtrand COMMAND $<TARGET_FILE:test_mtrand>)
+teem_create_test_executable(test_mtrand mtrand.c)
+teem_add_test(test_mtrand)
-add_executable(test_amath amath.c)
-target_link_libraries(test_amath teem)
-add_test(NAME amath COMMAND $<TARGET_FILE:test_amath>)
+teem_create_test_executable(test_amath amath.c)
+teem_add_test(test_amath)
-add_executable(test_string string.c)
-target_link_libraries(test_string teem)
-add_test(NAME string COMMAND $<TARGET_FILE:test_string>)
+teem_create_test_executable(test_string string.c)
+teem_add_test(test_string)
-add_executable(test_strtok strtok.c)
-target_link_libraries(test_strtok teem)
-add_test(NAME strtok COMMAND $<TARGET_FILE:test_strtok>)
+teem_create_test_executable(test_strtok strtok.c)
+teem_add_test(test_strtok)
-add_executable(test_pptest pptest.c)
-target_link_libraries(test_pptest teem)
-add_test(NAME pptest COMMAND $<TARGET_FILE:test_pptest>)
+teem_create_test_executable(test_pptest pptest.c)
+teem_add_test(test_pptest)
Modified: teem/trunk/tests/ctest/air/amath.c
===================================================================
--- teem/trunk/tests/ctest/air/amath.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/amath.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,25 +1,23 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
-#include "teem/air.h"
+#include <teem/air.h>
/*
** Tests:
Modified: teem/trunk/tests/ctest/air/miscAir.c
===================================================================
--- teem/trunk/tests/ctest/air/miscAir.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/miscAir.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,25 +1,23 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
-#include "teem/air.h"
+#include <teem/air.h>
/*
** to test:
Modified: teem/trunk/tests/ctest/air/mtrand.c
===================================================================
--- teem/trunk/tests/ctest/air/mtrand.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/mtrand.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,27 +1,24 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
+#include <teem/air.h>
-#include "teem/air.h"
-
/*
** Tests:
** airRandMTStateNew
@@ -39,28 +36,27 @@
airArray *mop;
airRandMTState *rng;
const char *me;
- unsigned int rval[NUM][NUM] = {
- {2357136044u, 2546248239u, 3071714933u, 3626093760u, 2588848963u,
- 3684848379u, 2340255427u, 3638918503u, 1819583497u, 2678185683u},
- {1608637542u, 3421126067u, 4083286876u, 787846414u, 3143890026u,
- 3348747335u, 2571218620u, 2563451924u, 670094950u, 1914837113u},
- {197744554u, 2405527281u, 1590178649u, 2055114040u, 1040749045u,
- 1355459964u, 2699301070u, 1591340141u, 4252490304u, 3121394926u},
- {451710822u, 4140706415u, 550374602u, 880776961u, 375407235u,
- 576831824u, 495976644u, 1350392909u, 3211465673u, 1227650870u},
- {2567526101u, 397661439u, 2237017401u, 316000557u, 1060138423u,
- 2802111455u, 1449535759u, 751581949u, 3635455645u, 658021748u},
- {429171210u, 2009581671u, 1300722668u, 3858470021u, 3363216262u,
- 1963629412u, 2166299591u, 229689286u, 484002369u, 2062223911u},
- {23250075u, 3670330222u, 1860540774u, 4216169317u, 1062279565u,
- 2886996639u, 2197431119u, 3112004045u, 3229777453u, 1632140913u},
- {2869147098u, 1558248213u, 585501645u, 3600180646u, 2654279825u,
- 3658135664u, 287832047u, 912891514u, 2926707351u, 937957965u},
- {1891499427u, 1885608988u, 3850740167u, 3832766153u, 2073041664u,
- 3289176644u, 989474400u, 2841420218u, 4096852366u, 1816963771u},
- {2552602868u, 2086504389u, 219288614u, 3347214808u, 215326247u,
- 3609464630u, 3506494207u, 997691580u, 1726903302u, 3302470737u}
- };
+ unsigned int rval[NUM][NUM]
+ = {{2357136044u, 2546248239u, 3071714933u, 3626093760u, 2588848963u, 3684848379u,
+ 2340255427u, 3638918503u, 1819583497u, 2678185683u},
+ {1608637542u, 3421126067u, 4083286876u, 787846414u, 3143890026u, 3348747335u,
+ 2571218620u, 2563451924u, 670094950u, 1914837113u},
+ {197744554u, 2405527281u, 1590178649u, 2055114040u, 1040749045u, 1355459964u,
+ 2699301070u, 1591340141u, 4252490304u, 3121394926u},
+ {451710822u, 4140706415u, 550374602u, 880776961u, 375407235u, 576831824u,
+ 495976644u, 1350392909u, 3211465673u, 1227650870u},
+ {2567526101u, 397661439u, 2237017401u, 316000557u, 1060138423u, 2802111455u,
+ 1449535759u, 751581949u, 3635455645u, 658021748u},
+ {429171210u, 2009581671u, 1300722668u, 3858470021u, 3363216262u, 1963629412u,
+ 2166299591u, 229689286u, 484002369u, 2062223911u},
+ {23250075u, 3670330222u, 1860540774u, 4216169317u, 1062279565u, 2886996639u,
+ 2197431119u, 3112004045u, 3229777453u, 1632140913u},
+ {2869147098u, 1558248213u, 585501645u, 3600180646u, 2654279825u, 3658135664u,
+ 287832047u, 912891514u, 2926707351u, 937957965u},
+ {1891499427u, 1885608988u, 3850740167u, 3832766153u, 2073041664u, 3289176644u,
+ 989474400u, 2841420218u, 4096852366u, 1816963771u},
+ {2552602868u, 2086504389u, 219288614u, 3347214808u, 215326247u, 3609464630u,
+ 3506494207u, 997691580u, 1726903302u, 3302470737u}};
unsigned int ii, jj, rr;
AIR_UNUSED(argc);
@@ -69,13 +65,12 @@
mop = airMopNew();
rng = airRandMTStateNew(0);
airMopAdd(mop, rng, (airMopper)airRandMTStateNix, airMopAlways);
- for (jj=0; jj<NUM; jj++) {
- airSrandMT_r(rng, 42*jj);
- for (ii=0; ii<NUM; ii++) {
+ for (jj = 0; jj < NUM; jj++) {
+ airSrandMT_r(rng, 42 * jj);
+ for (ii = 0; ii < NUM; ii++) {
rr = airUIrandMT_r(rng);
if (rval[jj][ii] != rr) {
- fprintf(stderr, "%s: rval[%u][%u] %u != %u\n",
- me, jj, ii, rval[jj][ii], rr);
+ fprintf(stderr, "%s: rval[%u][%u] %u != %u\n", me, jj, ii, rval[jj][ii], rr);
airMopError(mop);
exit(1);
}
@@ -85,6 +80,3 @@
airMopOkay(mop);
exit(0);
}
-
-
-
Modified: teem/trunk/tests/ctest/air/pptest.c
===================================================================
--- teem/trunk/tests/ctest/air/pptest.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/pptest.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,25 +1,23 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
-#include "teem/air.h"
+#include <teem/air.h>
/*
** Tests:
Modified: teem/trunk/tests/ctest/air/string.c
===================================================================
--- teem/trunk/tests/ctest/air/string.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/string.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,27 +1,24 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
+#include <teem/air.h>
-#include "teem/air.h"
-
/*
** Tests:
** airStrlen
@@ -33,13 +30,23 @@
*/
/* random test strings */
-#define STR_A1 "The facts of life: To make an alteration in the evolvement of an organic life system is fatal. A coding sequence cannot be revised once it's been established."
-#define STR_A2 "Because by the second day of incubation, any cells that have undergone reversion mutations give rise to revertant colonies like rats leaving a sinking ship; then the ship sinks."
+#define STR_A1 \
+ "The facts of life: To make an alteration in the evolvement of an organic life " \
+ "system is fatal. A coding sequence cannot be revised once it's been established."
+#define STR_A2 \
+ "Because by the second day of incubation, any cells that have undergone reversion " \
+ "mutations give rise to revertant colonies like rats leaving a sinking ship; then " \
+ "the ship sinks."
#define STR_A (STR_A1 " " STR_A2)
-
-#define STR_B1 "We've already tried it. Ethyl methane sulfonate is an alkylating agent and a potent mutagen. It created a virus so lethal the subject was dead before he left the table."
-#define STR_B2 "Wouldn't obstruct replication, but it does give rise to an error in replication so that the newly formed DNA strand carries a mutation and you've got a virus again. But this - all of this is academic. You were made as well as we could make you."
+#define STR_B1 \
+ "We've already tried it. Ethyl methane sulfonate is an alkylating agent and a " \
+ "potent mutagen. It created a virus so lethal the subject was dead before he left " \
+ "the table."
+#define STR_B2 \
+ "Wouldn't obstruct replication, but it does give rise to an error in replication so " \
+ "that the newly formed DNA strand carries a mutation and you've got a virus again. " \
+ "But this - all of this is academic. You were made as well as we could make you."
#define STR_B (STR_B1 " " STR_B2)
#define STR_AB (STR_A " " STR_B)
@@ -86,12 +93,11 @@
aa = airStrdup(STR_A);
airMopAdd(mop, aa, airFree, airMopAlways);
if (strcmp(aa, STR_A)) {
- fprintf(stderr, "%s: airStrdup failure: |%s| != |%s|\n", me,
- aa, STR_A);
+ fprintf(stderr, "%s: airStrdup failure: |%s| != |%s|\n", me, aa, STR_A);
airMopError(mop);
exit(1);
}
- aaSize = strlen(aa)+1;
+ aaSize = strlen(aa) + 1;
aaCopy = AIR_CALLOC(aaSize, char);
airMopAdd(mop, aaCopy, airFree, airMopAlways);
@@ -100,13 +106,12 @@
airMopAdd(mop, ab, airFree, airMopAlways);
sprintf(ab, "%s %s", STR_A, STR_B);
-#define TEST(COPY, COMP) \
- airStrcpy(aaCopy, aaSize, COPY); \
- if (strcmp(aaCopy, COMP)) { \
- fprintf(stderr, "%s: airStrcpy failure: |%s| != |%s|\n", \
- me, aaCopy, COMP); \
- airMopError(mop); \
- exit(1); \
+#define TEST(COPY, COMP) \
+ airStrcpy(aaCopy, aaSize, COPY); \
+ if (strcmp(aaCopy, COMP)) { \
+ fprintf(stderr, "%s: airStrcpy failure: |%s| != |%s|\n", me, aaCopy, COMP); \
+ airMopError(mop); \
+ exit(1); \
}
/* different args (to copy) to airStrcpy */
Modified: teem/trunk/tests/ctest/air/strtok.c
===================================================================
--- teem/trunk/tests/ctest/air/strtok.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/air/strtok.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -1,25 +1,23 @@
/*
Teem: Tools to process and visualize scientific data and images
- Copyright (C) 2009--2019 University of Chicago
- Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
- Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
+ Copyright (C) 2009--2025 University of Chicago
+ Copyright (C) 2005--2008 Gordon Kindlmann
+ Copyright (C) 1998--2004 University of Utah
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- (LGPL) as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- The terms of redistributing and/or modifying this software also
- include exceptions to the LGPL that facilitate static linking.
+ This library is free software; you can redistribute it and/or modify it under the terms
+ of the GNU Lesser General Public License (LGPL) as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your option) any later version.
+ The terms of redistributing and/or modifying this software also include exceptions to
+ the LGPL that facilitate static linking.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
-#include "teem/air.h"
+#include <teem/air.h>
/*
** Tests:
Modified: teem/trunk/tests/ctest/testDataPath.h.in
===================================================================
--- teem/trunk/tests/ctest/testDataPath.h.in 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/testDataPath.h.in 2025-09-08 23:29:06 UTC (rev 7372)
@@ -26,6 +26,15 @@
#include <string.h>
#include <teem/air.h>
+// #warning only became standard in C23:
+// https://en.cppreference.com/w/c/preprocessor/warning.html
+#warning "With the new Teem v2 testing framework, this file is not needed anymore;"
+#warning "the location of data is now communicated at run-time via environment"
+#warning "variables, rather than at configure- and compile-time via a header file."
+#warning "But the file is sticking around for now out of gratitude to James Bigler"
+#warning "who first got this working :)"
+#error "testDataPath.h no longer used"
+
/*
** testDataPathPrefix allocates and returns a string which is
** the given "base" prefixed with the path to the test datasets,
Modified: teem/trunk/tests/ctest/testutil.c
===================================================================
--- teem/trunk/tests/ctest/testutil.c 2025-09-08 17:37:13 UTC (rev 7371)
+++ teem/trunk/tests/ctest/testutil.c 2025-09-08 23:29:06 UTC (rev 7372)
@@ -9,6 +9,11 @@
#include "testutil.h"
+/* Names of the environment variables that communicate the data and tmp directories.
+ HEY: have to keep in sync with CMakeLists.txt in this same directory */
+#define DATA_DIR_ENVVAR "TEEM_TEST_DATA_DIR"
+#define TMP_DIR_ENVVAR "TEEM_TEST_TMP_DIR"
+
// prependEnvVar(envVar, fName) returns a *newly-allocated* string concatenating
// the value of environment variable `envVar`, '/', and `fName`
static char *
@@ -45,13 +50,13 @@
// for test data filename `fName`, this returns a new-allocated path to it
char *
teemTestDataPath(const char *fName) {
- return prependEnvVar("TEEM_TEST_DATA_DIR", fName);
+ return prependEnvVar(DATA_DIR_ENVVAR, fName);
}
// for temporary file name `fName`, this returns a new-allocated path to it
char *
teemTestTmpPath(const char *fName) {
- return prependEnvVar("TEEM_TEST_TMP_DIR", fName);
+ return prependEnvVar(TMP_DIR_ENVVAR, fName);
}
/* (for testing)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|