On 2024/09/21 5:50, Timofei Zhakov wrote:
> On Fri, Sep 20, 2024 at 11:30 AM Jun Omae <jun6...@gmail.com> wrote:
>>
>> Hi,
>>
>> On 2024/09/16 21:41, rin...@apache.org wrote:
>>> Author: rinrab
>>> Date: Mon Sep 16 12:41:13 2024
>>> New Revision: 1920717
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1920717&view=rev
>>> Log:
>>> Merge the `cmake` branch to trunk.
>>
>> I encounter the following error on all of cmdline.* tests with Visual Studio
>> as cmake generator.
>>
>> [[[
> [...]
>> ]]]
>>
>> The exception is raised when launching <build-dir>/svnadmin.exe because the
>> file is actually located in <build-dir>/Release/svnadmin.exe. It is not
>> raised
>> when cmake with Ninja is used because <build-dir>/svnadmin.exe is located.
>>
>> I think we could use $<TARGET_FILE_DIR:target> instead of
>> ${CMAKE_CURRENT_BINARY_DIR} as a workaround.
>>
>> [[[
>> Index: CMakeLists.txt
>> ===================================================================
>> --- CMakeLists.txt (revision 1920797)
>> +++ CMakeLists.txt (working copy)
>> @@ -671,13 +671,13 @@
>> "cmdline.${py_test_name}"
>> COMMAND
>> "${Python3_EXECUTABLE}"
>> "${CMAKE_CURRENT_SOURCE_DIR}/build/run_tests.py"
>> - --bin ${CMAKE_CURRENT_BINARY_DIR}
>> - --tools-bin ${CMAKE_CURRENT_BINARY_DIR}
>> + --bin $<TARGET_FILE_DIR:svnadmin>
>> + --tools-bin $<TARGET_FILE_DIR:entries-dump>
>> --verbose
>> --log-to-stdout
>> --set-log-level=WARNING
>> ${CMAKE_CURRENT_SOURCE_DIR}
>> - ${CMAKE_CURRENT_BINARY_DIR}
>> + $<TARGET_FILE_DIR:svnadmin>
>> ${py_test_path}
>> )
>> endif()
>> ]]]
>
> Oh, I didn't notice this problem, because I am using a single config
> generator. I think the suggested code is great for resolving the
> issue, because I think there is no generator expression to get the
> target dir in the current config without a specific target. However, I
> think it's better to use svn's target dir since it's the main
> executable and maybe the same for tools (?). It actually should be the
> same for all targets, so it doesn't meter.
>
> Also, I think we should add some multi-config generator tests to the
> GitHub Actions workflow, to prevent similar problems in future.
>
I use "svnadmin" for target directory because we use "svnadmin" to create a
test repository before using "svn" to check out the repository. Well, using
"svn" is okay to me.
Revised the proposed patch, in addition, added use of VS2022 to the matrix:
cmake-test-build-dir.v2.patch.txt (attached).
However, the same issue occurs on ra-test. I think the issue should be occurred
also when Ninja is used with build directory being outside of source tree (e.g.
%TMP%\svn-out). Because "../../svnserve/svnserve.exe" and "svnserve.exe" are
searched.
[[[
40: Test command: D:\a\subversion\subversion\out\Release\ra-test.exe "--srcdir"
"D:/a/subversion/subversion/subversion/tests/libsvn_ra"
40: Working Directory: D:/a/subversion/subversion/out
40: Test timeout computed to be: 10000000
40: PASS: ra-test 1: test svn_ra_get_location_segments
40: PASS: ra-test 2: test ra_svn tunnel callback check
40: svn_tests: E170013: Unable to connect to a repository at URL
'svn+test://localhost/test-repo-tunnel'
40: svn_tests: E200006: Could not find svnserve. Checked paths:
40: D:\a\subversion\svnserve\svnserve.exe
40: D:\a\subversion\subversion\out\svnserve.exe
40: FAIL: ra-test 3: test ra_svn tunnel creation callbacks
40: PASS: ra-test 4: lock multiple paths
40: PASS: ra-test 5: test ra_get_dir2
...
]]]
BTW, I'd like to suggest changing line endings of .github/workflows/cmake.yml
with LF and setting svn:eol-style=native. Currently, "svn diff" of the file on
Unix includes CR....
--
Jun Omae <jun6...@gmail.com> (大前 潤)
Fix cmdline.* tests failing when multi-config generator is used.
* CMakeLists.txt
(): Use `$<TARGET_FILE_DIR:...>` rather than `CMAKE_CURRENT_BINARY_DIR`.
* .github/workflows/cmake.yml
(strategy.matrix): Add VS2022 cmake generator.
(env): Add `CMAKE_GENERATOR`.
(Build CMake): Add `--config Release` parameter.
(Install): Add `--config Release` parameter.
(Run all tests): Add `-C Release` parameter.
Index: .github/workflows/cmake.yml
===================================================================
--- .github/workflows/cmake.yml (revision 1920837)
+++ .github/workflows/cmake.yml (working copy)
@@ -21,22 +21,33 @@ jobs:
- name: Windows, shared, x64, with tests
os: windows-latest
build_shared: ON
+ cmake_generator: Ninja
vcpkg_triplet: x64-windows
arch: x64
run_tests: true
+ - name: Windows, shared, x64, vs2022, with tests
+ os: windows-latest
+ build_shared: ON
+ cmake_generator: 'Visual Studio 17 2022'
+ vcpkg_triplet: x64-windows
+ arch: x64
+ run_tests: true
- name: Windows, shared, x86
os: windows-latest
build_shared: ON
+ cmake_generator: Ninja
vcpkg_triplet: x86-windows
arch: x86
- name: Windows, static, x64, with tests
os: windows-latest
build_shared: OFF
+ cmake_generator: Ninja
vcpkg_triplet: x64-windows-static
arch: x64
run_tests: true
- name: Linux, shared, with tests
os: ubuntu-latest
+ cmake_generator: Ninja
build_shared: ON
run_tests: true
@@ -45,6 +56,7 @@ jobs:
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
+ CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
steps:
- name: Prepare Enviroment (Windows)
@@ -102,7 +114,7 @@ jobs:
- name: Configure CMake
run: >
- cmake -B out -G Ninja
+ cmake -B out
-DBUILD_SHARED_LIBS=${{ matrix.build_shared }}
-DSVN_ENABLE_TESTS=ON
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/installdir
@@ -109,16 +121,16 @@ jobs:
-DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }}
- name: Build CMake
- run: cmake --build out
+ run: cmake --build out --config Release
- name: Install
- run: cmake --install out
+ run: cmake --install out --config Release
- name: Run all tests
id: run_all_tests
if: matrix.run_tests
working-directory: out
- run: ctest --output-on-failure --verbose
+ run: ctest --output-on-failure --verbose -C Release
- name: Rerun failed tests
if: ${{ matrix.run_tests && failure() &&
steps.run_all_tests.conclusion == 'failure' }}
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 1920837)
+++ CMakeLists.txt (working copy)
@@ -670,18 +670,19 @@ if(SVN_ENABLE_TESTS)
get_filename_component(py_test_name ${py_test_path} NAME_WLE)
if(NOT ${py_test_name} STREQUAL "svneditor")
+ set(binary_dir $<TARGET_FILE_DIR:svn>)
add_test(
NAME
"cmdline.${py_test_name}"
COMMAND
"${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/build/run_tests.py"
- --bin ${CMAKE_CURRENT_BINARY_DIR}
- --tools-bin ${CMAKE_CURRENT_BINARY_DIR}
+ --bin ${binary_dir}
+ --tools-bin ${binary_dir}
--verbose
--log-to-stdout
--set-log-level=WARNING
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
+ ${binary_dir}
${py_test_path}
)
endif()