wip
Run Simulator Tests on local RHEL9 / build (push) Failing after 1m0s
Build on RHEL8 docker image / build (push) Failing after 2m28s
Run Simulator Tests on local RHEL8 / build (push) Failing after 2m35s
Build on RHEL9 docker image / build (push) Failing after 3m34s

This commit is contained in:
2026-05-19 12:34:48 +02:00
parent 38c535718a
commit 6f65a6d486
6 changed files with 202 additions and 139 deletions
@@ -13,7 +13,7 @@
namespace sls::test::master_file {
struct JsonContext {
const rapidjson::Document doc;
rapidjson::Document doc;
};
#ifdef HDF5C
struct H5Context {
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Readers.h"
#include "Context.h"
#include "sls/ToString.h"
+5 -137
View File
@@ -2,152 +2,20 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
#include "Context.h"
#ifdef HDF5C
#include "H5Cpp.h"
#endif
#include <array>
#include <map>
#include <rapidjson/document.h>
#include <string>
#include <vector>
namespace sls::test::master_file {
using ns = std::chrono::nanoseconds;
using rapidjson::Document;
template <typename Context, typename T> struct Reader;
/*
struct JsonDoc {
const rapidjson::Document &doc;
};
#ifdef HDF5C
struct H5Doc {
const H5::DataSet& ds;
};
#endif
template <typename doc, typename T>
T read(const doc& b, const std::string& name);
*/
/** ---scalar reads--- */
/** std::string */
/*
template <>
inline std::string read<JsonDoc, std::string>(
const JsonDoc& b,
const std::string& name)
{
return b.doc[name.c_str()].GetString();
template <typename Context, typename T>
T read(const Context &ctx, const std::string &name) {
return Reader<Context, T>::read(ctx, name);
}
#ifdef HDF5C
template <>
inline std::string read<H5Doc, std::string>(
const H5Doc& b,
const std::string& name)
{
std::string out;
b.ds.read(out, ds.getStrType());
return out;
}
#endif
*/
void read_from_json(const Document &doc, const std::string &name,
std::string &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::string &out);
#endif
/** int */
void read_from_json(const Document &doc, const std::string &name, int &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
int &out);
#endif
/** uint32_t */
void read_from_json(const Document &doc, const std::string &name,
uint32_t &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
uint32_t &out);
#endif
/** uint64_t */
void read_from_json(const Document &doc, const std::string &name,
uint64_t &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
uint64_t &out);
#endif
/** double */
void read_from_json(const Document &doc, const std::string &name, double &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
double &out);
#endif
/* ---vector reads--- */
/** int64_t */
void read_from_json(const Document &doc, const std::string &name,
std::vector<int64_t> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::vector<int64_t> &out);
#endif
/* ---arrays/ maps--- */
/** std::array<int, 3UL> */
void read_from_json(const Document &doc, const std::string &name,
std::array<int, 3UL> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::array<int, 3UL> &out);
#endif
/** std::array<ns, 3UL> */
void read_from_json(const Document &doc, const std::string &name,
std::array<ns, 3UL> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::array<ns, 3UL> &out);
#endif
/** std::map<std::string, std::string> */
void read_from_json(const Document &doc, const std::string &name,
std::map<std::string, std::string> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::map<std::string, std::string> &out);
#endif
/* complex types */
/* std::vector<ROI> */
void read_from_json(const Document &doc, const std::string &name,
std::vector<defs::ROI> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::vector<defs::ROI> &out);
#endif
/** defs::xy */
void read_from_json(const Document &doc, const std::string &name,
defs::xy &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
defs::xy &out);
#endif
/** defs::scanParameters */
void read_from_json(const Document &doc, const std::string &name,
defs::scanParameters &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
defs::scanParameters &out);
#endif
} // namespace sls::test::master_file
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Readers.h"
#ifdef HDF5C
namespace sls::test::master_file {
template <>
struct Reader<H5Context, int> {
static int read(const H5Context& ctx,
const std::string& name) {
auto ds = ctx.file.openDataSet(HDF5_GROUP + name);
int out{};
ds.read(&out, H5::PredType::NATIVE_INT);
return out;
}
};
} // namespace sls::test::master_file
#endif
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Readers.h"
namespace sls::test::master_file {
/* --scalar reads-- */
template <>
struct Reader<JsonContext, int> {
static int read(const JsonContext &ctx, const std::string &name) {
return ctx.doc[name.c_str()].GetInt();
}
};
template<>
struct Reader<JsonContext, uint32_t> {
static uint32_t read(const JsonContext& ctx,
const std::string& name) {
return ctx.doc[name.c_str()].GetUint();
}
};
template<>
struct Reader<JsonContext, uint64_t> {
static uint64_t read(const JsonContext& ctx,
const std::string& name) {
return ctx.doc[name.c_str()].GetUint64();
}
};
template<>
struct Reader<JsonContext, double> {
static double read(const JsonContext& ctx,
const std::string& name) {
return ctx.doc[name.c_str()].GetDouble();
}
};
template<>
struct Reader<JsonContext, std::string> {
static std::string read(const JsonContext& ctx,
const std::string& name) {
return ctx.doc[name.c_str()].GetString();
}
};
} // namespace sls::test::master_file
@@ -0,0 +1,114 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "Context.h"
#include "sls/sls_detector_defs.h"
#ifdef HDF5C
#include "H5Cpp.h"
#endif
#include <rapidjson/document.h>
namespace sls::test::master_file {
using ns = std::chrono::nanoseconds;
void read_from_json(const Document &doc, const std::string &name,
std::string &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::string &out);
#endif
/** int */
void read_from_json(const Document &doc, const std::string &name, int &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
int &out);
#endif
/** uint32_t */
void read_from_json(const Document &doc, const std::string &name,
uint32_t &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
uint32_t &out);
#endif
/** uint64_t */
void read_from_json(const Document &doc, const std::string &name,
uint64_t &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
uint64_t &out);
#endif
/** double */
void read_from_json(const Document &doc, const std::string &name, double &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
double &out);
#endif
/* ---vector reads--- */
/** int64_t */
void read_from_json(const Document &doc, const std::string &name,
std::vector<int64_t> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::vector<int64_t> &out);
#endif
/* ---arrays/ maps--- */
/** std::array<int, 3UL> */
void read_from_json(const Document &doc, const std::string &name,
std::array<int, 3UL> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::array<int, 3UL> &out);
#endif
/** std::array<ns, 3UL> */
void read_from_json(const Document &doc, const std::string &name,
std::array<ns, 3UL> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::array<ns, 3UL> &out);
#endif
/** std::map<std::string, std::string> */
void read_from_json(const Document &doc, const std::string &name,
std::map<std::string, std::string> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::map<std::string, std::string> &out);
#endif
/* complex types */
/* std::vector<ROI> */
void read_from_json(const Document &doc, const std::string &name,
std::vector<defs::ROI> &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
std::vector<defs::ROI> &out);
#endif
/** defs::xy */
void read_from_json(const Document &doc, const std::string &name,
defs::xy &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
defs::xy &out);
#endif
/** defs::scanParameters */
void read_from_json(const Document &doc, const std::string &name,
defs::scanParameters &out);
#ifdef HDF5C
void read_from_h5_dataset(const H5::DataSet &ds, const std::string &name,
defs::scanParameters &out);
#endif
} // namespace sls::test::master_file