Skip to content

Commit eabd87b

Browse files
committed
Fix restart statistics tests failing on second run or individual runs
1 parent 68d90cc commit eabd87b

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

tests/multio/action/statistics/restart/CMakeLists.txt

+51-52
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ set(RESTART_MAIN_FOLDER "NamesAreNotGuaranteedToBeUniqueAcrossPlans_0")
3636
set(RESULT_FILE "Result_chunks_0_of_11.grib")
3737
set(RESTART_ID "none")
3838

39+
ecbuild_add_test(
40+
TARGET ${PREFIX}_clean_dir
41+
COMMAND ${CMAKE_COMMAND}
42+
ARGS -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/${RESTART_MAIN_FOLDER}
43+
)
44+
set_tests_properties(${PREFIX}_clean_dir PROPERTIES
45+
FIXTURES_SETUP ${PREFIX}_clean_dir
46+
)
47+
3948
ecbuild_add_test(
4049
TARGET ${PREFIX}_run_0-24_new_restart
4150
CONDITION HAVE_ATLAS_IO
@@ -44,21 +53,11 @@ ecbuild_add_test(
4453
COMMAND multio-feed
4554
ARGS --stepRange=0-24 --decode --plans=${CMAKE_CURRENT_SOURCE_DIR}/test-restart.yaml standard_0_statistics_test_data.grib
4655
)
56+
set_tests_properties(${PREFIX}_run_0-24_new_restart PROPERTIES
57+
FIXTURES_SETUP ${PREFIX}_run_0-24_new_restart
58+
FIXTURES_REQUIRED ${PREFIX}_clean_dir
59+
)
4760

48-
# ecbuild_add_test(
49-
# TARGET ${PREFIX}_check_metadata_0-24_new_restart
50-
# TEST_DEPENDS ${PREFIX}_run_0-24_new_restart
51-
# ARGS -H "Result_chunks_0_of_11.grib" "Reference_chunks_0_of_11.grib"
52-
# COMMAND grib_compare
53-
# )
54-
#
55-
# ecbuild_add_test(
56-
# TARGET ${PREFIX}_check_values_0-24_new_restart
57-
# TEST_DEPENDS ${PREFIX}_check_metadata_0-24_new_restart
58-
# ARGS -P -T10 "Result_chunks_0_of_11.grib" "Reference_chunks_0_of_11.grib"
59-
# COMMAND grib_compare
60-
# )
61-
#
6261
# Set the number of steps and loop through them
6362
set(NUM_STEPS 11)
6463
set( prevStepRange "0-24" )
@@ -82,27 +81,16 @@ foreach(i RANGE 1 ${NUM_STEPS})
8281

8382
# Run the multio-feed command
8483
ecbuild_add_test(
85-
TARGET ${PREFIX}_run_${stepRange}_new_restart
86-
CONDITION HAVE_ATLAS_IO
87-
TEST_DEPENDS ${PREFIX}_check_metadata_${prevStepRange}_new_restart
88-
ENVIRONMENT READ_RESTART=${READ_RESTART} WRITE_RESTART=${WRITE_RESTART} RESTART_MAIN_FOLDER=${RESTART_MAIN_FOLDER} RESULT_FILE=${RESULT_FILE} RESTART_ID=${RESTART_ID}
89-
COMMAND multio-feed
90-
ARGS --stepRange=${stepRange} --decode --plans=${CMAKE_CURRENT_SOURCE_DIR}/test-restart.yaml standard_0_statistics_test_data.grib
84+
TARGET ${PREFIX}_run_${stepRange}_new_restart
85+
CONDITION HAVE_ATLAS_IO
86+
ENVIRONMENT READ_RESTART=${READ_RESTART} WRITE_RESTART=${WRITE_RESTART} RESTART_MAIN_FOLDER=${RESTART_MAIN_FOLDER} RESULT_FILE=${RESULT_FILE} RESTART_ID=${RESTART_ID}
87+
COMMAND multio-feed
88+
ARGS --stepRange=${stepRange} --decode --plans=${CMAKE_CURRENT_SOURCE_DIR}/test-restart.yaml standard_0_statistics_test_data.grib
89+
)
90+
set_tests_properties(${PREFIX}_run_${stepRange}_new_restart PROPERTIES
91+
FIXTURES_SETUP ${PREFIX}_run_${stepRange}_new_restart
92+
FIXTURES_REQUIRED ${PREFIX}_run_${prevStepRange}_new_restart
9193
)
92-
93-
# ecbuild_add_test(
94-
# TARGET ${PREFIX}_check_metadata_${stepRange}_new_restart
95-
# TEST_DEPENDS ${PREFIX}_run_${stepRange}_new_restart
96-
# ARGS -H "Result_chunks_${i}_of_11.grib" "Reference_chunks_${i}_of_11.grib"
97-
# COMMAND grib_compare
98-
# )
99-
#
100-
# ecbuild_add_test(
101-
# TARGET ${PREFIX}_check_values_${stepRange}_new_restart
102-
# TEST_DEPENDS ${PREFIX}_check_metadata_${stepRange}_new_restart
103-
# ARGS -P -T10 "Result_chunks_${i}_of_11.grib" "Reference_chunks_${i}_of_11.grib"
104-
# COMMAND grib_compare
105-
# )
10694

10795
set( prevStepRange "${stepRange}" )
10896

@@ -124,34 +112,45 @@ ecbuild_add_test(
124112
COMMAND multio-feed
125113
ARGS --decode --plans=${CMAKE_CURRENT_SOURCE_DIR}/test-restart.yaml standard_0_statistics_test_data.grib
126114
)
115+
set_tests_properties(${PREFIX}_run_single_chunk_new_restart PROPERTIES
116+
FIXTURES_SETUP ${PREFIX}_run_single_chunk_new_restart
117+
FIXTURES_REQUIRED ${PREFIX}_clean_dir
118+
)
127119

128120
ecbuild_add_test(
129-
TARGET ${PREFIX}_check_metadata_single_chunk_new_restart
130-
TEST_DEPENDS ${PREFIX}_run_single_chunk_new_restart
131-
ARGS -H "Result_single_chunk.grib" "Reference_single_chunk.grib"
132-
COMMAND grib_compare
121+
TARGET ${PREFIX}_check_metadata_single_chunk_new_restart
122+
ARGS -H "Result_single_chunk.grib" "Reference_single_chunk.grib"
123+
COMMAND grib_compare
124+
)
125+
set_tests_properties(${PREFIX}_check_metadata_single_chunk_new_restart PROPERTIES
126+
FIXTURES_REQUIRED "${PREFIX}_run_${stepRange}_new_restart;${PREFIX}_run_single_chunk_new_restart"
133127
)
134128

135129
ecbuild_add_test(
136-
TARGET ${PREFIX}_check_values_single_chunk_new_restart
137-
TEST_DEPENDS ${PREFIX}_check_metadata_single_chunk_new_restart
138-
ARGS -P -T10 "Result_single_chunk.grib" "Reference_single_chunk.grib"
139-
COMMAND grib_compare
130+
TARGET ${PREFIX}_check_values_single_chunk_new_restart
131+
ARGS -P -T10 "Result_single_chunk.grib" "Reference_single_chunk.grib"
132+
COMMAND grib_compare
133+
)
134+
set_tests_properties(${PREFIX}_check_values_single_chunk_new_restart PROPERTIES
135+
FIXTURES_REQUIRED "${PREFIX}_run_${stepRange}_new_restart;${PREFIX}_run_single_chunk_new_restart"
140136
)
141-
142137

143138
#
144139
# Final comparison
145140
ecbuild_add_test(
146-
TARGET ${PREFIX}_check_metadata_singleVSrestart_chunk_new_restart
147-
TEST_DEPENDS ${PREFIX}_check_values_single_chunk_new_restart
148-
ARGS -H "Result_chunks_11_of_11.grib" "Result_single_chunk.grib"
149-
COMMAND grib_compare
141+
TARGET ${PREFIX}_check_metadata_singleVSrestart_chunk_new_restart
142+
ARGS -H "Result_chunks_11_of_11.grib" "Result_single_chunk.grib"
143+
COMMAND grib_compare
144+
)
145+
set_tests_properties(${PREFIX}_check_metadata_singleVSrestart_chunk_new_restart PROPERTIES
146+
FIXTURES_REQUIRED "${PREFIX}_run_${stepRange}_new_restart;${PREFIX}_run_single_chunk_new_restart"
150147
)
151148

152149
ecbuild_add_test(
153-
TARGET ${PREFIX}_check_values_singleVSrestart_chunk_new_restart
154-
TEST_DEPENDS ${PREFIX}_check_metadata_singleVSrestart_chunk_new_restart
155-
ARGS -P -T10 "Result_chunks_11_of_11.grib" "Result_single_chunk.grib"
156-
COMMAND grib_compare
157-
)
150+
TARGET ${PREFIX}_check_values_singleVSrestart_chunk_new_restart
151+
ARGS -P -T10 "Result_chunks_11_of_11.grib" "Result_single_chunk.grib"
152+
COMMAND grib_compare
153+
)
154+
set_tests_properties(${PREFIX}_check_values_singleVSrestart_chunk_new_restart PROPERTIES
155+
FIXTURES_REQUIRED "${PREFIX}_run_${stepRange}_new_restart;${PREFIX}_run_single_chunk_new_restart"
156+
)

0 commit comments

Comments
 (0)