This is an archive of the discontinued LLVM Phabricator instance.

[test-suite] Avoid segfault in CLAMR test on non-Linux systems
ClosedPublic

Authored by dim on Mar 19 2023, 11:45 AM.

Details

Summary

On FreeBSD, the CLAMR test immediately segfaults on startup, when it
parses /proc/pid/status in the memstats_memused() function. This is
because the parser is not very robust, and the FreeBSD /proc format is
different than Linux.

I expect this code to crash on anything else than Linux, but for our
test purposes the memory statistics printed are not important, since
nobody ever looks at the produced output.

Since there is already a MEMORY define controlling the printing of
memory statistics, only call the memstats_memused() function if it is
explicitly enabled (which it is not, by default).

Diff Detail

Repository
rT test-suite

Event Timeline

dim created this revision.Mar 19 2023, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2023, 11:45 AM
dim requested review of this revision.Mar 19 2023, 11:45 AM
brad added a comment.Mar 22 2023, 8:15 PM

BTW, there is some whitespace on 629.

brad accepted this revision.Mar 22 2023, 8:16 PM
This revision is now accepted and ready to land.Mar 22 2023, 8:16 PM