Commit b873a628 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 9

Guard Getcpu in test.

Summary:Guarding this the same way it is done in
detail/CacheLocality.cpp

Reviewed By: yfeldblum

Differential Revision: D3013288

fb-gh-sync-id: a1cc65cccc5cdf32339a739853c27a11ecd98ba0
shipit-source-id: a1cc65cccc5cdf32339a739853c27a11ecd98ba0
parent f3605199
......@@ -252,6 +252,28 @@ if test "$folly_cv_lib_libatomic" = no; then
[Please install the GNU Atomic library])])
fi
AC_CACHE_CHECK(
[for liblinux-vdso support],
[folly_cv_lib_liblinux_vdso],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM[
#include <dlfcn.h>
int main() {
void *h = dlopen("linux-vdso.so.1", RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
if (h == nullptr) {
return -1;
}
dlclose(h);
return 0;
}
]],
[folly_cv_lib_liblinux_vdso=yes],
[folly_cv_lib_liblinux_vdso=no])])
if test "$folly_cv_lib_liblinux_vdso" = yes; then
AC_DEFINE([HAVE_LINUX_VDSO], [1], [Define to 1 if liblinux-vdso is available])
fi
AC_CACHE_CHECK(
[for usable std::is_trivially_copyable],
[folly_cv_decl_std_is_trivially_copyable],
......
......@@ -210,7 +210,7 @@ CacheLocality CacheLocality::uniform(size_t numCpus) {
////////////// Getcpu
Getcpu::Func Getcpu::resolveVdsoFunc() {
#if defined(_MSC_VER) || defined(__BIONIC__)
#if !FOLLY_HAVE_LINUX_VDSO
return nullptr;
#else
void* h = dlopen("linux-vdso.so.1", RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
......
......@@ -351,12 +351,14 @@ TEST(CacheLocality, FakeSysfs) {
EXPECT_EQ(expected.localityIndexByCpu, parsed.localityIndexByCpu);
}
#if FOLLY_HAVE_LINUX_VDSO
TEST(Getcpu, VdsoGetcpu) {
unsigned cpu;
Getcpu::resolveVdsoFunc()(&cpu, nullptr, nullptr);
EXPECT_TRUE(cpu < CPU_SETSIZE);
}
#endif
#ifdef FOLLY_TLS
TEST(ThreadId, SimpleTls) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment