From b305a2d04a04488ec489313ecac5bd23e0c3e884 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 27 Mar 2025 11:35:29 +0100 Subject: [PATCH] CMake: Make the InitRepository test work in Coin CI Coin CI doesn't provide git info for the qt5.git repo, but only a source archive. The InitRepository test needs the git info to work correctly. When we detect that the test is run in the CI, instead of using the source archive, clone the qt5.git repo from code.qt.io instead. Then fetch and checkout the exact tested ref. Change-Id: I892545c083288a8d32d3f8957bfc64984d52f5fc Reviewed-by: Alexey Edelev --- .../InitRepository/RunCMakeTest.cmake | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake b/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake index 4e93dbd3..0886e318 100644 --- a/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake +++ b/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake @@ -106,12 +106,31 @@ function(run_suite) file(MAKE_DIRECTORY "${tmp_path}") set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${tmp_path}") - # Make a copy of the qt6 repo - run_suite_command(0010_prepare_qt6_clone git clone "${local_clone_url}" qt6 --quiet) + set(code_qt_io_mirror "https://code.qt.io/qt/qt5.git") + set(gerrit_mirror "https://codereview.qt-project.org/qt/qt5") + + # Make a copy of the qt6 repo on which the test will operate on. + # On the CI we clone it from the official mirror, because we don't have a git repo, but only + # a source archive. + # On a local build we use the current qt6 checkout. + set(ci_ref "$ENV{TESTED_MODULE_REVISION_COIN}") + if(ci_ref) + set(final_clone_url "${code_qt_io_mirror}") + else() + set(final_clone_url "${local_clone_url}") + endif() + + run_suite_command(0010_prepare_qt6_clone git clone "${final_clone_url}" qt6 --quiet) set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${qt6_repo_dir}") + # On the CI we also checkout the exact tested ref, so it behaves as it would with locally. + if(ci_ref) + run_suite_command(0011_fetch_ci_qt6_ref git fetch "${gerrit_mirror}" "${ci_ref}" --quiet) + run_suite_command(0012_checkout_ci_qt6_ref git checkout FETCH_HEAD --quiet) + endif() + # Adjust its remote url to be the official mirror rather the local url. - set(remote_clone_url "https://code.qt.io/qt/qt5.git") + set(remote_clone_url "${code_qt_io_mirror}") run_suite_command(0020_set_qt6_remote_url git remote set-url origin "${remote_clone_url}") # Ignore certain lines