This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][pretty printers] Report not being able to trace test program
ClosedPublic

Authored by DavidSpickett on Oct 1 2021, 7:37 AM.

Details

Summary

If you don't have ptrace permissions this test will fail to run
silently, this adds a check for that and anything else that
might do similar things.

The output will now be:

FAILED test program did not run correctly, check gdb warnings

/usr/bin/gdb: warning: Couldn't determine a path for the index cache
directory.
No symbol table is loaded.  Use the "file" command.
warning: Error disabling address space randomization: Operation not
permitted
warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted

error: command failed with exit status: 255

We already have a feature to check for a compatible python enabled
gdb, so I think it's reasonable to check for this at test runtime.

Note that this is different to the catch all at the end of the test
script. That would be a case where you can trace but something else
made it stop mid way that wasn't our test breakpoints.

Diff Detail

Event Timeline

DavidSpickett requested review of this revision.Oct 1 2021, 7:37 AM
DavidSpickett created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 7:37 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

I found this testing with the CI docker image. By default my docker doesn't give ptrace permissions to the container, --cap-add=SYS_PTRACE fixes that.

If you think having that capability for the existing CI machines is going to be an issue I can come up with a way to feature test this up front instead.

None of them get as far as running this test so it's hard to tell whether they already have it. I was manually building a focal based image that's how I got it to run.

saugustine accepted this revision.Oct 4 2021, 10:27 AM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 7 2021, 3:02 AM
This revision was automatically updated to reflect the committed changes.