diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94e4760e3db8504478093024034269fbef324185..20321855abf622dbeaa052393fbb3a112268b6df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,7 +71,7 @@ ubuntu20-tests: - cmake -DENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" ../ # Do not install AOFlagger in this job. The tests should still run. - make -j`nproc` all runtests - - ctest + - ctest --output-on-failure artifacts: paths: - build/*.xml @@ -94,7 +94,7 @@ ubuntu22-tests: - cmake -DENABLE_TESTS=ON -GNinja ../ - ninja all runtests install - ninja check - - ctest + - ctest --output-on-failure - cd python - echo "import aoflagger"|python3 artifacts: diff --git a/CMakeLists.txt b/CMakeLists.txt index 988863c6113bef20d8740d1e586431693a0f5166..5af785ce9c6011e06f52ee32a21699dba2182e5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,7 +521,7 @@ add_custom_target( # TODO(RAP-368) Make a proper integration test target. option(ENABLE_TESTS - "Enable the integration tests, this requires downloading test data" OFF) + "Enable the integration tests. This requires downloading test data." OFF) if(ENABLE_TESTS) find_package(Boost 1.56.0 REQUIRED COMPONENTS unit_test_framework) diff --git a/applications/aoqplot.cpp b/applications/aoqplot.cpp index 390411f6d404b85b48e347041715366fce21b166..7a06f72553e9828692ce025a872f461f35287404 100644 --- a/applications/aoqplot.cpp +++ b/applications/aoqplot.cpp @@ -5,6 +5,8 @@ #include <gtkmm/main.h> #include <gtkmm/filechooserdialog.h> +#include <pangomm/init.h> + #include <version.h> #include "../util/logger.h" @@ -122,6 +124,8 @@ int main(int argc, char* argv[]) { window->Open(files); app->run(*window); } else { + Pango::init(); + if (files.empty()) { Logger::Error << "No observation specified.\n"; return 1; diff --git a/applications/rfigui.cpp b/applications/rfigui.cpp index 0f97a396ec013cc2db94109a7d1f9788c936cb1b..b8f7d674f7a0a9517e29dbb5fd9aba2957687ebc 100644 --- a/applications/rfigui.cpp +++ b/applications/rfigui.cpp @@ -12,6 +12,8 @@ #include <gtkmm/application.h> +#include <pangomm/init.h> + #include <glibmm/error.h> #include <glibmm/wrap.h> @@ -123,7 +125,7 @@ static void run(int argc, char* argv[]) { if (interactive) { app = Gtk::Application::create(altArgc, argv, "", Gio::APPLICATION_HANDLES_OPEN); - window.reset(new RFIGuiWindow(&controller, argv[0])); + window = std::make_unique<RFIGuiWindow>(&controller, argv[0]); window->present(); } @@ -132,6 +134,7 @@ static void run(int argc, char* argv[]) { if (interactive) window->OpenPaths(filenames); else { + Pango::init(); MSOptions options; options.ioMode = DirectReadMode; options.dataColumnName = dataColumnName; diff --git a/rfigui/settings.cpp b/rfigui/settings.cpp index 5286036b6d074ebc48a2b9658324422393048949..3c3f66d33f9a43e8f5e6acb4b8cd7f9ac40eb76f 100644 --- a/rfigui/settings.cpp +++ b/rfigui/settings.cpp @@ -8,6 +8,7 @@ #include <fstream> #include "../lua/default-strategy.h" +#include "../util/logger.h" Settings::Settings() { initStrArray("recent-files", std::vector<std::string>(10)); @@ -25,15 +26,21 @@ std::string Settings::GetStrategyFilename() const { std::string Settings::GetConfigDir() { std::filesystem::path configPath = std::filesystem::path(Glib::get_user_config_dir()) / "aoflagger"; - if (!std::filesystem::is_directory(configPath)) - std::filesystem::create_directory(configPath); + if (!std::filesystem::is_directory(configPath)) { + // We don't want to crash if the dir can't be created; we will just report + // an error to the cmd line + try { + std::filesystem::create_directories(configPath); + } catch (std::exception& exception) { + Logger::Error << "Failed to create config directory: " << exception.what() + << '\n'; + } + } return configPath.string(); } void Settings::InitializeWorkStrategy() { std::string filename = GetStrategyFilename(); - // if(!std::filesystem::exists(filename)) - //{ std::ofstream str(filename); str.write(reinterpret_cast<const char*>(data_strategies_generic_default_lua), data_strategies_generic_default_lua_len); @@ -41,7 +48,6 @@ void Settings::InitializeWorkStrategy() { throw std::runtime_error( "Failed to write working file for Lua strategy: " + filename + ", size " + std::to_string(data_strategies_generic_default_lua_len)); - //} } void Settings::Load() { diff --git a/scripts/test/testconfig.py.in b/scripts/test/testconfig.py.in index 6c2a1507535a531ce3b294f6bd9f4636dd443102..863953876203ded857951331b1f33c2b0e404789 100644 --- a/scripts/test/testconfig.py.in +++ b/scripts/test/testconfig.py.in @@ -2,5 +2,7 @@ SRC_DIR = "@CMAKE_SOURCE_DIR@/test/integration" BIN_DIR = "@CMAKE_BINARY_DIR@" RESOURCE_DIR = "@CMAKE_BINARY_DIR@/test_data" aoflagger = "@CMAKE_BINARY_DIR@/aoflagger" +aoqplot = "@CMAKE_BINARY_DIR@/aoqplot" aoquality = "@CMAKE_BINARY_DIR@/aoquality" +rfigui = "@CMAKE_BINARY_DIR@/rfigui" taql = "@TAQL_EXECUTABLE@" diff --git a/test/integration/tBase.py b/test/integration/tBase.py index fa7c95aa76b53ec58849758bb5bf477ec5ef8652..879d7e3ccb0ea1d9e58a833586615f55f073615f 100644 --- a/test/integration/tBase.py +++ b/test/integration/tBase.py @@ -44,3 +44,21 @@ def test(): ) # Did we write one history record? assert_taql(f"select from {MS}/HISTORY", 1) + + # Test rfigui save baseline functionality (parameters: filename, a1, a2, band, sequence) + # The output isn't checked -- this is just to see if the command succeeds. + check_call( + [ + config.rfigui, + MS, + "-save-baseline", + "baseline-test.pdf", + "0", + "1", + "0", + "0", + ] + ) + + # Test if the statistic plots (pdf files) can be saved. + check_call([config.aoqplot, MS, "-save", "test", "StandardDeviation"])