From 17e17dac1a229599d9278f032db68c48c3ccc1fb Mon Sep 17 00:00:00 2001 From: Petr Kubanek Date: Thu, 5 Oct 2023 12:29:07 +0200 Subject: [PATCH 1/2] Removed TableLoader and Boost dependency, adjust paths --- .github/workflows/run_tests.yml | 2 +- Dockerfile | 4 +- 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, 37 insertions(+), 160 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/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 3ab25d8f..2dbcf89b 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -12,7 +12,7 @@ jobs: - name: Install dependencies run: | yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - yum install -y make boost-devel catch-devel readline-devel yaml-cpp-devel git + yum install -y make boost-devel catch-devel readline-devel yaml-cpp-devel git fmt-devel - name: Checkout uses: actions/checkout@v2 - name: make junit diff --git a/Dockerfile b/Dockerfile index 78965f70..08931ea8 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,7 +7,7 @@ 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\ 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]") { From 43ae94e1b1791a7a0e99a32d4c5d44c7cfb64ffc Mon Sep 17 00:00:00 2001 From: Petr Kubanek Date: Wed, 25 Oct 2023 14:59:59 +0200 Subject: [PATCH 2/2] AlmaLinux GitHub Workflow --- .github/workflows/run_tests.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 2dbcf89b..91dc2d43 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -3,8 +3,26 @@ name: C/C++ CI on: [push] jobs: + almalinux: + runs-on: ubuntu-latest + name: Test compile on latest AlmaLinux + container: + image: almalinux + steps: + - name: Install dependencies + run: | + dnf install -y epel-release + dnf install -y make g++ catch-devel readline-devel yaml-cpp-devel spdlog-devel + - name: Checkout + uses: actions/checkout@v4 + - name: make junit + run: | + make + make junit || true + centos: runs-on: ubuntu-latest + name: Test compile on Centos7 container: image: centos/devtoolset-7-toolchain-centos7 options: -u root @@ -12,25 +30,28 @@ jobs: - name: Install dependencies run: | yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - yum install -y make boost-devel catch-devel readline-devel yaml-cpp-devel git fmt-devel + yum install -y make catch-devel readline-devel yaml-cpp-devel git - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: make junit run: | git clone https://github.com/gabime/spdlog.git mv spdlog/include/spdlog include/ + git clone https://github.com/fmtlib/fmt + mv fmt/include/fmt include make make junit || true ubuntu: runs-on: ubuntu-latest + name: Test compile on Ubuntu steps: - name: Install dependencies run: | sudo apt update -y - sudo apt install -y make g++ libboost-dev catch libreadline-dev libyaml-cpp-dev libspdlog-dev + sudo apt install -y make g++ catch libreadline-dev libyaml-cpp-dev libspdlog-dev - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: make junit run: | make