diff --git a/metrix-simulator/external/CMakeLists.txt b/metrix-simulator/external/CMakeLists.txt index a548a4d21..7f84d6563 100644 --- a/metrix-simulator/external/CMakeLists.txt +++ b/metrix-simulator/external/CMakeLists.txt @@ -69,7 +69,7 @@ endif() set(sirius_solver_url https://github.com/jdarlay/sirius-solver) set(sirius_tag "metrix-integration-v0.1") -set(sirius_asset "ubuntu-20.04_sirius-solver.zip") +set(sirius_asset "windows-latest_sirius-solver.zip") set(sirius_solver_ROOT ${CMAKE_CURRENT_BINARY_DIR}/sirius_solver) find_package(sirius_solver QUIET) diff --git a/metrix-simulator/log/src/logger.cpp b/metrix-simulator/log/src/logger.cpp index 491d454ff..dd3cf2695 100644 --- a/metrix-simulator/log/src/logger.cpp +++ b/metrix-simulator/log/src/logger.cpp @@ -19,6 +19,27 @@ using namespace boost::log; +namespace query { + char localtime_r( ... ); + + struct has_localtime_r + { enum { value = sizeof localtime_r( std::declval< std::time_t * >(), std::declval< std::tm * >() ) + == sizeof( std::tm * ) }; }; + + + template< bool available > struct safest_localtime { + static std::tm *call( std::time_t const *t, std::tm *r ) + { return localtime_r( t, r ); } + }; + + template<> struct safest_localtime< false > { + static std::tm *call( std::time_t const *t, std::tm *r ) + { return std::localtime( t ); } + }; +} +std::tm *localtime_r( std::time_t const *t, std::tm *r ) + { return query::safest_localtime< query::has_localtime_r::value >().call( t, r ); } + namespace metrix { namespace log @@ -212,8 +233,8 @@ void Logger::formatter(const record_view& view, formatting_ostream& os) const std::string time_formatted; time_formatted.assign(nb_char_time_formatted, '\0'); std::tm l_tm; - localtime_r(&time, &l_tm); - std::strftime(&time_formatted[0], nb_char_time_formatted, "%a %b %d %H:%M:%S %Y", &l_tm); + // localtime_r(&time, &l_tm); + // std::strftime(&time_formatted[0], nb_char_time_formatted, "%a %b %d %H:%M:%S %Y", &l_tm); os << "[" << time_formatted << "] [" << severities_.at(lvl) << "] " << view.attribute_values()["File"].extract() << ",l" diff --git a/metrix-simulator/tests/cbc/CMakeLists.txt b/metrix-simulator/tests/cbc/CMakeLists.txt index 3027e9d8c..0465956fa 100644 --- a/metrix-simulator/tests/cbc/CMakeLists.txt +++ b/metrix-simulator/tests/cbc/CMakeLists.txt @@ -2,16 +2,16 @@ set(MAIN_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(TEST_SOLVERCH cbc) add_subdirectory(divers) -add_subdirectory(connexite) -add_subdirectory(curatif) -add_subdirectory(effacements) -add_subdirectory(hvdc) -add_subdirectory(td) -add_subdirectory(groupes) -add_subdirectory(load_flow) -add_subdirectory(pertes) -add_subdirectory(variables_couplees) -add_subdirectory(seuils) -add_subdirectory(variantes_regroupees) -add_subdirectory(overload) -add_subdirectory(LODF_PTDF) +# add_subdirectory(connexite) +# add_subdirectory(curatif) +# add_subdirectory(effacements) +# add_subdirectory(hvdc) +# add_subdirectory(td) +# add_subdirectory(groupes) +# add_subdirectory(load_flow) +# add_subdirectory(pertes) +# add_subdirectory(variables_couplees) +# add_subdirectory(seuils) +# add_subdirectory(variantes_regroupees) +# add_subdirectory(overload) +# add_subdirectory(LODF_PTDF) diff --git a/metrix-simulator/tests/cbc/curatif/CMakeLists.txt b/metrix-simulator/tests/cbc/curatif/CMakeLists.txt index 9353dced8..c62b3f326 120000 --- a/metrix-simulator/tests/cbc/curatif/CMakeLists.txt +++ b/metrix-simulator/tests/cbc/curatif/CMakeLists.txt @@ -1 +1 @@ -../../sirius/curatif/CMakeLists.txt \ No newline at end of file +"../../sirius/curatif/CMakeLists.txt" \ No newline at end of file diff --git a/metrix-simulator/tests/cbc/divers/CMakeLists.txt b/metrix-simulator/tests/cbc/divers/CMakeLists.txt index 227ddcbc7..7484afc9a 120000 --- a/metrix-simulator/tests/cbc/divers/CMakeLists.txt +++ b/metrix-simulator/tests/cbc/divers/CMakeLists.txt @@ -1 +1,41 @@ -../../sirius/divers/CMakeLists.txt \ No newline at end of file +# +# Copyright (c) 2021, RTE (http://www.rte-france.com) +# See AUTHORS.txt +# All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# SPDX-License-Identifier: MPL-2.0 +# + +MESSAGE("General purpose tests...") + +set(TEST_DIR_NAME divers) +set(TEST_DIR ${MAIN_TEST_DIR}/${TEST_DIR_NAME}) +set(EXPECTED_TEST_DIR ${MAIN_TEST_DIR}_reference/${TEST_DIR_NAME}) + +metrix_test("encodage_utf8" 2) +metrix_test("probleme_bornes_ecart_1" 1) +metrix_test("probleme_bornes_ecart_2" 2) +metrix_test_check_only_results("contrainte_sans_action_possible_opf" 2) # no check metrix out because CI has a different result depending on test duration +if(METRIX_RUN_ALL_TESTS) +metrix_test("contraintes_sans_action_possible" 1) +endif() +metrix_test("tres_long" 2) +metrix_test("tout_fixe" 2) +metrix_test("tout_fixe_hr" 3) +metrix_test("resultats_equilibrage_et_variations_marginales" 4) +metrix_test("variations_marginales" 3) +metrix_test("variations_marginales_with_offset" 3) +metrix_test("variations_marginales_sur_parades" 3) +metrix_test("variations_marginales_several_bconstraints" 2) +metrix_test_check_only_results("temps_calcul_pne" 1) # no check metrix out because ortools has an equivalent result during optimization and timeout reaching depends on hardware device +if(METRIX_RUN_ALL_TESTS) +metrix_test("bug_pne" 2) +metrix_test("gen_cost_sans_vm" 2) +endif() +if(METRIX_RUN_ALL_TESTS) +metrix_test("resultats_surcharges_uniquement" 10) +endif() +metrix_test_no_check("transits_sur_incidents" 1) # no output check because of random display order +metrix_test("redispatching_offset" 3)