This is an archive of the discontinued LLVM Phabricator instance.

[libc] Use ASSERT_DEATH for EXPECT_DEATH under Fuchsia zxtest
ClosedPublic

Authored by mcgrathr on Aug 2 2023, 2:09 PM.

Details

Summary

The Fuchsia zxtest library has ASSERT_DEATH but not EXPECT_DEATH.
The latter may be added in the future, but for now just use the
former as substitute.

Diff Detail

Event Timeline

mcgrathr created this revision.Aug 2 2023, 2:09 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 2 2023, 2:09 PM
mcgrathr requested review of this revision.Aug 2 2023, 2:09 PM
abrachet accepted this revision.Aug 2 2023, 2:18 PM

I'm guessing because you called it FUNC that llvm-libc's unittest framework takes a callable object and not an expression like gtest.

Should we also wrap this like [&]{ ASSERT_DEATH(FUNC, SIG); }() so EXPECT_DEATH can be used in function with returns non void?

This revision is now accepted and ready to land.Aug 2 2023, 2:18 PM
mcgrathr planned changes to this revision.Aug 2 2023, 2:24 PM

I'm guessing because you called it FUNC that llvm-libc's unittest framework takes a callable object and not an expression like gtest.

Correct.

Should we also wrap this like [&]{ ASSERT_DEATH(FUNC, SIG); }() so EXPECT_DEATH can be used in function with returns non void?

Good idea.

mcgrathr updated this revision to Diff 546659.Aug 2 2023, 5:55 PM

Wrap in a lambda to swallow early returns.

This revision is now accepted and ready to land.Aug 2 2023, 5:55 PM
This revision was landed with ongoing or failed builds.Aug 2 2023, 5:58 PM
This revision was automatically updated to reflect the committed changes.