tests: use BOOST_{CHECK,REQUIRE}_TA_ASSERT where a TA_ASSERT is expected - #593
Merged
Merged
Conversation
…A_ASSERT
Checks that expect a TA_ASSERT failure must use BOOST_{CHECK,REQUIRE}_TA_ASSERT
so that they are skipped (not failed) when TA_ASSERT_POLICY != TA_ASSERT_THROW.
- convert 50 BOOST_{CHECK,REQUIRE}_THROW sites whose exception originates in a
TA_ASSERT (range, block_range, initializer_list, eigen, dist_array,
tot_dist_array_part{1,2}, tensor, distributed_storage, expressions_impl.h)
- convert 8 BOOST_CHECK_TA_ASSERT sites back to BOOST_CHECK_THROW since the
exception does not come from TA_ASSERT: container at() range checks
(index_list, bipartite_index_list) and MADNESS_ASSERT (dist_op_group,
already guarded by MADNESS_ASSERTIONS_THROW)
- fix the skip message of BOOST_{CHECK,REQUIRE}_TA_ASSERT, which named
BOOST_{CHECK,REQUIRE}_THROW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #592. Checks that expect a
TA_ASSERTfailure should useBOOST_{CHECK,REQUIRE}_TA_ASSERT, which are skipped (with a warning) rather than failing whenTA_ASSERT_POLICY != TA_ASSERT_THROW. Checks that expect an exception thrown regardless of policy (TA_EXCEPTION, library range checks,MADNESS_ASSERT) should use plainBOOST_{CHECK,REQUIRE}_THROW.How sites were classified
Rather than trace each call by hand,
BOOST_{CHECK,REQUIRE}_THROWwere temporarily redefined asBOOST_*_EXCEPTIONwith a predicate that logs the site ande.what(), and the np=1 suite was run.TA_ASSERTfailures are identifiable by theTA_ASSERT failed:prefix;TA_EXCEPTIONbyTiledArray: exception at. The 4 sites that run only at np>1 (eigen.cpp×3,dist_array.cppfind_local) were traced by hand toTA_ASSERT.Changes
*_THROW→*_TA_ASSERT(50 sites): range, block_range, initializer_list, eigen, dist_array, tot_dist_array_part{1,2}, tensor, distributed_storage, expressions_impl.h.*_TA_ASSERT→*_THROW(8 sites), because the exception does not come fromTA_ASSERT:index_list.cpp,bipartite_index_list.cpp:at()out-of-range from the containerdist_op_group.cpp:MADNESS_ASSERT(already guarded byMADNESS_ASSERTIONS_THROW)unit_test_config.h.in: the skip message ofBOOST_{CHECK,REQUIRE}_TA_ASSERTsaidBOOST_{CHECK,REQUIRE}_THROW.Left unchanged
arena_tot_trivial.cpp(add_to/subt_to/axpy_tointo a null ToT) andgeneral_product.cpp(GeneralPermutationOptimizer): these throw viaTA_EXCEPTION, so*_THROWis correct.tests/bitset.cpp: not listed intests/CMakeLists.txt, so it is never compiled. It is a candidate for removal or re-enabling in a separate change.The pre-commit clang-format hook also re-wrapped a few unrelated, previously misformatted lines in the touched files.
Testing
ta_test --run_test='!@distributed'(np=1, Debug,TA_ASSERT_THROW) passes.TA_ASSERT_POLICY=TA_ASSERT_IGNORE.🤖 Generated with Claude Code