This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Adjust TestExec code to be closer to real world code
ClosedPublic

Authored by teemperor on Feb 27 2020, 4:38 AM.

Details

Summary

For some reason the TestExec test on the macOS bots randomly fails with this error:

output: * thread #2, stop reason = EXC_BAD_ACCESS (code=1, address=0x108e66000)
  * frame #0: 0x0000000108e66000
[...]
  File "/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/API/functionalities/exec/TestExec.py", line 25, in test_hitting_exec
    self.do_test(False)
  File "/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/API/functionalities/exec/TestExec.py", line 113, in do_test
    "Stopped at breakpoint in exec'ed process.")
AssertionError: False is not True : Stopped at breakpoint in exec'ed process.
Config=x86_64-/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/clang-11

I don't know why the test program is failing and I couldn't reproduce this problem on my own.
This patch is a stab in the dark that just tries to make the test code more similar to code which
we would expect in a user program to make whatever part of macOS happy that is currently
not liking our code.

The actual changes are:

  • We pass in argv[0] that is describing otherprog path instead of the current argv[0].
  • We pass in a non-null envp (which anyway doesn't seem to be allowed on macOS man page).

Diff Detail

Event Timeline

teemperor created this revision.Feb 27 2020, 4:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2020, 4:39 AM
labath accepted this revision.Feb 27 2020, 5:50 AM

Linux seems to allow a NULL for envp, but it does caution about the unportability of that practice. I doubt changing the argv[0] would be a problem, as that is a fairly common practice, but we can try it anyway.

Instead of passing the environ array you could just call execv...

This revision is now accepted and ready to land.Feb 27 2020, 5:50 AM
This revision was automatically updated to reflect the committed changes.