Skip to content

tests: use BOOST_{CHECK,REQUIRE}_TA_ASSERT where a TA_ASSERT is expected - #593

Merged
evaleev merged 1 commit into
masterfrom
evaleev/tests/ta-assert-checks
Sep 24, 2026
Merged

evaleev merged 1 commit into
masterfrom
evaleev/tests/ta-assert-checks

Conversation

@evaleev

@evaleev evaleev commented Sep 24, 2026

Copy link
Copy Markdown
Member

Follow-up to #592. Checks that expect a TA_ASSERT failure should use BOOST_{CHECK,REQUIRE}_TA_ASSERT, which are skipped (with a warning) rather than failing when TA_ASSERT_POLICY != TA_ASSERT_THROW. Checks that expect an exception thrown regardless of policy (TA_EXCEPTION, library range checks, MADNESS_ASSERT) should use plain BOOST_{CHECK,REQUIRE}_THROW.

How sites were classified

Rather than trace each call by hand, BOOST_{CHECK,REQUIRE}_THROW were temporarily redefined as BOOST_*_EXCEPTION with a predicate that logs the site and e.what(), and the np=1 suite was run. TA_ASSERT failures are identifiable by the TA_ASSERT failed: prefix; TA_EXCEPTION by TiledArray: exception at. The 4 sites that run only at np>1 (eigen.cpp ×3, dist_array.cpp find_local) were traced by hand to TA_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 from TA_ASSERT:
    • index_list.cpp, bipartite_index_list.cpp: at() out-of-range from the container
    • dist_op_group.cpp: MADNESS_ASSERT (already guarded by MADNESS_ASSERTIONS_THROW)
  • unit_test_config.h.in: the skip message of BOOST_{CHECK,REQUIRE}_TA_ASSERT said BOOST_{CHECK,REQUIRE}_THROW.

Left unchanged

  • arena_tot_trivial.cpp (add_to/subt_to/axpy_to into a null ToT) and general_product.cpp (GeneralPermutationOptimizer): these throw via TA_EXCEPTION, so *_THROW is correct.
  • tests/bitset.cpp: not listed in tests/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.
  • Not tested: np=2, or a build with TA_ASSERT_POLICY=TA_ASSERT_IGNORE.

🤖 Generated with Claude Code

…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
@evaleev
evaleev merged commit 1d78311 into master Sep 24, 2026
9 checks passed
@evaleev
evaleev deleted the evaleev/tests/ta-assert-checks branch September 24, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant