HomePhabricator

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Authored by dim on May 14 2017, 11:35 AM.

Description

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

llvm-svn: 303015

Details

Committed
dimMay 14 2017, 11:35 AM
Reviewer
krytarowski
Differential Revision
D33171: Fix DynamicLibraryTest.cpp on FreeBSD
Parents
rGee97c5f0125e: [COFF] Gracefully handle empty .drectve sections
Branches
Unknown
Tags
Unknown