OSDN Git Service

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD
authorDimitry Andric <dimitry@andric.com>
Sun, 14 May 2017 18:35:38 +0000 (18:35 +0000)
committerDimitry Andric <dimitry@andric.com>
Sun, 14 May 2017 18:35:38 +0000 (18:35 +0000)
commita435f21458d9b7098acff1b1b602aa755d62f341
treea6de953e4ff4edcb09dc52781949aa5fdc65d9d7
parent61e19cf8a48519f3f96081b5ea0fa7cba942926d
Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

Differential Revision: https://reviews.llvm.org/D33171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303015 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Unix/Path.inc
unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp