Files
Jungfraujoch/tests/TestData.h
T
leonarski_f 39599bc090 tests: git-LFS large-dataset harness + jfjoch_process include cleanup
- .gitattributes tracks tests/data/*.h5 via git-LFS for big reference datasets.
- tests/TestData.h resolves tests/data files and reports absent / unfetched-LFS-pointer
  so tests can SKIP() instead of failing; tests/data/README.md documents fetching + the
  expected lyso_rotation/lyso_serial datasets.
- JFJochProcessLargeTest: a Catch start-up listener that prints dataset availability, plus
  [large] full-analysis runs (rotation indexing + serial) that SKIP when data is absent.
  Verified against the real 1800-image lyso rotation set (100% indexing, cell 78.2/78.2/37.8)
  and skips cleanly without it.
- jfjoch_process.cpp: drop the ~15 now-unused workflow includes left after the JFJochProcess
  extraction.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 14:16:34 +02:00

29 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <filesystem>
#include <optional>
#include <string>
// Helpers for the large reference datasets used by the [large] Catch tests. The datasets live
// under <repo>/tests/data and are tracked with git-LFS, so they are often NOT present (LFS not
// pulled, e.g. in CI). Tests run from <build>/tests, so the directory is reached via ../../.
namespace jfjoch_test {
inline std::string LargeDataDir() { return "../../tests/data"; }
// Path to a large dataset file if it is present and looks like real data rather than an
// unfetched git-LFS pointer (those are tiny text stubs); std::nullopt otherwise. Tests should
// SKIP() when this returns nullopt.
inline std::optional<std::string> LargeDataFile(const std::string &name) {
const std::string path = LargeDataDir() + "/" + name;
std::error_code ec;
if (!std::filesystem::is_regular_file(path, ec))
return std::nullopt;
if (ec || std::filesystem::file_size(path, ec) < 4096 || ec)
return std::nullopt; // an LFS pointer file is well under 4 kB; an HDF5 master is not
return path;
}
}