This is an archive of the discontinued LLVM Phabricator instance.

Avoid using stdio in TestVirtual
ClosedPublic

Authored by labath on May 24 2016, 6:22 AM.

Details

Summary

using stdio in tests does not work on windows, and it is not completely reliable on linux.
Avoid using stdio in this test, as it is not necessary for this purpose.

Diff Detail

Event Timeline

labath updated this revision to Diff 58227.May 24 2016, 6:22 AM
labath retitled this revision from to Avoid using stdio in TestVirtual.
labath updated this object.
labath added a reviewer: clayborg.
labath added subscribers: zturner, lldb-commits.
clayborg requested changes to this revision.May 24 2016, 9:54 AM
clayborg edited edge metadata.
clayborg added inline comments.
packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
64

Are we relying on std::string data formatters working here? Seems like a dangerous change as we would require any new ports of LLDB to have std::string formatters working or this test will fail?

This revision now requires changes to proceed.May 24 2016, 9:54 AM
labath added inline comments.May 24 2016, 10:04 AM
packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
64

That did not occur to me. Would shoving the data into a char * be acceptable?

I would just make a large buffer and use snprintf:

char buffer[4096];
char *p = buffer;
char *end = p + sizeof(buffer);
p += snprintf(p, end - p, "a_as_A->a() = '%s'\n", a_as_A->a());
p += snprintf(p, end - p, "a_as_A->b() = '%s'\n", a_as_A->b());
labath updated this revision to Diff 58418.May 25 2016, 7:41 AM
labath edited edge metadata.

New version, which does not rely on pretty-printers.

clayborg accepted this revision.May 25 2016, 9:23 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.May 25 2016, 9:23 AM
This revision was automatically updated to reflect the committed changes.