This is an archive of the discontinued LLVM Phabricator instance.

[libc++][AIX] Add AIX error message as expected output
ClosedPublic

Authored by ZarkoCA on Feb 16 2022, 3:02 PM.

Details

Summary

AIX's libc generates "Error -1 occurred" instead of the "Unknown Error"
expected by these test cases. Add this as expected output for AIX only.

Diff Detail

Event Timeline

ZarkoCA requested review of this revision.Feb 16 2022, 3:02 PM
ZarkoCA created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 3:02 PM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript
zibi accepted this revision.Feb 16 2022, 6:49 PM
zibi added a subscriber: zibi.

LGTM

daltenty accepted this revision.Feb 17 2022, 8:53 AM

LGTM, just copying the longer rational why the message is expected on AIX.

Looks like it's looking for the fallback message text from do_strerror_r. Which is returned if handle_strerror_r_return generates no message, which it would if strerror_r returned error EINVAL.

According to POSIX for strerror_r:

These functions may fail if:

[EINVAL]
[CX] [Option Start] The value of errnum is neither a valid error number nor zero. [Option End]

That's a may, so I guess libc is ok to return it's own unknown error message string for unknown error codes which it does on AIX.

Quuxplusone accepted this revision.Feb 17 2022, 9:10 AM
Quuxplusone added a subscriber: Quuxplusone.
Quuxplusone added inline comments.
libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
34

Seems reasonable to me, but please pull the preprocessor directives back to column 0:

#if defined(_AIX)
    LIBCPP_ASSERT(msg.rfind("Error -1 occurred", 0) == 0);
#else

etc.

This revision is now accepted and ready to land.Feb 17 2022, 9:10 AM
This revision was automatically updated to reflect the committed changes.