From e5c289be306e9765bd4b077139ec214003f2deb7 Mon Sep 17 00:00:00 2001 From: Petr Kubanek Date: Thu, 5 Oct 2023 12:29:07 +0200 Subject: [PATCH] Removed TableLoader and Boost dependency, adjust paths --- Dockerfile | 8 +- Jenkinsfile | 2 +- Makefile.inc | 3 +- doc/version-history.rst | 19 +++++ include/cRIO/TableLoader.h | 82 -------------------- src/LSST/cRIO/TableLoader.cpp | 62 --------------- src/Makefile | 4 +- tests/Makefile | 17 ++-- tests/test_ElectromechanicalPneumaticILC.cpp | 4 +- 9 files changed, 40 insertions(+), 161 deletions(-) create mode 100644 doc/version-history.rst delete mode 100644 include/cRIO/TableLoader.h delete mode 100644 src/LSST/cRIO/TableLoader.cpp diff --git a/Dockerfile b/Dockerfile index 78965f70..5dc78159 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lsstts/develop-env:c0028.004 +FROM lsstts/develop-env:develop USER root RUN chmod a+rwX -R /home/saluser/ @@ -7,13 +7,15 @@ USER saluser WORKDIR /home/saluser RUN source ~/.setup.sh \ - && mamba install -y readline yaml-cpp boost-cpp catch2 spdlog \ + && mamba install -y readline yaml-cpp boost-cpp catch2 spdlog fmt \ && echo > .crio_setup.sh -e \ echo "Configuring cRIO development environment" \\n\ export SHELL=bash \\n\ source /home/saluser/.setup_salobj.sh \\n\ export PATH=\$CONDA_PREFIX/bin:\$PATH \\n\ export LIBS="-L\$CONDA_PREFIX/lib" \\n\ -export CPP_FLAGS="-I\$CONDA_PREFIX/include" \\n +export CPP_FLAGS="-I\$CONDA_PREFIX/include" \\n\ +export PKG_CONFIG_PATH=$CONDA_PREFIX/share/pkgconfig \\n\ +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib \\n # SHELL ["/bin/bash", "-lc"] diff --git a/Jenkinsfile b/Jenkinsfile index 333fe76a..bbbdf739 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,7 +52,7 @@ node { cd $WORKSPACE/ts_cRIOcpp make - make junit + make VERBOSE=1 junit """ } } diff --git a/Makefile.inc b/Makefile.inc index 8db249b8..1877f4c3 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -4,7 +4,7 @@ ifndef VERBOSE silence := --silence-errors endif -c_opts := -fdata-sections -ffunction-sections -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE +c_opts := -fdata-sections -ffunction-sections -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE -DSPDLOG_FMT_EXTERNAL ifdef DEBUG c_opts += -g @@ -29,7 +29,6 @@ PKG_LIBS := $(shell pkg-config yaml-cpp --libs $(silence)) \ LIBS += $(PKG_LIBS) -ldl -lpthread -BOOST_CPPFLAGS := -I/usr/include/boost169 PKG_CPP_FLAGS := $(shell pkg-config yaml-cpp --cflags $(silence)) \ $(shell pkg-config spdlog --cflags $(silence)) \ $(shell pkg-config fmt --cflags $(silence)) diff --git a/doc/version-history.rst b/doc/version-history.rst new file mode 100644 index 00000000..cfd7bcd7 --- /dev/null +++ b/doc/version-history.rst @@ -0,0 +1,19 @@ +############### +Version History +############### + +v1.9.0 +====== + +* MPU changed to SerialMultiplex + +v1.8.0 +====== + +* LVDT ElectroMechanical readout + +v1.7.0 +====== + +* offsets,.. ILC commands +* improved re-heater gain management diff --git a/include/cRIO/TableLoader.h b/include/cRIO/TableLoader.h deleted file mode 100644 index e1ce3685..00000000 --- a/include/cRIO/TableLoader.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Developed for the Vera C. Rubin Observatory Telescope & Site Software Systems. - * This product includes software developed by the Vera C.Rubin Observatory Project - * (https://www.lsst.org). See the COPYRIGHT file at the top-level directory of - * this distribution for details of code ownership. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#ifndef TABLELOADER_H_ -#define TABLELOADER_H_ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -namespace LSST { -namespace cRIO { - -class TableLoader { -public: - template - static void loadTable(int rowsToSkip, int columnsToSkip, int columnsToKeep, std::vector* data, - const std::string& filename); - static void loadLimitTable(int rowsToSkip, int columnsToSkip, std::vector* data, - const std::string& filename); -}; - -template -void TableLoader::loadTable(int rowsToSkip, int columnsToSkip, int columnsToKeep, std::vector* data, - const std::string& filename) { - typedef boost::tokenizer > tokenizer; - - std::string fullPath = Settings::Path::getFilePath(filename); - std::ifstream inputStream(fullPath.c_str()); - if (!inputStream.is_open()) { - throw std::runtime_error("Cannot open " + fullPath + ": " + strerror(errno)); - } - std::string lineText; - int32_t lineNumber = 0; - data->clear(); - while (std::getline(inputStream, lineText)) { - boost::trim_right(lineText); - if (lineNumber >= rowsToSkip && !lineText.empty()) { - tokenizer tok(lineText); - tokenizer::iterator i = tok.begin(); - for (int j = 0; j < columnsToSkip; j++) { - ++i; - } - for (int j = 0; j < columnsToKeep; j++) { - data->push_back(boost::lexical_cast(*i)); - ++i; - } - } - lineNumber++; - } - inputStream.close(); -} - -} // namespace cRIO -} // namespace LSST - -#endif /* TABLELOADER_H_ */ diff --git a/src/LSST/cRIO/TableLoader.cpp b/src/LSST/cRIO/TableLoader.cpp deleted file mode 100644 index 93bc0e6e..00000000 --- a/src/LSST/cRIO/TableLoader.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Developed for the Vera C. Rubin Observatory Telescope & Site Software Systems. - * This product includes software developed by the Vera C.Rubin Observatory Project - * (https://www.lsst.org). See the COPYRIGHT file at the top-level directory of - * this distribution for details of code ownership. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#include - -namespace LSST { -namespace cRIO { - -void TableLoader::loadLimitTable(int rowsToSkip, int columnsToSkip, std::vector* data, - const std::string& filename) { - typedef boost::tokenizer > tokenizer; - - std::string fullPath = Settings::Path::getFilePath(filename); - std::ifstream inputStream(fullPath.c_str()); - if (!inputStream.is_open()) { - throw std::runtime_error("Cannot open " + fullPath + ": " + strerror(errno)); - } - std::string lineText; - int32_t lineNumber = 0; - data->clear(); - while (std::getline(inputStream, lineText)) { - boost::trim_right(lineText); - if (lineNumber >= rowsToSkip && !lineText.empty()) { - tokenizer tok(lineText); - tokenizer::iterator i = tok.begin(); - for (int j = 0; j < columnsToSkip; j++) { - ++i; - } - Limit limit; - limit.LowFault = boost::lexical_cast(*i); - ++i; - limit.LowWarning = boost::lexical_cast(*i); - ++i; - limit.HighWarning = boost::lexical_cast(*i); - ++i; - limit.HighFault = boost::lexical_cast(*i); - data->push_back(limit); - } - lineNumber++; - } - inputStream.close(); -} - -} // namespace cRIO -} // namespace LSST diff --git a/src/Makefile b/src/Makefile index 5def2124..3d966da6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -29,8 +29,8 @@ clean: # file targets %.cpp.o: %.cpp.d @echo '[CPP] $(patsubst %.d,%,$<)' - ${co}$(CPP) $(BOOST_CPPFLAGS) $(CPP_FLAGS) -c -fmessage-length=0 -o $@ $(patsubst %.d,%,$<) + ${co}$(CPP) $(CPP_FLAGS) -c -fmessage-length=0 -o $@ $(patsubst %.d,%,$<) %.cpp.d: %.cpp @echo '[DPP] $<' - ${co}$(CPP) $(BOOST_CPPFLAGS) $(CPP_FLAGS) -M $< -MF $@ -MT '$(patsubst %.cpp,%.o,$<) $@' + ${co}$(CPP) $(CPP_FLAGS) -M $< -MF $@ -MT '$(patsubst %.cpp,%.o,$<) $@' diff --git a/tests/Makefile b/tests/Makefile index 8a148b89..b1db0f3f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,9 +18,12 @@ endif TEST_CPPFLAGS := -I. \ -I"../include" \ - $(shell pkg-config --cflags catch2-with-main) + $(shell pkg-config --cflags catch2-with-main $(silence)) \ + $(shell pkg-config --cflags yaml-cpp $(silence)) -CPP_FLAGS += $(shell pkg-config --libs catch2-with-main) +CPP_FLAGS += \ + $(shell pkg-config --libs catch2-with-main $(silence)) \ + $(shell pkg-config --libs yaml-cpp $(silence)) compile: libcRIOtest.a $(BINARIES) $(TEST_REQ_READLINE) @@ -38,19 +41,19 @@ clean: %.cpp.o: %.cpp.d @echo '[CPP] $(patsubst %.d,%,$<)' - ${co}$(CPP) $(BOOST_CPPFLAGS) $(CPP_FLAGS) $(TEST_CPPFLAGS) -c -fmessage-length=0 -o $@ -Wl,--gc-sections $(patsubst %.d,%,$<) + ${co}$(CPP) $(CPP_FLAGS) $(TEST_CPPFLAGS) -c -fmessage-length=0 -o $@ -Wl,--gc-sections $(patsubst %.d,%,$<) %.cpp.d: %.cpp @echo '[DPP] $<' - ${co}$(CPP) $(BOOST_CPPFLAGS) $(CPP_FLAGS) $(TEST_CPPFLAGS) -M $< -MF $@ -MT '$(patsubst %.cpp,%.o,$<) $@' + ${co}$(CPP) $(CPP_FLAGS) $(TEST_CPPFLAGS) -M $< -MF $@ -MT '$(patsubst %.cpp,%.o,$<) $@' $(TEST_REQ_READLINE): %: %.cpp.o ../lib/libcRIOcpp.a libcRIOtest.a @echo '[TPR] $<' - ${co}$(CPP) -o $@ $(LIBS_FLAGS) $(LIBS) $^ $(CPP_FLAGS) -lreadline # -lhistory + ${co}$(CPP) -o $@ $(LIBS_FLAGS) $^ $(LIBS) $(CPP_FLAGS) -lreadline # -lhistory -${BINARIES}: %: %.cpp.o ../lib/libcRIOcpp.a libcRIOtest.a +$(BINARIES): %: %.cpp.o ../lib/libcRIOcpp.a libcRIOtest.a @echo '[TPP] $<' - ${co}$(CPP) -o $@ -Wl,--gc-sections $(LIBS_FLAGS) $(LIBS) $^ $(CPP_FLAGS) + ${co}$(CPP) -o $@ -Wl,--gc-sections $(LIBS_FLAGS) $^ $(LIBS) $(CPP_FLAGS) libcRIOtest.a: TestFPGA.cpp.o @echo '[AR ] $@' diff --git a/tests/test_ElectromechanicalPneumaticILC.cpp b/tests/test_ElectromechanicalPneumaticILC.cpp index 4adedcaa..11856a75 100644 --- a/tests/test_ElectromechanicalPneumaticILC.cpp +++ b/tests/test_ElectromechanicalPneumaticILC.cpp @@ -140,7 +140,7 @@ TEST_CASE("Test SSA force set", "[ElectromechanicalPneumaticILC]") { REQUIRE_NOTHROW(ilc.processResponse(response.getBuffer(), response.getLength())); REQUIRE(ilc.primaryForce == Approx(31.45)); - REQUIRE(isnan(ilc.secondaryForce)); + REQUIRE(std::isnan(ilc.secondaryForce)); } TEST_CASE("Test DAA force set", "[ElectromechanicalPneumaticILC]") { @@ -197,7 +197,7 @@ TEST_CASE("Test SAA force actuator readout", "[ElectromechanicalPneumaticILC]") REQUIRE_NOTHROW(ilc.processResponse(response.getBuffer(), response.getLength())); REQUIRE(ilc.primaryForce == Approx(13.7)); - REQUIRE(isnan(ilc.secondaryForce)); + REQUIRE(std::isnan(ilc.secondaryForce)); } TEST_CASE("Test DAA force actuator readout", "[ElectromechanicalPneumaticILC]") {