BUG: Seven ImageProcessing tests never run under ctest because their names contain a semicolon
メンテナーはふだん 3 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cmake, cpp
- 領域
- testing-qa
調査の方向性
issueで指定されている影響を受ける7つのテストケース、特に BinaryMorphologicalClosingImageFilterTest.cpp から始め、docs/Code_Style_Guide.md の Testing セクションを確認してください。名前を更新した後、影響を受けるテストを ctest で実行し、各完全なテスト名が登録されて実行されることを確認してください。「No test cases matched.」で成功扱いになるのではなく、実際に実行される必要があります。
索引モデルが issue の本文から書いたものです。
説明
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=falseand
both algorithm paths). Both printNo test cases matchedand pass in about 0.02 s.
Occurs on develop at f58acc169595694742cf2afae63ed5e1d3224cf8. The affected test cases:
BinaryMorphologicalClosingImageFilterTest.cppL38 and L104ContourEngineTest.cppL648GrayscaleMorphologicalOpeningImageFilterTest.cppL18GrayscaleMorphologicalClosingImageFilterTest.cppL18WhiteTopHatImageFilterTest.cppL18BlackTopHatImageFilterTest.cppL18
Steps to Reproduce
- Configure a build with
SIMPLNX_BUILD_TESTS=ONand buildImageProcessingUnitTest. - 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. - 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. - Run one fragment with
-V: the command passes" both algorithm paths)"to the executable, Catch2 prints
No test cases matched, and ctest reportsPassed.
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
- 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. - 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.
- 主要言語
- C++
- スター
- 18
- フォーク
- 15
- 平均マージ
- 3日 15時間
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BlueQuartzSoftware/simplnx のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BlueQuartzSoftware/simplnx#1912 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
BlueQuartzSoftware/simplnx#1906 ·
メンテナーはふだん 3 日以内に返信
-
bug Filter
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BlueQuartzSoftware/simplnx#1891 ·
メンテナーはふだん 3 日以内に返信
-
bug Filter
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BlueQuartzSoftware/simplnx#1860 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
BlueQuartzSoftware/simplnx#1847 ·
メンテナーはふだん 3 日以内に返信
BlueQuartzSoftware/simplnx の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
SCIInstitute/SCIRun#2909 ·
メンテナーはふだん 2 日以内に返信
-
bug libcudf
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
Triage: Needed
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信