From 1f75ce3e919ad75277144aa86b7a7758a03b2170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20Mar=C3=A9chal?= <45510813+JasonMarechal25@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:20:06 +0100 Subject: [PATCH] Replace INSTANTIATE_TEST_CASE_P by INSTANTIATE_TEST_SUITE_P (#752) INSTANTIATE_TEST_CASE_P is deprecated in newer version of GTest and should be replaced by INSTANTIATE_TEST_SUITE_P Unfortunately on CentOS7, default GTest is too old for INSTANTIATE_TEST_SUITE_P. We need to build it from sources --- .github/workflows/build_centos7.yml | 1 + .github/workflows/compile-gtest/action.yml | 14 ++++++++++++++ tests/cpp/full_run/FullRunTest.cpp | 4 ++-- tests/cpp/lp_namer/ProblemConstructionTest.cpp | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/compile-gtest/action.yml diff --git a/.github/workflows/build_centos7.yml b/.github/workflows/build_centos7.yml index 69cb57bbd..1730199e3 100644 --- a/.github/workflows/build_centos7.yml +++ b/.github/workflows/build_centos7.yml @@ -94,6 +94,7 @@ jobs: with: submodules: true + - uses: ./.github/workflows/compile-gtest - name: Checkout xpressmp linux uses: actions/checkout@v3 with: diff --git a/.github/workflows/compile-gtest/action.yml b/.github/workflows/compile-gtest/action.yml new file mode 100644 index 000000000..ac77c96c5 --- /dev/null +++ b/.github/workflows/compile-gtest/action.yml @@ -0,0 +1,14 @@ +name: "Download and build gtest" +description: "build gtest for centos7" +runs: + using: "composite" + steps: + - id: build-gtest + shell: bash + run: | + source /opt/rh/devtoolset-10/enable + git clone -b v1.14.0 https://github.com/google/googletest.git + cd googletest + cmake3 -G"Unix Makefiles" + make -j8 + make install \ No newline at end of file diff --git a/tests/cpp/full_run/FullRunTest.cpp b/tests/cpp/full_run/FullRunTest.cpp index 5570abded..38f815287 100644 --- a/tests/cpp/full_run/FullRunTest.cpp +++ b/tests/cpp/full_run/FullRunTest.cpp @@ -147,5 +147,5 @@ auto GetData() { {"benders_by_batch", BENDERSMETHOD::BENDERSBYBATCH}, {"mergeMPS", BENDERSMETHOD::MERGEMPS}}); } -INSTANTIATE_TEST_CASE_P(Method, FullRunOptionsParserTestParameterizedMethod, - GetData()); \ No newline at end of file +INSTANTIATE_TEST_SUITE_P(Method, FullRunOptionsParserTestParameterizedMethod, + GetData()); \ No newline at end of file diff --git a/tests/cpp/lp_namer/ProblemConstructionTest.cpp b/tests/cpp/lp_namer/ProblemConstructionTest.cpp index 649c21231..f67483cf4 100644 --- a/tests/cpp/lp_namer/ProblemConstructionTest.cpp +++ b/tests/cpp/lp_namer/ProblemConstructionTest.cpp @@ -35,7 +35,8 @@ TEST_P(ProblemConstructionTest, ExtractSeveralFileNameCase) { auto const& input = GetParam(); EXPECT_EQ(MCYear(input.problem_name), input.expected_mc_year); } -INSTANTIATE_TEST_CASE_P(BulkTest, ProblemConstructionTest, testing::ValuesIn(cases)); +INSTANTIATE_TEST_SUITE_P(BulkTest, ProblemConstructionTest, + testing::ValuesIn(cases)); TEST_F(ProblemConstructionTest, ExtractMCYearFromPath) { std::filesystem::path path = std::filesystem::path("path") / "To" / "inner-dir" / "problem-2-1-20220214-124051.mps";