diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 091b932e6..3c9725cd0 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -30,8 +30,8 @@ jobs: name: macOS Intel # For a reason I don't entirely understand, with this build, some of the expr-tests fail.exclude: # Investigate on a clean OSX M4 machine. jhrg 4/2/26 - #- os: macos-15 - # name: macOS arm64 + - os: macos-15 + name: macOS arm64 name: ${{ matrix.name }} runs-on: ${{ matrix.os }} env: @@ -72,13 +72,15 @@ jobs: if: runner.os == 'macOS' env: HOMEBREW_NO_AUTO_UPDATE: "1" + # I was installing libtirpc but that causes XDRStreamMarshaller and XDRFileUnMarshaller + # to fail on the OSX/ARM64 build. jhrg 4/6/26 run: | brew install \ bison \ ccache \ cppunit \ flex \ - libtirpc + autoconf - name: Configure macOS build environment if: runner.os == 'macOS' diff --git a/.vscode/jhrg/c_cpp_properties.json b/.vscode/jhrg/c_cpp_properties.json new file mode 100644 index 000000000..43096cab0 --- /dev/null +++ b/.vscode/jhrg/c_cpp_properties.json @@ -0,0 +1,28 @@ +{ + "version": 4, + "configurations": [ + { + "name": "macOS", + "compilerPath": "/usr/bin/clang++", + "cStandard": "c11", + "cppStandard": "c++14", + "intelliSenseMode": "macos-clang-arm64", + "compileCommands": "${workspaceFolder}/compile_commands.json", + "includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/**", + "/Users/jhrg/src/hyrax/build/include", + "/Users/jhrg/src/hyrax/build/deps/include", + "/opt/homebrew/include/cppunit" + ], + "defines": [], + "macFrameworkPath": [ + "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" + ], + "browse": { + "path": ["${workspaceFolder}", "${workspaceFolder}/**"], + "limitSymbolsToIncludedHeaders": true + } + } + ] +} diff --git a/AGENTS.md b/AGENTS.md index 43c546363..cf9bb4299 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,9 @@ These instructions apply to the entire `libdap4` repository. - Prefer autotools for day-to-day work unless the task is explicitly CMake-focused. - Keep both autotools and CMake build paths healthy when changing shared build logic. +- For all the builds the 'prefix' environment variable should be set. +- $prefix is the full path to the 'build' directory in the directory above 'libdap4'. +- The PATH env var should have $prefix/bin and $prefix/deps/bin prepended. ## Autotools Workflow (preferred) diff --git a/CMakePresets.json b/CMakePresets.json index 415880b89..0814d68cd 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,7 +15,7 @@ "CMAKE_CXX_STANDARD": "14", "CMAKE_CXX_STANDARD_REQUIRED": "ON", "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_INSTALL_PREFIX": "$prefix", + "CMAKE_INSTALL_PREFIX": "$env{prefix}", "BUILD_TESTING": "ON", "USE_CPP_11_REGEX": "ON", "USE_ASAN": "OFF", diff --git a/config.h.cmake b/config.h.cmake index e8695d25c..b2d609372 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -54,7 +54,7 @@ /* Client version number */ #define CVER "@LIBDAP_VERSION@" /* Client name and version combined */ -#define DVR "@PROJECT_NAME@/LIBDAP_VERSION@" +#define DVR "@PROJECT_NAME@/@LIBDAP_VERSION@" /* Install prefix for libdap */ #define LIBDAP_ROOT "@LIBDAP_ROOT@" diff --git a/docs/AGENTS.md b/docs/AGENTS.md deleted file mode 100644 index 43c546363..000000000 --- a/docs/AGENTS.md +++ /dev/null @@ -1,109 +0,0 @@ -# AGENTS.md - -## Scope - -These instructions apply to the entire `libdap4` repository. - -## Project Context - -- `libdap4` is a legacy C++ implementation of DAP2/DAP4 with long-lived downstream consumers. -- Prioritize compatibility, behavioral stability, and small, reviewable diffs. -- Prefer minimal, targeted changes over broad refactors. - -## Primary Build Systems - -- Prefer autotools for day-to-day work unless the task is explicitly CMake-focused. -- Keep both autotools and CMake build paths healthy when changing shared build logic. - -## Autotools Workflow (preferred) - -For a fresh git checkout: - -```sh -autoreconf --force --install --verbose -./configure --prefix=$prefix --enable-developer -make -j -make -j check -``` - -For release-tarball style builds: - -```sh -./configure -make -j -make -j check -``` - -Notes: - -- Check that the environment variable 'prefix' is defined before running any command that uses it. -- Use `--prefix=` when installation path matters. -- Use `TESTSUITEFLAGS=-j` with `make check` when parallelizing tests. -- If `make check` fails due to missing `config.guess`, link `conf/config.guess` into `tests/` per `tests/README`. - -## CMake Workflow (supported) - -- Presets are defined in `CMakePresets.json`. -- Common presets: `default`, `debug`, `developer`, `asan`. - -Typical flow: - -```sh -cmake --preset developer -cmake --build --preset developer -j -ctest --preset developer --output-on-failure -``` - -## Testing Expectations - -- For code changes, run focused tests in affected areas first, then broader suites when risk is higher. -- Autotools default: `make -j check` -- CMake default: `ctest --preset default` (or `developer` for debug/developer builds) -- Unit/integration labels are available through CMake test presets (`unit`, `int`). -- If tests are flaky or expected-fail in legacy areas, call that out explicitly in your summary. - -## Documentation And Doxygen - -- Doxygen docs are built with: - -```sh -make docs -``` - -- Inputs are `doxy.conf` and `main_page.doxygen` (generated from `.in` templates by configure). -- When updating doc config/templates, keep generated and template files consistent with the chosen build workflow. - -## Legacy C++ Constraints - -- Match local style in touched files; do not perform unrelated formatting sweeps. -- Avoid API/ABI-impacting changes unless explicitly requested. -- Be conservative with ownership/lifetime changes in pointer-heavy code. -- Parser/scanner sources are generated (`*.tab.cc`, `*.tab.hh`, `lex.*.cc`); edit `*.yy`/`*.lex` sources, not generated outputs, unless the task explicitly requires generated-file updates. - -## Tooling And Quality - -- `clang-format` and pre-commit are configured (`README.pre-commit.md`, `.pre-commit-config.yaml`). -- Prefer running formatting/hooks only on changed files relevant to the task. -- Address sanitizer is supported (`--enable-asan` in autotools, `asan` preset in CMake) for memory-safety debugging. - -## Change Discipline - -- Do not revert unrelated local changes in a dirty worktree. -- Keep edits tightly scoped to the request. -- If you encounter unexpected repository changes during work, stop and ask how to proceed. -- Do not run destructive git commands unless explicitly requested. - -## Review Priorities - -When asked to review: - -1. Behavioral regressions in protocol/data-model behavior -2. Memory/resource safety and ownership lifetime issues -3. Parser/serialization correctness and edge cases -4. Build-system regressions (autotools and CMake) -5. Missing or weak regression coverage - -## Communication - -- State assumptions and environment details explicitly (build system, preset/configure flags, test scope). -- If full validation is not run, say exactly what was run and what was not. diff --git a/docs/cmake-autotest-integration-plan.md b/docs/cmake-autotest-integration-plan.md new file mode 100644 index 000000000..b1b6efd30 --- /dev/null +++ b/docs/cmake-autotest-integration-plan.md @@ -0,0 +1,169 @@ +# CMake Autotest Integration Plan + +Note: running the tests this was save ~1,000 lines of cmake code and requires +no change to the existing autotest tests. jhrg 4/4/26 + +## Goal + +Support CMake builds that run the existing autotools/autotest-based integration +tests while keeping the current CMake CppUnit tests intact. + +## Scope + +- Keep the existing CMake CppUnit tests. +- Modify the CMake test setup so it runs the autotest suites: + - `DASTest` + - `DDSTest` + - `EXPRTest` + - `DMRTest` + - `getdapTest` +- Add a minimal `tests/configure.ac` used only to configure the autotools test + machinery. + +## Plan + +1. Audit the current CMake integration test modules and identify which + generated/autotest inputs they duplicate from `tests/Makefile.am` + (`DASTest.at`, `DDSTest.at`, `EXPRTest.at`, `DMRTest.at`, `getdapTest.at`, + `atlocal.in`, `package.m4`). +2. Add a minimal `tests/configure.ac` dedicated to the autotest suites, with + only the package metadata and substitutions needed to generate `atconfig`, + `atlocal`, and `package.m4` for the test scripts. +3. Add CMake support in `tests/CMakeLists.txt` to find autotools tools + (`autoconf`, `autom4te`, and `autoheader` if needed), configure the new + test-only `configure.ac`, and generate the autotest driver scripts in the + CMake build tree from the existing `*.at` files. +4. Replace the current CMake per-test includes + (`das-tests.cmake`, `dds-tests.cmake`, `expr-tests.cmake`, + `dmr-tests.cmake`, `getdap-tests.cmake`) with a thinner registration layer + that adds one CTest test per autotest suite and invokes `DASTest`, + `DDSTest`, `EXPRTest`, `DMRTest`, and `getdapTest` with `TESTSUITEFLAGS`. +5. Make the generated autotest environment point at the CMake-built executables + (`das-test`, `dds-test`, `expr-test`, `dmr-test`, `getdap`) so the existing + autotest cases run unchanged against the CMake artifacts. +6. Preserve existing CMake CppUnit coverage and labels, and add sensible + dependencies plus serial/parallel behavior for the autotest suite wrappers + so `ctest` and the top-level `integration-test` and `check` targets + continue to work. +7. Fold the integration-test build artifacts into the default CMake `ALL` + target so `cmake --build --preset ` builds both the unit-test and + integration-test executables plus the generated autotest suite drivers, + without changing when tests are executed. +8. Remove the now-unused hand-maintained CMake integration modules and any + supporting `tests/CMakeLists.txt` logic that existed only for that older + path. +9. Validate with a focused CMake configure/build plus `ctest` over the + integration label, then note any suites that still depend on autotools-era + assumptions such as generated `package.m4`, working directory layout, or + network access in `getdapTest`. + +## Step 1 Audit + +The current CMake integration layer in `tests/CMakeLists.txt` and +`tests/cmake/*.cmake` does not generate or invoke the autotest suites from +`tests/Makefile.am`. Instead, it re-expresses parts of those suites directly as +CTest registrations and shell snippets. + +| Autotest input from `tests/Makefile.am` | Current CMake duplication | Notes | +| --------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DASTest.at` | `tests/cmake/das-tests.cmake` | Partial duplication. CMake discovers `das-testsuite/*.das` with `file(GLOB ...)`, runs `das-test -p`, diffs against `*.base`, and stages baselines. This overlaps the `_AT_DAS_TEST` and `AT_DAS_RESPONSE_TEST` logic, but CMake derives the case list from the filesystem instead of the explicit autotest manifest. | +| `DDSTest.at` | `tests/cmake/dds-tests.cmake` | Partial duplication. CMake discovers `dds-testsuite/*.dds`, runs `dds-test -p`, diffs against `*.base`, and stages baselines. This overlaps `_AT_DDS_TEST` and `AT_DDS_RESPONSE_TEST`, including the `xpass` cases for `test.24.dds`, `test.25.dds`, and `test.26.dds`, but not the autotest `--baselines` option. | +| `EXPRTest.at` | `tests/cmake/expr-tests.cmake` | Substantial manual duplication. The CMake file enumerates the same expression and error cases one by one, recreates the `-w`/`-W` and `-bw`/`-bW` pairings, and duplicates the stdout/stderr combination behavior that the autotest macros implement. | +| `DMRTest.at` | `tests/cmake/dmr-tests.cmake` | Substantial manual duplication. CMake reimplements large parts of the autotest macros with custom functions for parse, intern, translation, and CE/function cases, including byte-order-aware baseline selection and checksum filtering for universal baselines. | +| `getdapTest.at` | `tests/cmake/getdap-tests.cmake` | Direct duplication for the single current case. CMake registers the same `getdap -d http://test.opendap.org/dap/data/nc/fnoc1.nc` check and baseline diff, plus a CMake-only baseline staging target. | +| `atlocal.in` | None | Not duplicated today. The autotest-only `WORD_ORDER=@ac_word_order@` substitution is still provided only by autotools. CMake computes byte order independently inside `tests/cmake/dmr-tests.cmake` instead of generating `atlocal`. | +| `package.m4` | None | Not duplicated today. `tests/Makefile.am` generates this from top-level package metadata, but the current CMake test flow never generates or consumes it because it does not invoke `autom4te` on the `*.at` files. | + +### Audit summary + +- `das-tests.cmake`, `dds-tests.cmake`, and `getdap-tests.cmake` are thin + CTest rewrites of their corresponding autotest suites. +- `expr-tests.cmake` and `dmr-tests.cmake` are larger hand-maintained ports of + the autotest case matrices and macro behavior. +- The current CMake path does not use the autotest support files from + `tests/Makefile.am`; there is no CMake-generated `atconfig`, `atlocal`, or + `package.m4`. +- Step 2 should therefore add only the minimum autotools metadata needed to + generate those support files and reuse the existing `*.at` sources instead of + extending the current hand-ported CMake test definitions. + +## Main Risks + +- The autotest scripts assume autotools-generated files like `atconfig`, + `atlocal`, and `package.m4`. +- Some suites may assume a specific working directory layout under `tests/`. +- `getdapTest` depends on network access and should stay clearly labeled as an + integration test. + +## Implementation Status + +Steps 2 through 9 are now implemented in the CMake build: + +- `tests/configure.ac` provides a minimal autotest-only configure input that + computes `ac_word_order` and configures `atlocal` plus `package.m4`. +- `tests/CMakeLists.txt` now finds `autoconf` and `autom4te`, generates the + autotest support files in the CMake test build tree, and builds the + `DASTest`, `DDSTest`, `EXPRTest`, `DMRTest`, and `getdapTest` drivers from + the existing `*.at` sources. +- The `tests` custom target is now part of the default `ALL` target, so a + plain `cmake --build --preset ` also builds the integration-test + executables and generated autotest suite drivers. +- The old hand-maintained per-case CMake integration modules have been removed, + along with the unused `tests/CMakeLists.txt` setup that supported that older + path; the CMake path now registers one CTest test per autotest suite. +- The suite wrappers are labeled under `integration` and run serially at the + CTest layer. Any desired intra-suite parallelism should be passed through + `TESTSUITEFLAGS`, matching the autotools `make check` model. +- The top-level CMake `integration-test` and `check` targets continue to work + through the existing `tests` target dependency chain, while CMake CppUnit + coverage and unit-test labels remain unchanged. + +## Step 9 Validation + +Validation was run with the repository-style environment: + +```sh +prefix=/Users/jimg/src/opendap/hyrax/build +PATH=$prefix/bin:$prefix/deps/bin:$PATH +``` + +Focused CMake validation used: + +```sh +cmake -S . -B /tmp/libdap4-cmake-autotest-build-prefix \ + -DCMAKE_INSTALL_PREFIX=$prefix -DBUILD_DEVELOPER=ON +cmake --build /tmp/libdap4-cmake-autotest-build-prefix -j2 +ctest --test-dir /tmp/libdap4-cmake-autotest-build-prefix \ + --output-on-failure -L integration +``` + +During the default build, CMake generated `tests/configure`, `atlocal`, +`package.m4`, and the `DASTest`, `DDSTest`, `EXPRTest`, `DMRTest`, and +`getdapTest` autotest driver scripts without requiring an explicit +`--target tests`. + +Observed suite results: + +- `DASTest`: passed +- `DDSTest`: passed +- `DMRTest`: passed +- `EXPRTest`: failed +- `getdapTest`: failed + +Current autotools-era assumptions or runtime issues still exposed by the CMake +path: + +- `EXPRTest` runs successfully as an autotest suite, but on this machine many + `expr-test -w ...` cases fail while the matching `-W` cases pass. This now + appears to be a runtime/behavior difference in `expr-test`, not a missing + CMake/autotest integration input. +- `getdapTest` still depends on network access and also hit a local HTTP cache + locking failure in `HTTPCache.cc`, followed by a segmentation fault in + `getdap`. This is likewise a runtime issue surfaced by the suite, not a + driver-generation problem. +- The generated suites expect to run from the CMake `tests/` build directory so + that autotest can create its `*.dir` work areas relative to the configured + `atconfig`/`atlocal` files. +- `package.m4` is required by `autom4te` for all five suites and is now being + generated in the CMake build tree rather than assumed from the autotools + build. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b5b2143fb..47c296b81 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,6 @@ -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +find_program(AUTOCONF_EXECUTABLE autoconf REQUIRED) +find_program(AUTOM4TE_EXECUTABLE autom4te REQUIRED) add_library(test-types STATIC TestArray.cc TestD4Sequence.cc TestInt32.cc TestTypeFactory.cc @@ -35,17 +36,24 @@ install(TARGETS test-types ARCHIVE DESTINATION lib INCLUDES DESTINATION include/libdap/test) -set(TEST_HEADERS - TestD4Enum.h TestGrid.h TestStructure.h TestD4Group.h - TestInt16.h TestTypeFactory.h TestD4Opaque.h TestInt32.h - TestUInt16.h TestD4Sequence.h TestInt64.h TestUInt32.h - TestArray.h TestFloat32.h TestInt8.h TestUInt64.h - TestByte.h TestFloat64.h TestSequence.h TestUrl.h - TestCommon.h TestFunction.h TestStr.h - D4TestFunction.h D4TestTypeFactory.h) +# This is an alternative to the set(VAR ...) and install(FILES ...) pattern +# I used in the top-level CMakeLists file. It will install every header here +# which makes it more robust when files change/move but also easier to install +# something that should be private. 6/27/25 jhrg +file(GLOB TEST_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -install(FILES ${TEST_HEADERS} - DESTINATION include/libdap/test) +# TODO Remove dead code +# set(TEST_HEADERS +# TestD4Enum.h TestGrid.h TestStructure.h TestD4Group.h +# TestInt16.h TestTypeFactory.h TestD4Opaque.h TestInt32.h +# TestUInt16.h TestD4Sequence.h TestInt64.h TestUInt32.h +# TestArray.h TestFloat32.h TestInt8.h TestUInt64.h +# TestByte.h TestFloat64.h TestSequence.h TestUrl.h +# TestCommon.h TestFunction.h TestStr.h +# D4TestFunction.h D4TestTypeFactory.h) + +# install(FILES ${TEST_HEADERS} +# DESTINATION include/libdap/test) add_executable(das-test das-test.cc) target_link_libraries(das-test PRIVATE test-types dapserver dap) @@ -81,19 +89,98 @@ if(TIRPC_FOUND) target_link_libraries(dmr-test PRIVATE ${TIRPC_LIBRARIES}) endif() -## This is me playing around with ways to clean up the stuff left over from -## test runs. 7/14/25 jhrg. -add_custom_target(clean-tests - COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_CURRENT_BINARY_DIR}/*.out" - COMMAND ${CMAKE_COMMAND} -E rm -f "${CMAKE_CURRENT_BINARY_DIR}/*.diff" - COMMAND ${CMAKE_COMMAND} -E rm -f "${CMAKE_CURRENT_BINARY_DIR}/*.bin" - COMMAND ${CMAKE_COMMAND} -E rm -f "${CMAKE_CURRENT_BINARY_DIR}/*.out_univ" - COMMENT "Cleaning up integration tests generated artifacts." +set(TESTS_AUTOCONF_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac") +set(TESTS_CONFIGURE_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/configure") +set(TESTS_ATCONFIG "${CMAKE_CURRENT_BINARY_DIR}/atconfig") +set(TESTS_ATLOCAL "${CMAKE_CURRENT_BINARY_DIR}/atlocal") +set(TESTS_PACKAGE_M4 "${CMAKE_CURRENT_BINARY_DIR}/package.m4") + +add_custom_command( + OUTPUT "${TESTS_CONFIGURE_SCRIPT}" + COMMAND "${AUTOCONF_EXECUTABLE}" "--output=${TESTS_CONFIGURE_SCRIPT}" "${TESTS_AUTOCONF_INPUT}" + DEPENDS "${TESTS_AUTOCONF_INPUT}" + COMMENT "Generating tests/configure from ${TESTS_AUTOCONF_INPUT}" + VERBATIM +) + +add_custom_command( + OUTPUT "${TESTS_ATCONFIG}" "${TESTS_ATLOCAL}" "${TESTS_PACKAGE_M4}" + COMMAND "${TESTS_CONFIGURE_SCRIPT}" "--srcdir=${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS + "${TESTS_CONFIGURE_SCRIPT}" + "${CMAKE_CURRENT_SOURCE_DIR}/atlocal.in" + "${CMAKE_CURRENT_SOURCE_DIR}/package.m4.in" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Configuring autotest support files in ${CMAKE_CURRENT_BINARY_DIR}" + VERBATIM ) -## Setup the tests. -include(das-tests) -include(dds-tests) -include(dmr-tests) -include(getdap-tests) -include(expr-tests) +set(AUTOTEST_SUITES + DASTest + DDSTest + EXPRTest + DMRTest + getdapTest +) + +set(AUTOTEST_GENERATED_SCRIPTS "") + +foreach(autotest_suite IN LISTS AUTOTEST_SUITES) + set(autotest_input "${CMAKE_CURRENT_SOURCE_DIR}/${autotest_suite}.at") + set(autotest_output "${CMAKE_CURRENT_BINARY_DIR}/${autotest_suite}") + + add_custom_command( + OUTPUT "${autotest_output}" + COMMAND + "${AUTOM4TE_EXECUTABLE}" + "--language=autotest" + "-I" "${CMAKE_CURRENT_SOURCE_DIR}" + "-I" "${CMAKE_CURRENT_BINARY_DIR}" + "-o" "${autotest_output}.tmp" + "${autotest_input}" + COMMAND "${CMAKE_COMMAND}" -E rename "${autotest_output}.tmp" "${autotest_output}" + DEPENDS + "${autotest_input}" + "${TESTS_ATCONFIG}" + "${TESTS_ATLOCAL}" + "${TESTS_PACKAGE_M4}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Generating autotest driver ${autotest_suite}" + VERBATIM + ) + + list(APPEND AUTOTEST_GENERATED_SCRIPTS "${autotest_output}") +endforeach() + +add_custom_target(tests ALL + DEPENDS + ${AUTOTEST_GENERATED_SCRIPTS} + das-test + dds-test + expr-test + dmr-test + getdap +) + +function(add_autotest_suite_test suite_name suite_label) + set(suite_script "${CMAKE_CURRENT_BINARY_DIR}/${suite_name}") + + add_test( + NAME ${suite_name} + COMMAND /bin/sh -c "eval \"exec \\\"\$1\\\" \$TESTSUITEFLAGS\"" _ "${suite_script}" + ) + + # Keep the suite wrappers serial at the CTest layer and rely on + # TESTSUITEFLAGS (for example, --jobs=N) for any intra-suite parallelism. + set_tests_properties(${suite_name} PROPERTIES + LABELS "integration;${suite_label}" + RUN_SERIAL TRUE + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) +endfunction() + +add_autotest_suite_test(DASTest das) +add_autotest_suite_test(DDSTest dds) +add_autotest_suite_test(EXPRTest expr) +add_autotest_suite_test(DMRTest dmr) +add_autotest_suite_test(getdapTest getdap) diff --git a/tests/cmake/das-tests.cmake b/tests/cmake/das-tests.cmake deleted file mode 100644 index 310919a9a..000000000 --- a/tests/cmake/das-tests.cmake +++ /dev/null @@ -1,68 +0,0 @@ - -### DAS integration & regression tests. - -file(GLOB DAS_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite" - "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite/*.das") - -# Accumulate all per-test baseline targets into this list. Used to make the -# 'das-baselines' target that rebuilds all of the baselines. -set(_DAS_BASELINE_TARGETS "") - -# Helper to register one DAS‐response test -function(add_das_test das_filename) - # # get "test.1.das" → fullname="test.1.das" - # message(STATUS "testname: ${testname}") - get_filename_component(fullname "${das_filename}" NAME) - # strip just ".das" → raw="test.1" - string(REGEX REPLACE "\\.das$" "" raw "${fullname}") - # sanitize; test.1 → test_1 - string(REGEX REPLACE "[^A-Za-z0-9_]" "_" testname "das_${raw}") - # message(STATUS "testname: ${testname}") - - # Paths - set(input "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite/${das_filename}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite/${das_filename}.base") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - # Put the command that runs the test in a variable so that the exact same command - # can be used with a custom target to build the test baseline. - # - # Assume das_filename has no spaces; no need to quote the variables in the - # shell command, which makes the command more readable. - set(the_test "$ -p < ${input} > ${output} 2>&1") - - # Add the CTest entry. - add_test(NAME ${testname} - COMMAND /bin/sh -c "${the_test}; diff -u -b -B ${baseline} ${output} && rm -f ${output}" - ) - set_tests_properties(${testname} PROPERTIES LABELS "integration;das") - - set(staged_baseline "${CMAKE_CURRENT_BINARY_DIR}/baselines/${das_filename}.base") - set(baseline_tgt "baseline-${testname}") - add_custom_target(${baseline_tgt} - COMMAND ${CMAKE_COMMAND} -E make_directory "$" - COMMAND /bin/sh -c "${the_test}; ${CMAKE_COMMAND} -E copy ${output} ${staged_baseline} && rm -f ${output}" - BYPRODUCTS "${staged_baseline}" - COMMENT "Staging DAS baseline for ${das_filename} → ${staged_baseline}" - VERBATIM - ) - - # Share the target name with the parent scope so we can build an aggregate target - set(_DAS_BASELINE_TARGETS ${_DAS_BASELINE_TARGETS} ${baseline_tgt} PARENT_SCOPE) -endfunction() - -# Register all tests (and per-test baseline targets). -# Use 'make test' or 'make check' to run these. See the top-level CMakeLists file -# for more ways to run the tests. -# -# Use 'make baseline-das_test_1' or 'cmake --build . --target baseline-das_test_1', ... -# build the baselines. Use 'ctest -R das_test_1' to run a single test. -foreach(das_file IN LISTS DAS_FILES) - add_das_test(${das_file}) -endforeach() - -# Aggregate target: regenerate all DAS baselines in one shot. Use -# 'cmake --build . --target das-baselines' for that. -if(_DAS_BASELINE_TARGETS) - add_custom_target(das-baselines DEPENDS ${_DAS_BASELINE_TARGETS}) -endif() diff --git a/tests/cmake/dds-tests.cmake b/tests/cmake/dds-tests.cmake deleted file mode 100644 index 4f102282e..000000000 --- a/tests/cmake/dds-tests.cmake +++ /dev/null @@ -1,71 +0,0 @@ - -### DDS integration & regression tests. - -## I used file() with GLOB to grab all of the files that match *.dds in the -## dds-testsuite subdir. This is simple and eliminates the need to list every -## file, but can inadvertently include files that are not part of the test. -## Listing the files intended, one by one, is better but also tedious and means -## that new tests have to be manually added. 7/8/25 jhrg -file(GLOB DDS_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/dds-testsuite" - "${CMAKE_CURRENT_SOURCE_DIR}/dds-testsuite/*.dds") - -# Accumulate all per-test baseline targets into this list. Used to make the -# 'das-baselines' target that rebuilds all of the baselines. -set(_DDS_BASELINE_TARGETS "") - -## This function will take the name of a DDS file and use it as input to a DDS -## test. There are some tricks here as well. 7/8/25 jhrg -function(add_dds_test dds_filename) - # Here the name of the dds file is morphed into something that will work - # as a cmake name (dots are not allowed in cmake names). 7/8/25 jhrg - get_filename_component(fullname "${dds_filename}" NAME) - string(REGEX REPLACE "\\.dds$" "" raw "${fullname}") - # sanitize; test.1 → test_1 - string(REGEX REPLACE "[^A-Za-z0-9_]" "_" testname "dds_${raw}") - - # Paths - set(input "${CMAKE_CURRENT_SOURCE_DIR}/dds-testsuite/${dds_filename}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/dds-testsuite/${dds_filename}.base") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - set(the_test "$ -p < ${input} > ${output} 2>&1") - - # Add the CTest entry. Here the shell is used so that we can employ redirection. - # The extra double quotes are 'best practice' for cmake, but really not needed here - # because we know that $ and the various variables (e.g. ${input}) - # do not have spaces. The extra backslash characters make it harder to decipher - # what is going on. 7/8/25 jhrg - # ...so removed them. jhrg 12/30/25 - add_test(NAME ${testname} - COMMAND /bin/sh -c "${the_test}; diff -u -b -B ${baseline} ${output} && rm -f ${output}" - ) - # This makes it so we can run just these tests and also makes it easy to run the - # unit tests _before_ the integration tests with a 'check' target. See the top-level - # CMakeLists file. 7/8/25 jhrg - set_tests_properties(${testname} PROPERTIES LABELS "integration;dds") - - set(staged_baseline "${CMAKE_CURRENT_BINARY_DIR}/baselines/${dds_filename}.base") - set(baseline_tgt "baseline-${testname}") - add_custom_target(${baseline_tgt} - COMMAND ${CMAKE_COMMAND} -E make_directory "$" - COMMAND /bin/sh -c "${the_test}; ${CMAKE_COMMAND} -E copy ${output} ${staged_baseline} && rm -f ${output}" - BYPRODUCTS "${staged_baseline}" - COMMENT "Staging DAS baseline for ${das_filename} → ${staged_baseline}" - VERBATIM - ) - - # Share the target name with the parent scope so we can build an aggregate target - set(_DDS_BASELINE_TARGETS ${_DDS_BASELINE_TARGETS} ${baseline_tgt} PARENT_SCOPE) - -endfunction() - -## Iterate over all of the DDS filed and make a cmake/ctest for each one. 7/8/25 jhrg -foreach(dds_file IN LISTS DDS_FILES) - add_dds_test(${dds_file}) -endforeach() - -# Aggregate target: regenerate all DDS baselines in one shot. Use -# 'cmake --build . --target dds-baselines' for that. -if(_DDS_BASELINE_TARGETS) - add_custom_target(dds-baselines DEPENDS ${_DDS_BASELINE_TARGETS}) -endif() diff --git a/tests/cmake/dmr-tests.cmake b/tests/cmake/dmr-tests.cmake deleted file mode 100644 index 20f3852b3..000000000 --- a/tests/cmake/dmr-tests.cmake +++ /dev/null @@ -1,479 +0,0 @@ - -## DMR tests. Unlike the DAS and DDS test, these test enumerate the individual test -## one by one since various tests will use different functions. 7/10/25 jhrg - -function(dmr_parse_ce_test test_number test_input ce test_baseline) - set(testname "dmr_parse_ce_test_${test_number}") - - set(input "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${test_input}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${test_baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - # Add the CTest entry. Here the shell is used so that we can employ redirection. - # The extra double quotes are 'best practice' for cmake, but really not needed here - # because we know that $ and the various variables (e.g. ${input}) - # do not have spaces. The extra backslash characters make it harder to decipher - # what is going on. 7/8/25 jhrg - add_test(NAME ${testname} - COMMAND /bin/sh "-c" - # 1) run das-test, redirect all output into a temp file - # 2) diff that file against the baseline" - "\"$\" -x -p \"${input}\" -c \"${ce}\" > \"${output}\" 2>&1; \ - diff -b -B \"${baseline}\" \"${output}\" && rm -f \"${output}\"" - ) - # This makes it so we can run just these tests and also makes it easy to run the - # unit tests _before_ the integration tests with a 'check' target. See the top-leve - # CMakeLists file. 7/8/25 jhrg - set_tests_properties(${testname} PROPERTIES LABELS "integration;dmr;dmr-parse") -endfunction() - -# DMR parse+CE integration tests, using dmr_parse_ce_test(test_number, test_input, ce, test_baseline) - -dmr_parse_ce_test( 1 test_simple_1.xml "" test_simple_1.xml.baseline) -dmr_parse_ce_test( 2 test_simple_2.xml "" test_simple_2.xml.baseline) -dmr_parse_ce_test( 3 test_simple_3.xml "" test_simple_3.xml.baseline) - -dmr_parse_ce_test( 4 test_simple_3_error_1.xml "" test_simple_3_error_1.xml.baseline) -dmr_parse_ce_test( 5 test_simple_3_error_2.xml "" test_simple_3_error_2.xml.baseline) -dmr_parse_ce_test( 6 test_simple_3_error_3.xml "" test_simple_3_error_3.xml.baseline) - -dmr_parse_ce_test( 7 test_simple_4.xml "" test_simple_4.xml.baseline) -dmr_parse_ce_test( 8 test_simple_5.xml "" test_simple_5.xml.baseline) -dmr_parse_ce_test( 9 test_simple_6.xml "" test_simple_6.xml.baseline) -dmr_parse_ce_test(10 test_simple_7.xml "" test_simple_7.xml.baseline) -dmr_parse_ce_test(11 test_simple_8.xml "" test_simple_8.xml.baseline) -dmr_parse_ce_test(12 test_simple_9.xml "" test_simple_9.xml.baseline) -dmr_parse_ce_test(13 test_simple_9.1.xml "" test_simple_9.1.xml.baseline) -dmr_parse_ce_test(14 test_simple_10.xml "" test_simple_10.xml.baseline) -dmr_parse_ce_test(15 test_enum_grp.xml "" test_enum_grp.xml.baseline) - -dmr_parse_ce_test(16 test_array_1.xml "" test_array_1.xml.baseline) -dmr_parse_ce_test(17 test_array_2.xml "" test_array_2.xml.baseline) -dmr_parse_ce_test(18 test_array_3.xml "" test_array_3.xml.baseline) -dmr_parse_ce_test(19 test_array_4.xml "" test_array_4.xml.baseline) -dmr_parse_ce_test(20 test_array_5.xml "" test_array_5.xml.baseline) -dmr_parse_ce_test(21 test_array_6.xml "" test_array_6.xml.baseline) -dmr_parse_ce_test(22 test_array_7.xml "" test_array_7.xml.baseline) -dmr_parse_ce_test(23 test_array_8.xml "" test_array_8.xml.baseline) -dmr_parse_ce_test(24 test_array_10.xml "" test_array_10.xml.baseline) -dmr_parse_ce_test(25 test_array_11.xml "" test_array_11.xml.baseline) - -dmr_parse_ce_test(26 ignore_foreign_xml_1.xml "" ignore_foreign_xml_1.xml.baseline) -dmr_parse_ce_test(27 ignore_foreign_xml_2.xml "" ignore_foreign_xml_2.xml.baseline) -dmr_parse_ce_test(28 ignore_foreign_xml_3.xml "" ignore_foreign_xml_3.xml.baseline) - -dmr_parse_ce_test(29 test_array_9.xml "" test_array_9.xml.baseline) -dmr_parse_ce_test(30 test_array_12.xml "" test_array_12.xml.baseline) -dmr_parse_ce_test(31 test_array_13.xml "" test_array_13.xml.baseline) -dmr_parse_ce_test(32 test_array_14.xml "" test_array_14.xml.baseline) - -# Test empty Structures. jhrg 1/29/16 -dmr_parse_ce_test(33 test_simple_6.2.xml "" test_simple_6.2.xml.baseline) -dmr_parse_ce_test(34 test_simple_6.3.xml "" test_simple_6.3.xml.baseline) - -# Test DAP CE parse errors - ensure they don't leak the supplied -# CE text into the error message. jhrg 4/15/20 -dmr_parse_ce_test(35 test_simple_1.xml nasty test_simple_1.xml.parse_ce_1) -# This string is 'd1roxd55je=1' (%25 --> '%') -# That is, the % is escaped in this text: %253c --> %3c --> '<' -dmr_parse_ce_test(36 test_simple_1.xml d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1 test_simple_1.xml.parse_ce_2) - -dmr_parse_ce_test(37 test_simple_6.3.xml s.nasty test_simple_6.3.xml.parse_ce_1) -dmr_parse_ce_test(38 test_simple_6.3.xml s.d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1 test_simple_6.3.xml.parse_ce_2) - -dmr_parse_ce_test(39 vol_1_ce_12.xml temp[nasty] vol_1_ce_12.xml.parse_ce_1) -dmr_parse_ce_test(40 vol_1_ce_12.xml temp[d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1] vol_1_ce_12.xml.parse_ce_2) - -# Test reversed array indices -dmr_parse_ce_test(41 test_array_4.xml b[2:1][2:3] test_array_4.xml.error.base) - -if(CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN") - set(word_order "little-endian") -elseif(CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN") - set(word_order "big-endian") -else() - message(WARNING "Unknown byte order for C compiler") -endif() - -function(dmr_intern_test number input baseline) - set(testname "dmr_intern_test_${number}") - - # Paths - set(input "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${input}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${word_order}/${baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - # Add the CTest entry. 7/8/25 jhrg - add_test(NAME ${testname} - COMMAND /bin/sh "-c" - "\"$\" -x -i \"${input}\" > \"${output}\" 2>&1; \ - diff -b -B \"${baseline}\" \"${output}\" && rm -f \"${output}\"" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;dmr;dmr-intern") -endfunction() - -dmr_intern_test( 1 test_simple_1.xml test_simple_1.xml.intern_base) -dmr_intern_test( 2 test_simple_2.xml test_simple_2.xml.intern_base) -dmr_intern_test( 3 test_simple_3.xml test_simple_3.xml.intern_base) -dmr_intern_test( 4 test_simple_4.xml test_simple_4.xml.intern_base) -dmr_intern_test( 5 test_simple_5.xml test_simple_5.xml.intern_base) -dmr_intern_test( 6 test_simple_6.xml test_simple_6.xml.intern_base) -dmr_intern_test( 7 test_simple_7.xml test_simple_7.xml.intern_base) -dmr_intern_test( 8 test_simple_8.xml test_simple_8.xml.intern_base) -dmr_intern_test( 9 test_simple_9.xml test_simple_9.xml.intern_base) -dmr_intern_test(10 test_simple_9.1.xml test_simple_9.1.xml.intern_base) -dmr_intern_test(11 test_simple_10.xml test_simple_10.xml.intern_base) -dmr_intern_test(12 test_enum_grp.xml test_enum_grp.xml.intern_base) - -dmr_intern_test(13 test_array_1.xml test_array_1.xml.intern_base) -dmr_intern_test(14 test_array_2.xml test_array_2.xml.intern_base) -dmr_intern_test(15 test_array_3.xml test_array_3.xml.intern_base) -dmr_intern_test(16 test_array_4.xml test_array_4.xml.intern_base) -dmr_intern_test(17 test_array_5.xml test_array_5.xml.intern_base) -dmr_intern_test(18 test_array_6.xml test_array_6.xml.intern_base) -dmr_intern_test(19 test_array_7.xml test_array_7.xml.intern_base) -dmr_intern_test(20 test_array_8.xml test_array_8.xml.intern_base) -dmr_intern_test(21 test_array_10.xml test_array_10.xml.intern_base) -dmr_intern_test(22 test_array_11.xml test_array_11.xml.intern_base) - -dmr_intern_test(23 test_array_9.xml test_array_9.xml.intern_base) -dmr_intern_test(24 test_array_12.xml test_array_12.xml.intern_base) -dmr_intern_test(25 test_array_13.xml test_array_13.xml.intern_base) -dmr_intern_test(26 test_array_14.xml test_array_14.xml.intern_base) - -dmr_intern_test(27 test_simple_6.2.xml test_simple_6.2.xml.intern_base) -dmr_intern_test(28 test_simple_6.3.xml test_simple_6.3.xml.intern_base) - -## For byte_order == universal, this test removed the information -## and replaces it with nothing (which is different from the trans + ce -## tests which replace the info with 'removed checksum'). 7/12/25 jhrg -## NB: Many tests use "" for either ce or func or both. 7/18/25 jhrg -function(dmr_trans_test number input ce func baseline byte_order) - set(testname "dmr_trans_test_${number}") - - set(input "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${input}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${byte_order}/${baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - # Pure hackery. Fix the baselines someday. If this is called with a - # CE or a function, then the universal tests use 'removed checksum" but - # the simpler tests just used the null string. jhrg 7/18/25 - set(checksum_replacement "") - if(NOT ce STREQUAL "" OR NOT func STREQUAL "") - set(checksum_replacement "removed checksum") - endif() - - add_test(NAME ${testname} - COMMAND /bin/sh "-c" - "\"$\" -Cxt \"${input}\" -c \"${ce}\" -f \"${func}\" > \"${output}\" 2>&1; \ - if test \"${byte_order}\" = \"universal\"; then \ - sed 's@[0-9a-f][0-9a-f]*@${checksum_replacement}@' \"${output}\" > \"${output}_univ\"; \ - mv \"${output}_univ\" \"${output}\"; \ - fi; \ - diff -b -B \"${baseline}\" \"${output}\" && rm -f \"${output}\"" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;dmr;trans") - # set_tests_properties(${testname} PROPERTIES RESOURCE_LOCKS "dmr-trans") - # These are run serially because the dmr-test program uses a temp file to - # store the 'binary data' amd different tests will make those binary data - # files with the same (i.e., conflicting) names. I tied using the - # RESOURCE_LOCKS property, but it was slower and did not stop the collisions. - # 7/12/25 jhrg - # set_tests_properties(${testname} PROPERTIES RUN_SERIAL TRUE) - # dmr-test now uses multi-process safe temp files. jhrg 1/5/26 -endfunction() - -# DMR translation tests → dmr_trans_test(number, input, ce, func, baseline, byte_order) - -dmr_trans_test( 1 test_simple_1.xml "" "" test_simple_1.xml.trans_base ${word_order}) -dmr_trans_test( 2 test_simple_2.xml "" "" test_simple_2.xml.trans_base ${word_order}) -dmr_trans_test( 3 test_simple_3.xml "" "" test_simple_3.xml.trans_base ${word_order}) -dmr_trans_test( 4 test_simple_4.xml "" "" test_simple_4.xml.trans_base ${word_order}) -dmr_trans_test( 5 test_simple_5.xml "" "" test_simple_5.xml.trans_base ${word_order}) -dmr_trans_test( 6 test_simple_6.xml "" "" test_simple_6.xml.trans_base ${word_order}) -dmr_trans_test( 7 test_simple_7.xml "" "" test_simple_7.xml.trans_base ${word_order}) -dmr_trans_test( 8 test_simple_8.xml "" "" test_simple_8.xml.trans_base ${word_order}) -dmr_trans_test( 9 test_simple_9.xml "" "" test_simple_9.xml.trans_base ${word_order}) -dmr_trans_test(10 test_simple_9.1.xml "" "" test_simple_9.1.xml.trans_base ${word_order}) -dmr_trans_test(11 test_simple_10.xml "" "" test_simple_10.xml.trans_base ${word_order}) -dmr_trans_test(12 test_enum_grp.xml "" "" test_enum_grp.xml.trans_base ${word_order}) - -dmr_trans_test(13 test_array_1.xml "" "" test_array_1.xml.trans_base ${word_order}) -dmr_trans_test(14 test_array_2.xml "" "" test_array_2.xml.trans_base ${word_order}) -dmr_trans_test(15 test_array_3.xml "" "" test_array_3.xml.trans_base ${word_order}) -dmr_trans_test(16 test_array_4.xml "" "" test_array_4.xml.trans_base ${word_order}) -dmr_trans_test(17 test_array_5.xml "" "" test_array_5.xml.trans_base ${word_order}) -dmr_trans_test(18 test_array_6.xml "" "" test_array_6.xml.trans_base ${word_order}) -dmr_trans_test(19 test_array_7.xml "" "" test_array_7.xml.trans_base ${word_order}) -dmr_trans_test(20 test_array_8.xml "" "" test_array_8.xml.trans_base ${word_order}) -dmr_trans_test(21 test_array_10.xml "" "" test_array_10.xml.trans_base ${word_order}) -dmr_trans_test(22 test_array_11.xml "" "" test_array_11.xml.trans_base ${word_order}) - -dmr_trans_test(23 test_array_9.xml "" "" test_array_9.xml.trans_base ${word_order}) -dmr_trans_test(24 test_array_12.xml "" "" test_array_12.xml.trans_base ${word_order}) -dmr_trans_test(25 test_array_13.xml "" "" test_array_13.xml.trans_base ${word_order}) -dmr_trans_test(26 test_array_14.xml "" "" test_array_14.xml.trans_base ${word_order}) - -dmr_trans_test(27 test_simple_6.2.xml "" "" test_simple_6.2.xml.trans_base ${word_order}) -dmr_trans_test(28 test_simple_6.3.xml "" "" test_simple_6.3.xml.trans_base ${word_order}) - -# “Universal” runs -dmr_trans_test(29 test_array_9.xml "" "" test_array_9.xml.trans_base "universal" ) -dmr_trans_test(30 test_array_12.xml "" "" test_array_12.xml.trans_base "universal" ) -dmr_trans_test(31 test_array_13.xml "" "" test_array_13.xml.trans_base "universal" ) -dmr_trans_test(32 test_array_14.xml "" "" test_array_14.xml.trans_base "universal" ) -dmr_trans_test(33 test_simple_6.2.xml "" "" test_simple_6.2.xml.trans_base "universal" ) -dmr_trans_test(34 test_simple_6.3.xml "" "" test_simple_6.3.xml.trans_base "universal" ) - -dmr_trans_test(201 root_and_child_group_1.xml "" "" root_and_child_group_1.xml.trans_base "universal" ) -dmr_trans_test(202 root_and_child_group_2.xml "" "" root_and_child_group_2.xml.trans_base "universal" ) - -# Wrapping strings in "" is often not needed in cmake. -# -# I removed them for some of the CEs, but it seems somewhat pointless. Still, -# it's good to know. Any function argument with a ';' needs to be double-quoted. -# jhrg 7/19/25 - -if(${word_order} STREQUAL "little-endian") - dmr_trans_test(35 test_array_3.1.dmr "row;x" "" test_array_3.1.dmr.1.trans_base ${word_order}) - dmr_trans_test(36 test_array_3.1.dmr "row=[2:3];x" "" test_array_3.1.dmr.2.trans_base ${word_order}) - dmr_trans_test(37 test_array_3.1.dmr "row=[2:3];x[0:1]" "" test_array_3.1.dmr.3.trans_base ${word_order}) - dmr_trans_test(38 test_array_3.1.dmr x[0:1] "" test_array_3.1.dmr.4.trans_base ${word_order}) - dmr_trans_test(39 test_array_3.1.dmr x "" test_array_3.1.dmr.5.trans_base ${word_order}) -endif() - -# Test various facets of the CE parser and evaluation engine -dmr_trans_test(40 test_array_4.xml "a" "" test_array_4.xml.1.trans_base ${word_order}) -dmr_trans_test(41 test_array_4.xml "a[][] " "" test_array_4.xml.1.trans_base ${word_order}) -dmr_trans_test(42 test_array_4.xml "/row=[0:1];/col=[3];a" "" test_array_4.xml.3.trans_base ${word_order}) -dmr_trans_test(43 test_array_4.xml "/row=[0:1];/col=[3];a[][] " "" test_array_4.xml.4.trans_base ${word_order}) -dmr_trans_test(44 test_array_4.xml "/row=[0:1];/col=[3];a[][];b[0][];c[0:][0:] " "" test_array_4.xml.5.trans_base ${word_order}) -dmr_trans_test(45 test_array_4.xml "x[][] " "" test_array_4.xml.6.trans_base ${word_order}) -dmr_trans_test(46 test_array_4.xml "/row=[0:1];x[][] " "" test_array_4.xml.7.trans_base ${word_order}) -dmr_trans_test(47 test_array_4.xml "c[2:][2:] " "" test_array_4.xml.8.trans_base ${word_order}) - -dmr_trans_test(48 test_simple_6.xml "s" "" test_simple_6.xml.1.trans_base ${word_order}) -dmr_trans_test(49 test_simple_6.xml "s.i1" "" test_simple_6.xml.2.trans_base ${word_order}) -dmr_trans_test(50 test_simple_6.xml "s.s" "" test_simple_6.xml.3.trans_base ${word_order}) -dmr_trans_test(51 test_simple_6.1.xml "s.inner.i2" "" test_simple_6.1.xml.1.trans_base ${word_order}) - -dmr_trans_test(52 test_simple_6.xml s{i1} "" test_simple_6.xml.2.trans_base ${word_order}) -dmr_trans_test(53 test_simple_6.xml "s{s}" "" test_simple_6.xml.3.trans_base ${word_order}) -dmr_trans_test(54 test_simple_6.1.xml "s{inner.i2}" "" test_simple_6.1.xml.1.trans_base ${word_order}) -dmr_trans_test(55 test_simple_6.1.xml "s{inner{i2}}" "" test_simple_6.1.xml.1.trans_base ${word_order}) - -# test_array_6 -dmr_trans_test(56 test_array_6.xml "a" "" test_array_6.xml.1.trans_base ${word_order}) -dmr_trans_test(57 test_array_6.xml "a[][] " "" test_array_6.xml.1.trans_base ${word_order}) -dmr_trans_test(58 test_array_6.xml "/row=[0:1];a[][] " "" test_array_6.xml.2.trans_base ${word_order}) -dmr_trans_test(59 test_array_6.xml "/row=[0:1];a[][1:2] " "" test_array_6.xml.3.trans_base ${word_order}) - -# test_array_6.2 (Structure with nested CE) -dmr_trans_test(60 test_array_6.2.xml "a" "" test_array_6.2.xml.1.trans_base ${word_order}) -dmr_trans_test(61 test_array_6.2.xml "a{i;j}" "" test_array_6.2.xml.1.trans_base ${word_order}) -dmr_trans_test(62 test_array_6.2.xml "a.i" "" test_array_6.2.xml.2.trans_base ${word_order}) -dmr_trans_test(63 test_array_6.2.xml "a{i}" "" test_array_6.2.xml.2.trans_base ${word_order}) -dmr_trans_test(64 test_array_6.2.xml "a.i[0][1:2] " "" test_array_6.2.xml.3.trans_base ${word_order}) -dmr_trans_test(65 test_array_6.2.xml "a{i[0][1:2]} " "" test_array_6.2.xml.3.trans_base ${word_order}) -dmr_trans_test(66 test_array_6.2.xml "/row=[0:1];a.i[][1:2] " "" test_array_6.2.xml.4.trans_base ${word_order}) -dmr_trans_test(67 test_array_6.2.xml "/row=[0:1];a{i[][1:2]} " "" test_array_6.2.xml.4.trans_base ${word_order}) -dmr_trans_test(68 test_array_6.2.xml "a.j" "" test_array_6.2.xml.5.trans_base ${word_order}) - -# test_array_6.1 (Sequence-of-Structure CE) -dmr_trans_test(69 test_array_6.1.xml "a" "" test_array_6.1.xml.1.trans_base ${word_order}) -dmr_trans_test(70 test_array_6.1.xml "/row=[1:2];a[][0] " "" test_array_6.1.xml.2.trans_base ${word_order}) -dmr_trans_test(71 test_array_6.1.xml "/row=[1:2];a[][0]{i;j} " "" test_array_6.1.xml.2.trans_base ${word_order}) -dmr_trans_test(72 test_array_6.1.xml "row=[1:2];a[][0]{i;j} " "" test_array_6.1.xml.2.trans_base ${word_order}) - -# sequences/arrays -dmr_trans_test(73 test_simple_7.xml "s" "" test_simple_7.xml.1.trans_base ${word_order}) -dmr_trans_test(74 test_simple_7.xml "s{i1;s}" "" test_simple_7.xml.1.trans_base ${word_order}) -dmr_trans_test(75 test_simple_7.xml "s.i1" "" test_simple_7.xml.2.trans_base ${word_order}) -dmr_trans_test(76 test_simple_7.xml "s{i1}" "" test_simple_7.xml.2.trans_base ${word_order}) - -# universal (elided CRC) -dmr_trans_test(77 test_simple_8.xml "outer" "" test_simple_8.xml.1.trans_base "universal") -dmr_trans_test(78 test_simple_8.xml "outer.s.s" "" test_simple_8.xml.2.trans_base "universal") -dmr_trans_test(79 test_simple_8.xml "outer{s{s}}" "" test_simple_8.xml.2.trans_base "universal") - -# back to little-endian patterns -dmr_trans_test(80 test_array_7.xml "s" "" test_array_7.xml.1.trans_base ${word_order}) -dmr_trans_test(81 test_array_7.xml "s{i1;s}" "" test_array_7.xml.1.trans_base ${word_order}) -dmr_trans_test(82 test_array_7.xml "s.i1" "" test_array_7.xml.2.trans_base ${word_order}) -dmr_trans_test(83 test_array_7.xml "s{i1}" "" test_array_7.xml.2.trans_base ${word_order}) -dmr_trans_test(84 test_array_7.xml "s[1] " "" test_array_7.xml.3.trans_base ${word_order}) -dmr_trans_test(85 test_array_7.xml "s[1]{i1;s}" "" test_array_7.xml.3.trans_base ${word_order}) -dmr_trans_test(86 test_array_7.xml "s[1]{i1}" "" test_array_7.xml.4.trans_base ${word_order}) -dmr_trans_test(87 test_array_8.xml "/col=[1:2];s[1][]{i1}" "" test_array_8.xml.1.trans_base ${word_order}) -dmr_trans_test(88 test_array_8.xml "col=[1:2];s[1][]{i1}" "" test_array_8.xml.1.trans_base ${word_order}) - -# sequence‐array of structures CE -dmr_trans_test(89 test_array_7.1.xml "" "" test_array_7.1.xml.1.trans_base ${word_order}) -dmr_trans_test(90 test_array_7.1.xml "s" "" test_array_7.1.xml.1.trans_base ${word_order}) -dmr_trans_test(91 test_array_7.1.xml "s.i1" "" test_array_7.1.xml.2.trans_base ${word_order}) -dmr_trans_test(92 test_array_7.1.xml "s.i1[][] " "" test_array_7.1.xml.2.trans_base ${word_order}) -dmr_trans_test(93 test_array_7.1.xml "s{i1}" "" test_array_7.1.xml.2.trans_base ${word_order}) -dmr_trans_test(94 test_array_7.1.xml "s{i1[][]} " "" test_array_7.1.xml.2.trans_base ${word_order}) -dmr_trans_test(95 test_array_7.1.xml "s.i1[0][0] " "" test_array_7.1.xml.3.trans_base ${word_order}) -dmr_trans_test(96 test_array_7.1.xml "s{i1[0][0]} " "" test_array_7.1.xml.3.trans_base ${word_order}) -dmr_trans_test(97 test_array_7.1.xml "s.i1[0:2][1:2] " "" test_array_7.1.xml.4.trans_base ${word_order}) -dmr_trans_test(98 test_array_7.1.xml "/row=[2:3];/col=[2:3];s " "" test_array_7.1.xml.5.trans_base ${word_order}) -dmr_trans_test(99 test_array_7.1.xml "/row=[2:3];/col=[2:3];s.i1 " "" test_array_7.1.xml.6.trans_base ${word_order}) -dmr_trans_test(100 test_array_7.1.xml "/row=[2:3];/col=[2:3];s.i1[][] " "" test_array_7.1.xml.6.trans_base ${word_order}) -dmr_trans_test(101 test_array_7.1.xml "/row=[2:3];/col=[2:3];s{i1} " "" test_array_7.1.xml.6.trans_base ${word_order}) -dmr_trans_test(102 test_array_7.2.xml "/col=[1:2];s[]{i1}" "" test_array_7.2.xml.1.trans_base ${word_order}) -dmr_trans_test(103 test_array_7.2.xml "/col=[1:2];s[]{i1[][]}" "" test_array_7.2.xml.1.trans_base ${word_order}) -dmr_trans_test(104 test_array_7.2.xml "/col=[1:2];s{i1[][]}" "" test_array_7.2.xml.1.trans_base ${word_order}) -dmr_trans_test(105 test_array_7.2.xml "/col=[1:2];s[]{i1[0][]}" "" test_array_7.2.xml.2.trans_base ${word_order}) -dmr_trans_test(106 test_array_7.2.xml "/col=[1:2];s{i1[0][]}" "" test_array_7.2.xml.2.trans_base ${word_order}) -dmr_trans_test(107 test_array_7.2.xml "/col=[1:2];s[0]{i1}" "" test_array_7.2.xml.3.trans_base ${word_order}) -dmr_trans_test(108 test_array_7.2.xml "/col=[1:2];s[0]{i1[][]}" "" test_array_7.2.xml.3.trans_base ${word_order}) -dmr_trans_test(109 test_array_7.2.xml "/col=[1:2];s[0]{i1[0][]}" "" test_array_7.2.xml.4.trans_base ${word_order}) - -# Test projections -dmr_trans_test(110 vol_1_ce_2.xml "/inst2" "" vol_1_ce_2.xml.1.trans_base ${word_order}) -dmr_trans_test(111 vol_1_ce_2.xml "inst2" "" vol_1_ce_2.xml.1.trans_base ${word_order}) -dmr_trans_test(112 vol_1_ce_2.xml "/inst2/Point" "" vol_1_ce_2.xml.2.trans_base ${word_order}) - -dmr_trans_test(113 vol_1_ce_13.xml "/inst2" "" vol_1_ce_13.xml.1.trans_base ${word_order}) -dmr_trans_test(114 vol_1_ce_13.xml "/inst2/inst3" "" vol_1_ce_13.xml.2.trans_base ${word_order}) - -dmr_trans_test(115 vol_1_ce_13.xml "/attr_only_global" "" vol_1_ce_13.xml.3.trans_base ${word_order}) -dmr_trans_test(116 vol_1_ce_13.xml "/inst2/attr_only" "" vol_1_ce_13.xml.4.trans_base ${word_order}) - -# DMR function‐CE tests → use dmr_trans_test(number, input, ce, func, baseline, byte_order) -dmr_trans_test(117 test_array_1.xml "" "scale(x,1)" test_array_1.xml.1.func_base ${word_order}) -dmr_trans_test(118 test_array_1.xml "" "scale(x,10)" test_array_1.xml.2.func_base ${word_order}) -dmr_trans_test(119 test_array_1.xml "" "scale(x,-10)" test_array_1.xml.3.func_base ${word_order}) -dmr_trans_test(120 test_array_1.xml "" "scale(x,0.001)" test_array_1.xml.4.func_base ${word_order}) -dmr_trans_test(121 test_array_1.xml "" "scale(x,-0.001)" test_array_1.xml.5.func_base ${word_order}) - -dmr_trans_test(122 test_array_1.xml "" "scale(x,0x7fffffffffffffff)" test_array_1.xml.6.func_base ${word_order}) -dmr_trans_test(123 test_array_1.xml "" "scale(x,0x8fffffffffffffff)" test_array_1.xml.7.func_base ${word_order}) - -dmr_trans_test(124 test_array_5.xml "" "scale(a,0.001)" test_array_5.xml.1.func_base ${word_order}) -dmr_trans_test(125 test_array_5.xml "" "scale(b,0.001)" test_array_5.xml.2.func_base ${word_order}) -dmr_trans_test(126 test_array_5.xml "" "scale(c,0.001)" test_array_5.xml.3.func_base ${word_order}) -dmr_trans_test(127 test_array_5.xml "" "scale(d,0.001)" test_array_5.xml.4.func_base ${word_order}) - -dmr_trans_test(128 vol_1_ce_1.xml "" "scale(u,10)" vol_1_ce_1.xml.1.func_base ${word_order}) -dmr_trans_test(129 vol_1_ce_1.xml "" "scale(u,v)" vol_1_ce_1.xml.2.func_base ${word_order}) -dmr_trans_test(130 vol_1_ce_1.xml "" "scale(scale(u,10),0.01)" vol_1_ce_1.xml.3.func_base ${word_order}) - -dmr_trans_test(131 vol_1_ce_1.xml "" "scale(Point.x,10)" vol_1_ce_1.xml.4.func_base ${word_order}) -dmr_trans_test(132 vol_1_ce_1.xml "" "scale(Point.x,Point.y)" vol_1_ce_1.xml.5.func_base ${word_order}) -dmr_trans_test(133 vol_1_ce_1.xml "" "scale(scale(Point.x,10),0.01)" vol_1_ce_1.xml.6.func_base ${word_order}) - -dmr_trans_test(134 vol_1_ce_1.xml "" "scale(\\$Byte(20:1,2,3,4),10)" vol_1_ce_1.xml.7.func_base ${word_order}) -dmr_trans_test(135 vol_1_ce_1.xml "" "scale(\\$Int8(20:10,11,12,-9),10)" vol_1_ce_1.xml.8.func_base ${word_order}) -dmr_trans_test(136 vol_1_ce_1.xml "" "scale(\\$UInt16(20:1,2,3,4),10)" vol_1_ce_1.xml.9.func_base ${word_order}) -dmr_trans_test(137 vol_1_ce_1.xml "" "scale(\\$Int16(20:1,2,3,-4),10)" vol_1_ce_1.xml.10.func_base ${word_order}) -dmr_trans_test(138 vol_1_ce_1.xml "" "scale(\\$UInt32(20:1,2,3,4),10)" vol_1_ce_1.xml.11.func_base ${word_order}) -dmr_trans_test(139 vol_1_ce_1.xml "" "scale(\\$Int32(20:1,2,3,-4),10)" vol_1_ce_1.xml.12.func_base ${word_order}) -dmr_trans_test(140 vol_1_ce_1.xml "" "scale(\\$UInt64(20:1,2,3,0xffffffffffffffff),1)" vol_1_ce_1.xml.13.func_base ${word_order}) -dmr_trans_test(141 vol_1_ce_1.xml "" "scale(\\$Int64(20:1,2,3,0x7fffffffffffffff),1)" vol_1_ce_1.xml.14.func_base ${word_order}) -dmr_trans_test(142 vol_1_ce_1.xml "" "scale(\\$Float32(20:1,2,3,4.55),10)" vol_1_ce_1.xml.15.func_base ${word_order}) -dmr_trans_test(143 vol_1_ce_1.xml "" "scale(\\$Float64(20:1,2,3,4.55),10)" vol_1_ce_1.xml.16.func_base ${word_order}) - -dmr_trans_test(144 vol_1_ce_10.xml "" "scale(lat,10)" vol_1_ce_10.xml.1.func_base ${word_order}) -dmr_trans_test(145 vol_1_ce_10.xml "" "scale(lat,10);scale(lon,10)" vol_1_ce_10.xml.2.func_base ${word_order}) -dmr_trans_test(146 vol_1_ce_10.xml "lat[10:11][10:11];lon[10:11][10:11]" "scale(lat,10);scale(lon,10)" vol_1_ce_10.xml.3.func_base ${word_order}) - -## Two things different about this set of tests: they assume baselines that are independent -## of word order and they use CEs that have operators (!, <=, ...). Making a test name substituting -## those chars with '_' doesn't make unique test names. But, for this we can use the baseline -## names. Also, some of these tests are expected to fail. 7/14/25 jhrg - -# New version: We switched to test numbers a while back to avoid the hack of making names -# from the various arguments, and I updated the code so include baseline generation. For -# the latter, I switched to an external script to run the C++ CLI program 'dmr-test.' -# This adds a layer of indirection, but it makes the text passed to cmake's add_test() -# easier to understand/debug. jhrg 1/2/26 -# -# Notes about this new version: -# -# Run all the tests: -# ctest -V -# Update all the baselines (see the script 'run_dmr_series_tes.sh' for how this works). -# UPDATE_BASELINES=1 ctest -V -# Update just one baseline: -# UPDATE_BASELINES=1 ctest -R dmr_series_test_147 -V - -function(dmr_series_test number input ce baseline xfail) - set(testname "dmr_series_test_${number}") - - set(input_path "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/${input}") - set(baseline_path "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/universal/${baseline}") - set(output_path "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - set(runner "${CMAKE_CURRENT_SOURCE_DIR}/dmr-testsuite/run_dmr_series_test.sh") - - add_test(NAME ${testname} - COMMAND bash "${runner}" - "$" - "${input_path}" - "${ce}" - "${baseline_path}" - "${output_path}" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;dmr;dmr-series") - - if("${xfail}" STREQUAL "xfail") - set_tests_properties(${testname} PROPERTIES WILL_FAIL TRUE) - endif() -endfunction() - -## These tests are all 'universal' tests (i.e., they do not need different baselines -## for different word order machines). 7/14/25 jhrg. -dmr_series_test(147 test_simple_7.xml "s" test_simple_7.xml.f.trans_base "pass") - -dmr_series_test(148 test_simple_7.xml "s|i1==1024" test_simple_7.xml.f1.trans_base "pass") -dmr_series_test(149 test_simple_7.xml "s|i1!=1024" test_simple_7.xml.f2.trans_base "pass") -dmr_series_test(150 test_simple_7.xml "s|i1<=1024" test_simple_7.xml.f3.trans_base "pass") -dmr_series_test(151 test_simple_7.xml "s|i1<1024" test_simple_7.xml.f4.trans_base "pass") -dmr_series_test(152 test_simple_7.xml "s|i1<=1024" test_simple_7.xml.f5.trans_base "pass") -dmr_series_test(153 test_simple_7.xml "s|i1>1024" test_simple_7.xml.f6.trans_base "pass") -dmr_series_test(154 test_simple_7.xml "s|i1>=1024" test_simple_7.xml.f7.trans_base "pass") - -dmr_series_test(155 test_simple_7.xml "s|1024=1024.0" test_simple_7.xml.fa.trans_base "pass") - -## \\\" --> \\ is a literal slash and \" is a literal double quote. 7/14/25 jhrg -dmr_series_test(158 test_simple_7.xml "s|s==\"Silly test string: 2\"" test_simple_7.xml.fs1.trans_base "pass") -dmr_series_test(159 test_simple_7.xml "s|s!=\"Silly test string: 2\"" test_simple_7.xml.fs2.trans_base "pass") -dmr_series_test(160 test_simple_7.xml "s|s<\"Silly test string: 2\"" test_simple_7.xml.fs3.trans_base "pass") -dmr_series_test(161 test_simple_7.xml "s|s<=\"Silly test string: 2\"" test_simple_7.xml.fs4.trans_base "pass") -dmr_series_test(162 test_simple_7.xml "s|s>\"Silly test string: 2\"" test_simple_7.xml.fs5.trans_base "pass") -dmr_series_test(163 test_simple_7.xml "s|s>=\"Silly test string: 2\"" test_simple_7.xml.fs6.trans_base "pass") -dmr_series_test(164 test_simple_7.xml "s|s~=\".*2\"" test_simple_7.xml.fs7.trans_base "pass") - -# Test filtering a sequence that has only one field projected, including filtering on the values -# of a filed not projected. -dmr_series_test(165 test_simple_7.xml "s{i1}|i1<32768" test_simple_7.xml.g1.trans_base "pass") -dmr_series_test(166 test_simple_7.xml "s{i1}|s<=\"Silly test string: 2\"" test_simple_7.xml.g1.trans_base "pass") - -# A nested sequence with floats in the outer sequence and the int, string combination in the inner -dmr_series_test(167 test_simple_8.1.xml "outer" test_simple_8.1.xml.f1.trans_base "pass") -dmr_series_test(168 test_simple_8.1.xml "outer{x;y}" test_simple_8.1.xml.f2.trans_base "pass") -dmr_series_test(169 test_simple_8.1.xml "outer{x;y;inner}" test_simple_8.1.xml.f3.trans_base "pass") -dmr_series_test(170 test_simple_8.1.xml "outer{x;y;inner|i1<1000}" test_simple_8.1.xml.f4.trans_base "pass") -dmr_series_test(171 test_simple_8.1.xml "outer{x;y;inner|i1<1000}|x<0.0" test_simple_8.1.xml.f5.trans_base "pass") - -# These tests are regression tests for bug Hyrax-267. Spaces in variables names -# broke the DAP4 CE parser - -# These mostly fail because there's a second bug where the variables in a group are -# not printing values. -dmr_series_test(172 names_with_spaces.dmr "/u" names_with_spaces.dmr.1.trans_base "pass") -dmr_series_test(173 names_with_spaces.dmr "/inst2/u" names_with_spaces.dmr.2.trans_base "xfail") - -dmr_series_test(174 names_with_spaces.dmr "/inst2/Point.x" names_with_spaces.dmr.3.trans_base "xfail") -dmr_series_test(175 names_with_spaces2.dmr "/inst2/\"Point Break\".x" names_with_spaces2.dmr.1.trans_base "xfail") -dmr_series_test(176 names_with_spaces2.dmr "/inst2/Point%20Break.x" names_with_spaces2.dmr.1.trans_base "xfail") -dmr_series_test(177 names_with_spaces2.dmr "/inst2/\"Point%20Break\".x" names_with_spaces2.dmr.1.trans_base "xfail") - -dmr_series_test(178 names_with_spaces3.dmr "/inst2/\"New Group\"/x" names_with_spaces3.dmr.1.trans_base "xfail") -dmr_series_test(179 names_with_spaces3.dmr "/inst2/New%20Group/x" names_with_spaces3.dmr.1.trans_base "xfail") diff --git a/tests/cmake/expr-tests.cmake b/tests/cmake/expr-tests.cmake deleted file mode 100644 index 85ef545bd..000000000 --- a/tests/cmake/expr-tests.cmake +++ /dev/null @@ -1,244 +0,0 @@ - -function(expr_test test_num option input ce baseline xfail) - set(testname "expr_test_${test_num}") - set(input "${CMAKE_CURRENT_SOURCE_DIR}/expr-testsuite/${input}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/expr-testsuite/${baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - add_test(NAME ${testname} - COMMAND /bin/sh "-c" - "\"$\" \"${option}\" \"${input}\" -k \"${ce}\" -f \"dummy\"> \"${output}\" 2>&1; \ - diff -b -B \"${baseline}\" \"${output}\" && rm -f \"${output}\"" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;expr") - # if(${option} STREQUAL "-w" OR ${option} STREQUAL "-bw") - # until we fix HYRAX-1843 the whole-enchilada tests must be run serially. 7/17/25 jhrg - # Fixed. jhrg 1/5/26 - # set_tests_properties(${testname} PROPERTIES RUN_SERIAL TRUE) - # endif() - if("${xfail}" STREQUAL "xfail") - set_tests_properties(${testname} PROPERTIES WILL_FAIL TRUE) - endif() -endfunction() - -## The xfail tests below should pass but have empty baseline files due to a bug -## in the tests from 2013 (?). Make new baselines! 7/15/25 jhrg - -expr_test(1 "-w" "test.1" "i" "test.1.base" "pass") -expr_test(2 "-W" "test.1" "i" "test.1.base" "pass") -expr_test(3 "-w" "test.1" "i,j" "test.1a.base" "pass") -expr_test(4 "-W" "test.1" "i,j" "test.1a.base" "pass") -expr_test(5 "-w" "test.1" "i,j&i=j" "test.1b.base" "pass") -expr_test(6 "-W" "test.1" "i,j&i=j" "test.1b.base" "pass") -expr_test(7 "-w" "test.1" "i&i=j" "test.1d.base" "pass") -expr_test(8 "-W" "test.1" "i&i=j" "test.1d.base" "pass") -expr_test(9 "-w" "test.2" "s1" "test.2.base" "pass") -expr_test(10 "-W" "test.2" "s1" "test.2.base" "pass") -expr_test(11 "-w" "test.2" "s2" "test.2a.base" "pass") -expr_test(12 "-W" "test.2" "s2" "test.2a.base" "pass") -expr_test(13 "-w" "test.2" "s2,s3" "test.2b.base" "pass") -expr_test(14 "-W" "test.2" "s2,s3" "test.2b.base" "pass") -expr_test(15 "-w" "test.2" "s2[2:2:4],s3.o" "test.2c.base" "pass") -expr_test(16 "-W" "test.2" "s2[2:2:4],s3.o" "test.2c.base" "pass") - -expr_test(17 "-w" "test.2" "s2[2:2:4].m" "test.2d.base" "pass") -expr_test(18 "-W" "test.2" "s2[2:2:4].m" "test.2d.base" "pass") -expr_test(19 "-w" "test.2" "s2[2:2:4].m,s2[2:2:4].l" "test.2e.base" "pass") -expr_test(20 "-W" "test.2" "s2[2:2:4].m,s2[2:2:4].l" "test.2e.base" "pass") - -expr_test(21 "-w" "test.2a" "s2[2:4].m[0:4],s2[2:4].l[0:5]" "test.2f.base" "pass") -expr_test(22 "-W" "test.2a" "s2[2:4].m[0:4],s2[2:4].l[0:5]" "test.2f.base" "pass") -expr_test(23 "-w" "test.3" "i[1:10]" "test.3.base" "pass") -expr_test(24 "-W" "test.3" "i[1:10]" "test.3.base" "pass") - -# Test the new code to limit reversed index values. 10:10 should pass. jhrg 2/3/11 -expr_test(25 "-w" "test.3" "i[10:10]" "test.3a.base" "pass") -expr_test(26 "-W" "test.3" "i[10:10]" "test.3a.base" "pass") - -# NB: \\ -> \ and \" -> " so \\\" -> \" which then becomes " inside the quoted string. 7/16/25 jhrg -expr_test(27 "-w" "test.4" "s&s=~\\\"^Silly.*\\\"" "test.4.base" "pass") -expr_test(28 "-W" "test.4" "s&s=~\\\"^Silly.*\\\"" "test.4.base" "pass") - -# In changing the TestStr class so that it writes a constant value (Silly ...: 1) -# I had to hack this test to use the -b option to expr-test. EXPR_RESPONSE_P uses -# only the -w/-W options, so I dropped using that macro kluge and went right for the -# actual test macro. 12/2/13 jhrg -# - -expr_test(29 "-bw" "test.e" "names.s&names.s=~\\\".*:.3\\\"" "test.ea.base" "pass") -expr_test(30 "-bW" "test.e" "names.s&names.s=~\\\".*:.3\\\"" "test.ea.base" "pass") - -# since 'Silly ...:5' will never be produced, this tests what happens when the sequence -# does not contain the value. Note that this test does not have to be rewritten because -# of the change to the TestStr code. 12/2/13 jhrg -expr_test(31 "-w" "test.e" "names.s&names.s=~\\\".*: 5\\\"" "test.eb.base" "pass") -expr_test(32 "-W" "test.e" "names.s&names.s=~\\\".*: 5\\\"" "test.eb.base" "pass") - -expr_test(33 "-w" "test.5" "g[0:2:4][0][0]" "test.5.base" "pass") -expr_test(34 "-W" "test.5" "g[0:2:4][0][0]" "test.5.base" "pass") -expr_test(35 "-w" "test.5" "g[0:2:4][0:2:4][0:2:4]" "test.5a.base" "pass") -expr_test(36 "-W" "test.5" "g[0:2:4][0:2:4][0:2:4]" "test.5a.base" "pass") -expr_test(37 "-w" "test.6" "i" "test.6.base" "pass") -expr_test(38 "-W" "test.6" "i" "test.6.base" "pass") -expr_test(39 "-w" "test.6" "i[1:2][2:4]" "test.6a.base" "pass") -expr_test(40 "-W" "test.6" "i[1:2][2:4]" "test.6a.base" "pass") -# Added test of '*' DAP2 syntax. jhrg 2/4/22 -expr_test(41 "-w" "test.6" "i[1:2][*]" "test.6b.base" "pass") -expr_test(42 "-W" "test.6" "i[1:2][*]" "test.6b.base" "pass") - -expr_test(43 "-w" "test.5" "g.val[0:1][0:1][0:1]" "test.5b.base" "pass") -expr_test(44 "-W" "test.5" "g.val[0:1][0:1][0:1]" "test.5b.base" "pass") -expr_test(45 "-w" "test.5" "g.length" "test.5c.base" "pass") -expr_test(46 "-W" "test.5" "g.length" "test.5c.base" "pass") -expr_test(47 "-w" "test.5" "g.length,g.width" "test.5d.base" "pass") -expr_test(48 "-W" "test.5" "g.length,g.width" "test.5d.base" "pass") -expr_test(49 "-w" "test.2" "j,o" "test.2g.base" "pass") -expr_test(50 "-W" "test.2" "j,o" "test.2g.base" "pass") -expr_test(51 "-w" "test.8" "\"data%23i[0:2:9][0:2]\"" "test.8.base" "pass") -expr_test(52 "-W" "test.8" "\"data%23i[0:2:9][0:2]\"" "test.8.base" "pass") -expr_test(53 "-w" "test.7" "x,y,f" "test.7.base" "pass") -expr_test(54 "-W" "test.7" "x,y,f" "test.7.base" "pass") -expr_test(55 "-w" "test.8" "\"x%23y,y\"" "test.8a.base" "pass") -expr_test(56 "-W" "test.8" "\"x%23y,y\"" "test.8a.base" "pass") -expr_test(57 "-w" "test.8" "\"data%20name,y\"" "test.8b.base" "pass") -expr_test(58 "-W" "test.8" "\"data%20name,y\"" "test.8b.base" "pass") -expr_test(59 "-w" "test.9" "\"Data-Set-2.fakeDim0[0:3],Data-Set-2.fakeDim1[0:3]\"" "test.9.base" "pass") -expr_test(60 "-W" "test.9" "\"Data-Set-2.fakeDim0[0:3],Data-Set-2.fakeDim1[0:3]\"" "test.9.base" "pass") - -# These should fail - that is, there should be stuff in stderr in addition to stdout. -# The baselines appear malformed. 7/16/25 jhrg -# Baselines fixed. 7/17/25 jhrg -expr_test(61 "-w" "test.5" "g[1:4:9]" "test.5e.base" "pass") -expr_test(62 "-W" "test.5" "g[1:4:9]" "test.5e.base" "pass") -expr_test(63 "-w" "test.6" "i[1:4:9]" "test.6c.base" "pass") -expr_test(64 "-W" "test.6" "i[1:4:9]" "test.6c.base" "pass") - -# New tests for server functions that take arrays and include array projections -# Added 10/23/13 jhrg -expr_test(65 "-w" "test.6" "scale\(i,2\)" "test.6.func1.base" "pass") -expr_test(66 "-W" "test.6" "scale\(i,2\)" "test.6.func1.base" "pass") -expr_test(67 "-w" "test.6" "scale\(i[2:4][3:6],2\)" "test.6.func2.base" "pass") -expr_test(68 "-W" "test.6" "scale\(i[2:4][3:6],2\)" "test.6.func2.base" "pass") - -expr_test(69 "-w" "test.5" "scale\(i[3],2\)" "test.5.func3.base" "pass") -expr_test(70 "-W" "test.5" "scale\(i[3],2\)" "test.5.func3.base" "pass") - -# This doesn't work yet 10/23/13 jhrg -expr_test(71 "-w" "test.5" "scale\(j,2\)" "test.5.func4.base" "pass") -expr_test(72 "-W" "test.5" "scale\(j,2\)" "test.5.func4.base" "pass") - -# all the tests from here on fail in the cmake build but pass in the autotools -# build. 7/1625 jhrg -expr_test(73 "-bw" "test.a" "" "test.a.base" "pass") -expr_test(74 "-bW" "test.a" "" "test.a.base" "pass") -expr_test(75 "-bw" "test.a" "&i<2000" "test.aa.base" "pass") -expr_test(76 "-bW" "test.a" "&i<2000" "test.aa.base" "pass") -expr_test(77 "-bw" "test.a" "j&i>2000" "test.ab.base" "pass") -expr_test(78 "-bW" "test.a" "j&i>2000" "test.ab.base" "pass") -expr_test(79 "-bw" "test.a" "i,j&i<0" "test.ac.base" "pass") -expr_test(80 "-bW" "test.a" "i,j&i<0" "test.ac.base" "pass") -# Added 2/3/22 jhrg -expr_test(81 "-bw" "test.a" "s[0:3]" "test.ad.base" "pass") -expr_test(82 "-bW" "test.a" "s[0:3]" "test.ad.base" "pass") -expr_test(83 "-bw" "test.b" "" "test.b.base" "pass") -expr_test(84 "-bW" "test.b" "" "test.b.base" "pass") -expr_test(85 "-bw" "test.b" "i,f" "test.ba.base" "pass") -expr_test(86 "-bW" "test.b" "i,f" "test.ba.base" "pass") -expr_test(87 "-bw" "test.b" "i,f&i<2000" "test.bb.base" "pass") -expr_test(88 "-bW" "test.b" "i,f&i<2000" "test.bb.base" "pass") -expr_test(89 "-bw" "test.b" "i,f&f<0" "test.bc.base" "pass") -expr_test(90 "-bW" "test.b" "i,f&f<0" "test.bc.base" "pass") -expr_test(91 "-bw" "test.b" "i,j&i<2000" "test.bd.base" "pass") -expr_test(92 "-bW" "test.b" "i,j&i<2000" "test.bd.base" "pass") -expr_test(93 "-bw" "test.b" "&i<0" "test.be.base" "pass") -expr_test(94 "-bW" "test.b" "&i<0" "test.be.base" "pass") -expr_test(95 "-bw" "test.d" "" "test.d.base" "pass") -expr_test(96 "-bW" "test.d" "" "test.d.base" "pass") -expr_test(97 "-bw" "test.d" "i,f,a" "test.da.base" "pass") -expr_test(98 "-bW" "test.d" "i,f,a" "test.da.base" "pass") -expr_test(99 "-bw" "test.d" "i,f,a&i<2000" "test.db.base" "pass") -expr_test(100 "-bW" "test.d" "i,f,a&i<2000" "test.db.base" "pass") -expr_test(101 "-bw" "test.d" "i,f,a&f<0" "test.dc.base" "pass") -expr_test(102 "-bW" "test.d" "i,f,a&f<0" "test.dc.base" "pass") -expr_test(103 "-bw" "test.d" "i,f,a&a<10" "test.dd.base" "pass") -expr_test(104 "-bW" "test.d" "i,f,a&a<10" "test.dd.base" "pass") -expr_test(105 "-bw" "test.d" "i,f&i<2000" "test.de.base" "pass") -expr_test(106 "-bW" "test.d" "i,f&i<2000" "test.de.base" "pass") -expr_test(107 "-bw" "test.d" "i&i<2000" "test.df.base" "pass") -expr_test(108 "-bW" "test.d" "i&i<2000" "test.df.base" "pass") -expr_test(109 "-bw" "test.d" "i,f,a&i<0" "test.dg.base" "pass") -expr_test(110 "-bW" "test.d" "i,f,a&i<0" "test.dg.base" "pass") - -expr_test(111 "-bw" "test.61" "i" "data.61a.base" "pass") -expr_test(112 "-bW" "test.61" "i" "data.61a.base" "pass") - -expr_test(113 "-bw" "test.61" "i[0:2][0:2]" "data.61b.base" "pass") -expr_test(114 "-bW" "test.61" "i[0:2][0:2]" "data.61b.base" "pass") - -expr_test(115 "-bw" "test.61" "i[1:2][0:2]" "data.61c.base" "pass") -expr_test(116 "-bW" "test.61" "i[1:2][0:2]" "data.61c.base" "pass") - -expr_test(117 "-bw" "test.61" "i[1:2][1:2]" "data.61d.base" "pass") -expr_test(118 "-bW" "test.61" "i[1:2][1:2]" "data.61d.base" "pass") - -expr_test(119 "-bw" "test.c0" "SST" "data.z1.base" "pass") -expr_test(120 "-bW" "test.c0" "SST" "data.z1.base" "pass") - -expr_test(121 "-bw" "test.f" "" "test.fa.base" "pass") -expr_test(122 "-bW" "test.f" "" "test.fa.base" "pass") - -expr_test(123 "-bw" "test.f" "&i<3000" "test.fb.base" "pass") -expr_test(124 "-bW" "test.f" "&i<3000" "test.fb.base" "pass") - -expr_test(125 "-bw" "test.21.dds" "" "data.21.base" "pass") -expr_test(126 "-bW" "test.21.dds" "" "data.21.base" "pass") - -expr_test(127 "-bw" "test.22.dds" "" "data.22.base" "pass") -expr_test(128 "-bW" "test.22.dds" "" "data.22.base" "pass") - -expr_test(129 "-bw" "test.23.dds" "" "data.23.base" "pass") -expr_test(130 "-bW" "test.23.dds" "" "data.23.base" "pass") - -expr_test(131 "-bw" "test.24.dds" "" "data.24.base" "pass") -expr_test(132 "-bW" "test.24.dds" "" "data.24.base" "pass") - -## Empty Structures. jhrg 1/29/16 -expr_test(133 "-bw" "test.25.dds" "" "data.25.base" "pass") -expr_test(134 "-bW" "test.25.dds" "" "data.25.base" "pass") - -expr_test(135 "-bw" "test.26.dds" "" "data.26.base" "pass") -expr_test(136 "-bW" "test.26.dds" "" "data.26.base" "pass") - -## Test error responses. None of the parsers should allow any part of -## the malformed CE into the error messages. jhrg 4/15/20 -## Morphed to cmake 7/17/25 jhrg -function(expr_error_test test_num option input ce baseline xfail) - set(testname "expr_test_${test_num}") - set(input "${CMAKE_CURRENT_SOURCE_DIR}/expr-testsuite/${input}") - set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/expr-testsuite/${baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - add_test(NAME ${testname} - COMMAND /bin/sh "-c" - "\"$\" \"${option}\" \"${input}\" -k \"${ce}\" > /dev/null 2> \"${output}\"; \ - diff -b -B \"${baseline}\" \"${output}\" && rm -f \"${output}\"" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;expr-error") - if("${xfail}" STREQUAL "xfail") - set_tests_properties(${testname} PROPERTIES WILL_FAIL TRUE) - endif() -endfunction() - -expr_error_test(137 "-ep" "test.1" "d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1" "test.1.error" "pass") -expr_error_test(138 "-ep" "test.2" "d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1" "test.2.error" "pass") -expr_error_test(139 "-ep" "test.3" "d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1" "test.3.error" "pass") -expr_error_test(140 "-ep" "test.5" "d1rox%253cscript%253ealert%25281%2529%253c%252fscript%253ed55je=1" "test.5.error" "pass") -expr_error_test(141 "-ep" "test.3" "i[10:9]" "test.3b.error" "pass") -expr_error_test(142 "-ep" "test.3" "i[4:1]" "test.3c.error" "pass") -expr_error_test(143 "-ep" "test.5" "g[2:2:1][0][0]" "test.5a.error" "pass") -expr_error_test(144 "-ep" "test.5" "g[2:4][0][1:0]" "test.5b.error" "pass") - -expr_test(145 "-bw" "test.a" "s[3:0]" "test.a.error.base" "pass") -expr_test(146 "-bW" "test.a" "s[3:0]" "test.a.error.base" "pass") diff --git a/tests/cmake/getdap-tests.cmake b/tests/cmake/getdap-tests.cmake deleted file mode 100644 index 11cb7ffbc..000000000 --- a/tests/cmake/getdap-tests.cmake +++ /dev/null @@ -1,33 +0,0 @@ - -function(getdap_test test_num option url baseline xfail) - set(testname "getdap_test_${test_num}") - set(baseline_path "${CMAKE_CURRENT_SOURCE_DIR}/getdap-testsuite/${baseline}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${testname}.out") - - set(the_test "$ ${option} ${url} > ${output} 2>&1") - - add_test(NAME ${testname} - COMMAND /bin/sh -c "${the_test}; diff -b -B ${baseline_path} ${output} && rm -f ${output}" - ) - - set_tests_properties(${testname} PROPERTIES LABELS "integration;getdap") - # Not needed, but here if we use this as a templet for other tests. 7/15//25 jhrg - # set_tests_properties(${testname} PROPERTIES RUN_SERIAL TRUE) - if("${xfail}" STREQUAL "xfail") - set_tests_properties(${testname} PROPERTIES WILL_FAIL TRUE) - endif() - - set(staged_baseline "${CMAKE_CURRENT_BINARY_DIR}/baselines/${baseline}.base") - set(baseline_tgt "baseline-${testname}") - add_custom_target(${baseline_tgt} - COMMAND ${CMAKE_COMMAND} -E make_directory "$" - COMMAND /bin/sh -c "${the_test}; ${CMAKE_COMMAND} -E copy ${output} ${staged_baseline} && rm -f ${output}" - BYPRODUCTS "${staged_baseline}" - COMMENT "Staging baseline for ${testname} → ${staged_baseline}" - VERBATIM - ) - -endfunction() - -getdap_test(1 "-d" "http://test.opendap.org/dap/data/nc/fnoc1.nc" "fnoc1.nc.dds" "pass") -getdap_test(2 "-a" "http://test.opendap.org/dap/data/nc/fnoc1.nc" "fnoc1.nc.das" "pass") diff --git a/tests/cmake/python-test-function.cmake.not_used b/tests/cmake/python-test-function.cmake.not_used deleted file mode 100644 index 91df978fe..000000000 --- a/tests/cmake/python-test-function.cmake.not_used +++ /dev/null @@ -1,37 +0,0 @@ - -# find_package(Python3 COMPONENTS Interpreter REQUIRED) - -#set(DAS_HELPER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/run_das_response_test.py") -#set(DAS_HELPER_BIN "${CMAKE_CURRENT_BINARY_DIR}/run_das_response_test.py") -#configure_file( -# ${DAS_HELPER_SRC} ${DAS_HELPER_BIN} -# COPYONLY -#) - -#function(add_das_response_test das_filename) -# # get "test.1.das" → fullname="test.1.das" -# message(STATUS "testname: ${testname}") -# get_filename_component(fullname "${das_filename}" NAME) -# # strip just ".das" → raw="test.1" -# string(REGEX REPLACE "\\.das$" "" raw "${fullname}") -# # sanitize → test_1 -# string(REGEX REPLACE "[^A-Za-z0-9_]" "_" testname "${raw}") -# message(STATUS "testname: ${testname}") -# # 3) set up paths -# set(input "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite/${das_filename}") -# set(baseline "${CMAKE_CURRENT_SOURCE_DIR}/das-testsuite/${das_filename}.base") -# set(diffout "${CMAKE_CURRENT_BINARY_DIR}/${testname}.diff") -# -# # 4) register the test -# add_test( -# NAME das_response_${testname} -# COMMAND -# ${Python3_EXECUTABLE} -# "${DAS_HELPER_BIN}" -# $ -# "${input}" -# "${baseline}" -# "${diffout}" -# ) -# set_tests_properties(das_response_${testname} PROPERTIES LABELS integration) -#endfunction() diff --git a/tests/configure.ac b/tests/configure.ac new file mode 100644 index 000000000..9b0188cb9 --- /dev/null +++ b/tests/configure.ac @@ -0,0 +1,23 @@ +dnl -*- autoconf -*- +dnl Minimal configure.ac used only for generating the autotest support files +dnl needed by the CMake integration-test path. + +AC_PREREQ([2.69]) + +AC_INIT([libdap],[3.21.1],[opendap-tech@opendap.org]) +AC_CONFIG_SRCDIR([DASTest.at]) +AC_CONFIG_TESTDIR([.], [.]) + +AC_PROG_CC +AC_C_BIGENDIAN + +dnl Match the word-order substitution used by the full autotools build so the +dnl DMR autotest suites pick the correct baseline directory. +AS_IF([test "$ac_cv_c_bigendian" = yes], + [ac_word_order=big-endian], + [ac_word_order=little-endian]) +AC_SUBST([ac_word_order]) + +AC_CONFIG_FILES([atlocal package.m4]) + +AC_OUTPUT diff --git a/tests/package.m4.in b/tests/package.m4.in new file mode 100644 index 000000000..a9bd74a90 --- /dev/null +++ b/tests/package.m4.in @@ -0,0 +1,6 @@ +# Signature of the current package. +m4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@]) +m4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@]) +m4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@]) +m4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@]) +m4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])