TEST: Small IN100 Python example tests fail when run alone, because they use files that other tests make and delete
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 50/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cmake, python
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C++
- スター
- 18
- フォーク
- 15
- 平均マージ
- 4日 23時間
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BlueQuartzSoftware/simplnx のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BlueQuartzSoftware/simplnx#1987 ·
メンテナーはふだん 6 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
BlueQuartzSoftware/simplnx#1980 ·
メンテナーはふだん 6 日以内に返信
-
Testing
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BlueQuartzSoftware/simplnx#1979 ·
メンテナーはふだん 6 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
BlueQuartzSoftware/simplnx#1978 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
BlueQuartzSoftware/simplnx#1945 ·
メンテナーはふだん 6 日以内に返信
BlueQuartzSoftware/simplnx の issue をすべて見る
似ている issue
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
26.04 bug dark-mode Easy Hack impress symptom: visual
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CollaboraOnline/online#16421 · コメント 1 件 ·
-
area/cs bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ydb-platform/ydb#59881 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
documentation enhancement lua server
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100