BUG: Seven ImageProcessing tests never run under ctest because their names contain a semicolon
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cmake, cpp
- Área
- testing-qa
Línea de trabajo
Empieza por los siete casos de prueba afectados que se indican en el issue, especialmente BinaryMorphologicalClosingImageFilterTest.cpp, y revisa la sección Testing de docs/Code_Style_Guide.md. Ejecuta las pruebas afectadas con ctest después de actualizar sus nombres y comprueba que cada nombre de prueba completo esté registrado y se ejecute, en lugar de pasar con «No test cases matched.».
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 18
- Forks
- 15
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 28
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de BlueQuartzSoftware/simplnx
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
BlueQuartzSoftware/simplnx#1906 ·
Los mantenedores suelen responder en 3 días
-
bug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1891 ·
Los mantenedores suelen responder en 3 días
-
bug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BlueQuartzSoftware/simplnx#1860 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
BlueQuartzSoftware/simplnx#1847 ·
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BlueQuartzSoftware/simplnx#1846 ·
Los mantenedores suelen responder en 3 días
Todos los issues de BlueQuartzSoftware/simplnx
Issues similares
-
Code: Performance
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
CrimsonCrossBunker/Cataclysm-Cleanwater-Bomb#1167 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
meshcore-dev/MeshCore#3760 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
deepseek-ai/DeepGEMM-Ascend#29 ·
Los mantenedores suelen responder en 1 día
-
area:lattice bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días