BUG: Seven ImageProcessing tests never run under ctest because their names contain a semicolon

Đang mở Phù hợp với người mới
#1,898 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@joeykleingers đang làm issue này rồi.

Từ ngày 27/10/2026.

  • #1889 của @joeykleingers — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cmake, cpp
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu với bảy trường hợp kiểm thử bị ảnh hưởng được nêu trong issue, đặc biệt là BinaryMorphologicalClosingImageFilterTest.cpp, và xem phần Testing của docs/Code_Style_Guide.md. Sau khi cập nhật tên, hãy chạy các kiểm thử bị ảnh hưởng bằng ctest, kiểm tra rằng mỗi tên kiểm thử đầy đủ đều được đăng ký và chạy, thay vì vượt qua với thông báo “No test cases matched.”.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug Testing

Problem

Seven ImageProcessing test cases never run under ctest, and ctest reports them as passed. Their names contain a
semicolon, and test discovery splits each name at the semicolon into two ctest entries. Neither entry matches a test
case, so Catch2 runs nothing and exits successfully.

  • Expected: every visible test case is registered with ctest under its full name and runs.
  • Actual: each of these cases becomes two entries such as
    ImageProcessing::BinaryMorphologicalClosingImageFilter: Computed-expected (safeBorder=false and
    both algorithm paths). Both print No test cases matched and pass in about 0.02 s.

Occurs on develop at f58acc169595694742cf2afae63ed5e1d3224cf8. The affected test cases:

Steps to Reproduce

  1. Configure a build with SIMPLNX_BUILD_TESTS=ON and build ImageProcessingUnitTest.
  2. List the registered tests: ctest --test-dir "<build-dir>" -N -R "safeBorder=false$|both algorithm paths\)$|labels differ\)$".
    The list shows the name fragments, not the full names.
  3. Ask ctest for one full name:
    ctest --test-dir "<build-dir>" -R "^ImageProcessing::BinaryMorphologicalClosingImageFilter: Computed-expected \(safeBorder=false; both algorithm paths\)$" --no-tests=error.
    ctest finds no test.
  4. Run one fragment with -V: the command passes " both algorithm paths)" to the executable, Catch2 prints
    No test cases matched, and ctest reports Passed.

Cause

cmake/Plugin.cmake L410 registers the plugin tests with
catch_discover_tests(${UNIT_TEST_TARGET}). In Catch2 2.13.6, the discovery script CatchAddTests.cmake (in the
vcpkg Catch2 package) turns the output of --list-test-names-only into a CMake list and registers one test per
element:

string(REPLACE "\n" ";" output "${output}")
...
foreach(line ${output})

A semicolon is the CMake list separator, so a test name that contains ; becomes two list elements. The script
escapes ,, [ and ] in the test spec it passes to the executable, but nothing protects ;.

Verification Unit Test

The existing test cases are the verification; no new test is needed. For example, from
src/Plugins/ImageProcessing/test/BinaryMorphologicalClosingImageFilterTest.cpp:

TEST_CASE("ImageProcessing::BinaryMorphologicalClosingImageFilter: Computed-expected (safeBorder=false; both algorithm paths)",
          "[ImageProcessing][BinaryMorphologicalClosingImageFilter]")

Command that should run it (in-core Release build of develop, macOS arm64):

ctest --test-dir "<build-dir>" -R "^ImageProcessing::BinaryMorphologicalClosingImageFilter: Computed-expected \(safeBorder=false; both algorithm paths\)$" -j 1 --output-on-failure --timeout 300 --no-tests=error

Observed:

No tests were found!!!
Errors while running CTest

And the fragment that ctest does run:

203: Test command: .../Bin/ImageProcessingUnitTest " both algorithm paths)"
203: No test cases matched 'both algorithm paths)'
1/1 Test #203:  both algorithm paths) ...........   Passed    0.02 sec

Proposed Fix

  1. Replace the ; in the seven test names with , (for example
    Computed-expected (safeBorder=false, both algorithm paths)). Run the seven tests afterwards: they have not run
    under ctest, so they may fail.
  2. Keep it from coming back: add a rule to docs/Code_Style_Guide.md (Testing) that a test case name contains no
    ;, and optionally a CMake check after discovery that fails when a registered name does not match a test case.

Notes

  • Found while checking the test registration for BlueQuartzSoftware/simplnx#1889; that pull request does not change
    this behavior (its split discovery registers the same names).
  • One SimplnxOoc test case has the same problem.
  • Test names with commas, brackets or parentheses register correctly.
Ngôn ngữ chính
C++
Star
18
Fork
15
Merge trung bình
3 ngày 15 giờ
Pull request đã merge (30 ngày)
27

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BlueQuartzSoftware/simplnx

Tất cả issue của BlueQuartzSoftware/simplnx

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.