rename ExpectedStorage::isThis to isSelfAssign so that the self-assign check in opera...
[folly.git] / folly / test / CacheLocalityTest.cpp
index 40732ad89bdc081c6c77a54bbf20ac9732c5f0b0..dd46e79bc1ff067bef13511c08842125c1b25579 100644 (file)
 
 #include <folly/detail/CacheLocality.h>
 
+#include <folly/portability/GTest.h>
+
 #include <sched.h>
 #include <memory>
 #include <thread>
 #include <type_traits>
 #include <unordered_map>
 #include <glog/logging.h>
-#include <gtest/gtest.h>
 
 using namespace folly::detail;
 
@@ -351,12 +352,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) {
@@ -385,6 +388,7 @@ TEST(ThreadId, SimplePthread) {
   EXPECT_EQ(cpu, again);
 }
 
+#ifdef FOLLY_TLS
 static FOLLY_TLS unsigned testingCpu = 0;
 
 static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
@@ -396,6 +400,7 @@ static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
   }
   return 0;
 }
+#endif
 
 TEST(AccessSpreader, Simple) {
   for (size_t s = 1; s < 200; ++s) {
@@ -403,12 +408,12 @@ TEST(AccessSpreader, Simple) {
   }
 }
 
+#ifdef FOLLY_TLS
 #define DECLARE_SPREADER_TAG(tag, locality, func)      \
   namespace {                                          \
   template <typename dummy>                            \
   struct tag {};                                       \
   }                                                    \
-  DECLARE_ACCESS_SPREADER_TYPE(tag)                    \
   namespace folly {                                    \
   namespace detail {                                   \
   template <>                                          \
@@ -440,3 +445,4 @@ TEST(AccessSpreader, Wrapping) {
     }
   }
 }
+#endif