TEST: Small IN100 Python example tests fail when run alone, because they use files that other tests make and delete
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 50/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, python
- Lĩnh vực
- build-system, testing-qa
Hướng nghiên cứu
Start with CreatePythonTests and AddPythonTest in cmake/Utility.cmake, and the test list in wrapping/python/examples/pipelines/SourceList.cmake. Reproduce by clearing Bin/Data/Output and running ctest -R on a single PY::OrientationAnalysis test, such as ComputeGBCD-GBPDMetricBased. Done means that test passes alone, and the full serial suite passes twice in a row, using CTest fixtures with setup and cleanup tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The Small IN100 Python example tests (PY::OrientationAnalysis_*) form a chain. Each test reads a .dream3d file that an earlier test wrote. Many tests also delete their input file at the end.
The chain works only when CTest runs the whole list, in order, in one run. CTest does not know about the chain. No test declares a dependency, so CTest cannot run the producer tests first.
So a test fails when you run it alone, re-run it after a failure, or select it with -R. It also fails on the second run of a subset, because the last test of the full chain deletes the shared input.
Checked on develop 10e4a072c and on branch topic/correct_feature_am_updates.
How the chain works
The order exists only as the list order in SourceList.cmake#L59-L82. The comments say "Depends ..." but CMake does not read them.
CreatePythonTests and AddPythonTest in cmake/Utility.cmake#L477-L545 set only the ENVIRONMENT property. No test has FIXTURES_SETUP, FIXTURES_REQUIRED, FIXTURES_CLEANUP or DEPENDS. (git grep FIXTURES_ finds nothing in the repository.)
These tests delete their input with nxtest.cleanup_test_file(...):
| Test | Reads | Deletes |
|---|---|---|
08_Small_IN100_Full_Reconstruction |
Reconstruction/Small_IN100.h5ebsd |
its input |
01_Small_IN100_Morphological_Statistics |
Reconstruction/SmallIN100_Final.dream3d |
its input |
05_Small_IN100_Crystallographic_Statistics |
Statistics/SmallIN100_Morph.dream3d |
its input |
01_Small_IN100_Quick_Mesh |
Statistics/SmallIN100_CrystalStats.dream3d |
its input |
02_Small_IN100_Smooth_Mesh |
SurfaceMesh/SmallIN100_Mesh.dream3d |
its input |
03_Small_IN100_Mesh_Statistics |
SurfaceMesh/SmallIN100_Smoothed.dream3d |
its input |
05_Small_IN100_GBCD_Metric |
SurfaceMesh/SmallIN100_MeshStats.dream3d |
its input and its output |
ComputeGBCD-GBPDMetricBased and 04_Small_IN100_GBCD also read SmallIN100_MeshStats.dream3d. ComputeBiasedFeatures also reads SmallIN100_CrystalStats.dream3d. They delete nothing, so they depend on the order of the deleting tests.
Steps to reproduce
-
Build with Python enabled. Run the full suite serially once. All 17
PY::OrientationAnalysis_*tests pass. -
Run one test again:
ctest -R "^PY::OrientationAnalysis_ComputeGBCD-GBPDMetricBased$" --output-on-failure -
The test fails. The input was deleted at the end of step 1 by
05_Small_IN100_GBCD_Metric.py(line 143):nx::core::ReadDREAM3DFilter :: Errors: [<simplnx.Error(code=-2, message='Path '.../Bin/Data/Output/SurfaceMesh/SmallIN100_MeshStats.dream3d' does not exist')>] -
The same happens for
PY::OrientationAnalysis_01_Small_IN100_Quick_Mesh:nx::core::ReadDREAM3DFilter :: Errors: [<simplnx.Error(code=-2, message='Path '.../Bin/Data/Output/Statistics/SmallIN100_CrystalStats.dream3d' does not exist')>]
Expected behavior
- A test that needs a file from another test gets that file, also when it runs alone or with
-R. ctest --rerun-failedre-runs a failed chain test with the tests it needs.
Actual behavior
- Every chain test except
01_Small_IN100_Archivefails when it runs without the tests before it. - A failure early in the chain makes every later test fail with "does not exist". This hides the first real failure in CI logs.
Suggested fix
Use CTest fixtures. Then CTest adds the required tests by itself when you select one test.
- Extend
CreatePythonTests(orAddPythonTest) with optionalSETUP,REQUIRESandCLEANUParguments. Map them toFIXTURES_SETUP,FIXTURES_REQUIREDandFIXTURES_CLEANUP. - Give each producer test one fixture name for the file it writes. Example:
03_Small_IN100_Mesh_Statisticssets upSmallIN100_MeshStats. - Give each consumer test
FIXTURES_REQUIREDfor the files it reads. Example:ComputeGBCD-GBPDMetricBased,04_Small_IN100_GBCDand05_Small_IN100_GBCD_MetricrequireSmallIN100_MeshStats. - Remove
nxtest.cleanup_test_file(import_data.file_path)from the consumer scripts. A consumer must not delete a file that another consumer may still need. Add one small cleanup test per shared file (a Python orcmake -E rmcommand) withFIXTURES_CLEANUP. CTest runs it after the last test that requires the fixture. - Keep the list order in
SourceList.cmake. Fixtures do not change the order of a full serial run. - Keep
RUN_SERIALbehavior. The project does not run these tests in parallel (noctest -j).
Notes:
- A single test now pulls in its whole chain. For
ComputeGBCD-GBPDMetricBasedthat is 01_Archive, 08, Morphological, Crystallographic, Quick_Mesh, Smooth_Mesh and Mesh_Statistics. This is slower, but the result is correct. - An alternative is to give long chains a published input archive (for example a
SmallIN100_MeshStats.dream3din the Data Archive). Then each consumer reads fixed data and the chain is shorter. - The
PIPELINE::OrientationAnalysis::Small_IN100_Processing-*tests insrc/Plugins/OrientationAnalysis/test/CMakeLists.txt(add_pipeline_testwithINPUT_FILE_LIST/DELETE_FILE_LIST) have the same design. They check that the input exists and give a clear message, but they also have no fixtures. The same fix can apply there.
How to test the fix
- Delete
Bin/Data/Output. Runctest -R "^PY::OrientationAnalysis_ComputeGBCD-GBPDMetricBased$". CTest runs the setup chain first, and the test passes. - Run
ctest -R "^PY::OrientationAnalysis_01_Small_IN100_Quick_Mesh$"on a clean data folder. It passes. - Run the full suite serially twice in a row. Both runs pass.
- After a full run, the shared intermediate files (for example
SmallIN100_MeshStats.dream3d) are deleted by the cleanup tests, as they are today.
Found during review of branch topic/correct_feature_am_updates.
- Ngôn ngữ chính
- C++
- Star
- 18
- Fork
- 15
- Merge trung bình
- 4 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của BlueQuartzSoftware/simplnx
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BlueQuartzSoftware/simplnx#1987 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
BlueQuartzSoftware/simplnx#1980 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
BlueQuartzSoftware/simplnx#1979 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
BlueQuartzSoftware/simplnx#1978 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
BlueQuartzSoftware/simplnx#1945 ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của BlueQuartzSoftware/simplnx
Issue tương tự
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
26.04 bug dark-mode Easy Hack impress symptom: visual
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CollaboraOnline/online#16421 · 1 bình luận ·
-
area/cs bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ydb-platform/ydb#59881 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement lua server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100