Commit 96600045 authored by Tudor Bosman's avatar Tudor Bosman

Fix build and test.

Summary:
Fix bug in FBStringTest (don't reuse the same file name)

Don't use VLOG, as that requires that glog is compiled with gflags
support, which it isn't always.

Add other targets and tests, make all tests pass.

Test Plan: tests

Reviewed By: delong.j@fb.com

FB internal diff: D493018
parent 987da6d2
...@@ -2,84 +2,118 @@ SUBDIRS = . test ...@@ -2,84 +2,118 @@ SUBDIRS = . test
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
noinst_PROGRAMS = generate_fingerprint_tables
generate_fingerprint_tables_SOURCES = build/GenerateFingerprintTables.cpp
generate_fingerprint_tables_LDADD = libfolly.la
lib_LTLIBRARIES = \ lib_LTLIBRARIES = \
libfolly.la \ libfolly.la \
libfollybenchmark.la \ libfollybenchmark.la \
libfollytimeout_queue.la libfollytimeout_queue.la \
libfollyfingerprint.la
follyincludedir = $(includedir)/folly follyincludedir = $(includedir)/folly
nobase_follyinclude_HEADERS = \ nobase_follyinclude_HEADERS = \
FBVector.h \ Arena.h \
detail/ThreadLocalDetail.h \ Arena-inl.h \
detail/DiscriminatedPtrDetail.h \ AtomicHashArray.h \
AtomicHashArray-inl.h \
AtomicHashMap.h \
AtomicHashMap-inl.h \
Benchmark.h \
Bits.h \
ConcurrentSkipList.h \
ConcurrentSkipList-inl.h \
Conv.h \
detail/AtomicHashUtils.h \ detail/AtomicHashUtils.h \
detail/BitIteratorDetail.h \ detail/BitIteratorDetail.h \
detail/DiscriminatedPtrDetail.h \
detail/FingerprintPolynomial.h \
detail/GroupVarintDetail.h \ detail/GroupVarintDetail.h \
IntrusiveList.h \ detail/SlowFingerprint.h \
TimeoutQueue.h \ detail/ThreadLocalDetail.h \
String.h \ DiscriminatedPtr.h \
PackedSyncPtr.h \
Conv.h \
ThreadLocal.h \
ProducerConsumerQueue.h \
Histogram-inl.h \
ThreadCachedInt.h \
ConcurrentSkipList.h \
json.h \
folly-config.h \
FBString.h \
Unicode.h \
test/function_benchmark/test_functions.h \
test/function_benchmark/benchmark_impl.h \
test/FBStringTestBenchmarks.cpp.h \
test/SynchronizedTestLib.h \
test/FBVectorTestBenchmarks.cpp.h \
test/SynchronizedTestLib-inl.h \
Synchronized.h \
Malloc.h \
dynamic.h \ dynamic.h \
AtomicHashArray.h \
dynamic-inl.h \ dynamic-inl.h \
Bits.h \ eventfd.h \
sorted_vector_types.h \ FBString.h \
Hash.h \ FBVector.h \
DiscriminatedPtr.h \ Fingerprint.h \
ConcurrentSkipList-inl.h \ folly-config.h \
Random.h \ Foreach.h \
FormatArg.h \
Format.h \
Format-inl.h \
GroupVarint.h \ GroupVarint.h \
Range.h \ Hash.h \
Benchmark.h \
Likely.h \
Histogram.h \ Histogram.h \
AtomicHashMap.h \ Histogram-inl.h \
IntrusiveList.h \
json.h \
Likely.h \
Malloc.h \
MapUtil.h \
PackedSyncPtr.h \
Portability.h \ Portability.h \
AtomicHashArray-inl.h \ Preprocessor.h \
eventfd.h \ ProducerConsumerQueue.h \
SmallLocks.h \ Random.h \
ScopeGuard.h \ Range.h \
Traits.h \
RWSpinLock.h \ RWSpinLock.h \
ScopeGuard.h \
SmallLocks.h \
small_vector.h \ small_vector.h \
Foreach.h \ sorted_vector_types.h \
AtomicHashMap-inl.h \ StlAllocator.h \
MapUtil.h String.h \
String-inl.h \
Synchronized.h \
test/FBStringTestBenchmarks.cpp.h \
test/FBVectorTestBenchmarks.cpp.h \
test/function_benchmark/benchmark_impl.h \
test/function_benchmark/test_functions.h \
test/SynchronizedTestLib.h \
test/SynchronizedTestLib-inl.h \
ThreadCachedArena.h \
ThreadCachedInt.h \
ThreadLocal.h \
TimeoutQueue.h \
Traits.h \
Unicode.h
FormatTables.cpp: build/generate_format_tables.py FormatTables.cpp: build/generate_format_tables.py
build/generate_format_tables.py build/generate_format_tables.py
EscapeTables.cpp: build/generate_escape_tables.py
build/generate_escape_tables.py
GroupVarintTables.cpp: build/generate_varint_tables.py
build/generate_varint_tables.py
libfolly_la_SOURCES = \ libfolly_la_SOURCES = \
Random.cpp \ Random.cpp \
Range.cpp \ Range.cpp \
Unicode.cpp \ Unicode.cpp \
Conv.cpp \ Conv.cpp \
Format.cpp \
FormatTables.cpp \
String.cpp \
json.cpp \ json.cpp \
dynamic.cpp \ dynamic.cpp \
GroupVarint.cpp \
GroupVarintTables.cpp \
EscapeTables.cpp \
ThreadCachedArena.cpp \
Format.cpp \
FormatTables.cpp \
String.cpp
libfolly_la_LIBADD = $(BOOST_THREAD_LIBS) -lpthread libfolly_la_LIBADD = $(BOOST_THREAD_LIBS) -lpthread
FingerprintTables.cpp: generate_fingerprint_tables
./generate_fingerprint_tables
libfollyfingerprint_la_SOURCES = \
FingerprintTables.cpp
libfollybenchmark_la_SOURCES = Benchmark.cpp libfollybenchmark_la_SOURCES = Benchmark.cpp
libfollybenchmark_la_LIBADD = -lboost_regex -lpthread -lrt libfollybenchmark_la_LIBADD = -lboost_regex -lpthread -lrt
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include <map> #include <map>
#include <set> #include <set>
#include <thread>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <glog/logging.h> #include <glog/logging.h>
...@@ -77,7 +77,7 @@ void BM_IterateOverSet(int iters, int size) { ...@@ -77,7 +77,7 @@ void BM_IterateOverSet(int iters, int size) {
if (iter == a_set.end()) iter = a_set.begin(); if (iter == a_set.end()) iter = a_set.begin();
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << "sum = " << sum; // VLOG(20) << "sum = " << sum;
} }
} }
...@@ -98,7 +98,7 @@ void BM_IterateSkipList(int iters, int size) { ...@@ -98,7 +98,7 @@ void BM_IterateSkipList(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << "sum = " << sum; // VLOG(20) << "sum = " << sum;
} }
} }
...@@ -119,7 +119,7 @@ void BM_SetMerge(int iters, int size) { ...@@ -119,7 +119,7 @@ void BM_SetMerge(int iters, int size) {
if (b_set.find(*it) != b_set.end()) mergedSum += *it; if (b_set.find(*it) != b_set.end()) mergedSum += *it;
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << mergedSum; // VLOG(20) << mergedSum;
} }
} }
...@@ -143,7 +143,7 @@ void BM_CSLMergeLookup(int iters, int size) { ...@@ -143,7 +143,7 @@ void BM_CSLMergeLookup(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << mergedSum; // VLOG(20) << mergedSum;
} }
} }
...@@ -180,7 +180,7 @@ void BM_CSLMergeIntersection(int iters, int size) { ...@@ -180,7 +180,7 @@ void BM_CSLMergeIntersection(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << mergedSum; // VLOG(20) << mergedSum;
} }
} }
...@@ -199,7 +199,7 @@ void BM_SetContainsNotFound(int iters, int size) { ...@@ -199,7 +199,7 @@ void BM_SetContainsNotFound(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << sum; // VLOG(20) << sum;
} }
} }
...@@ -224,7 +224,7 @@ void BM_SetContainsFound(int iters, int size) { ...@@ -224,7 +224,7 @@ void BM_SetContainsFound(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << sum; // VLOG(20) << sum;
} }
} }
...@@ -248,7 +248,7 @@ void BM_CSLContainsFound(int iters, int size) { ...@@ -248,7 +248,7 @@ void BM_CSLContainsFound(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << sum; // VLOG(20) << sum;
} }
} }
...@@ -268,7 +268,7 @@ void BM_CSLContainsNotFound(int iters, int size) { ...@@ -268,7 +268,7 @@ void BM_CSLContainsNotFound(int iters, int size) {
} }
BENCHMARK_SUSPEND { BENCHMARK_SUSPEND {
VLOG(20) << sum; // VLOG(20) << sum;
} }
} }
...@@ -410,7 +410,7 @@ class ConcurrentAccessData { ...@@ -410,7 +410,7 @@ class ConcurrentAccessData {
for (int i = 0; i < iters; ++i) { for (int i = 0; i < iters; ++i) {
sum += accessSkipList(id, i); sum += accessSkipList(id, i);
} }
VLOG(20) << sum; // VLOG(20) << sum;
} }
void runSet(int id, int iters) { void runSet(int id, int iters) {
...@@ -418,7 +418,7 @@ class ConcurrentAccessData { ...@@ -418,7 +418,7 @@ class ConcurrentAccessData {
for (int i = 0; i < iters; ++i) { for (int i = 0; i < iters; ++i) {
sum += accessSet(id, i); sum += accessSet(id, i);
} }
VLOG(20) << sum; // VLOG(20) << sum;
} }
bool accessSkipList(int64_t id, int t) { bool accessSkipList(int64_t id, int t) {
...@@ -484,11 +484,11 @@ static ConcurrentAccessData *mayInitTestData(int size) { ...@@ -484,11 +484,11 @@ static ConcurrentAccessData *mayInitTestData(int size) {
void BM_ContentionCSL(int iters, int size) { void BM_ContentionCSL(int iters, int size) {
BenchmarkSuspender susp; BenchmarkSuspender susp;
auto data = mayInitTestData(size); auto data = mayInitTestData(size);
std::vector<boost::thread> threads; std::vector<std::thread> threads;
susp.dismiss(); susp.dismiss();
for (int i = 0; i < FLAGS_num_threads; ++i) { for (int i = 0; i < FLAGS_num_threads; ++i) {
threads.push_back(boost::thread( threads.push_back(std::thread(
&ConcurrentAccessData::runSkipList, data, i, iters)); &ConcurrentAccessData::runSkipList, data, i, iters));
} }
FOR_EACH(t, threads) { FOR_EACH(t, threads) {
...@@ -499,11 +499,11 @@ void BM_ContentionCSL(int iters, int size) { ...@@ -499,11 +499,11 @@ void BM_ContentionCSL(int iters, int size) {
void BM_ContentionStdSet(int iters, int size) { void BM_ContentionStdSet(int iters, int size) {
BenchmarkSuspender susp; BenchmarkSuspender susp;
auto data = mayInitTestData(size); auto data = mayInitTestData(size);
std::vector<boost::thread> threads; std::vector<std::thread> threads;
susp.dismiss(); susp.dismiss();
for (int i = 0; i < FLAGS_num_threads; ++i) { for (int i = 0; i < FLAGS_num_threads; ++i) {
threads.push_back(boost::thread( threads.push_back(std::thread(
&ConcurrentAccessData::runSet, data, i, iters)); &ConcurrentAccessData::runSet, data, i, iters));
} }
FOR_EACH(t, threads) { FOR_EACH(t, threads) {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <boost/thread.hpp> #include <thread>
#include <glog/logging.h> #include <glog/logging.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
...@@ -208,10 +208,10 @@ TEST(ConcurrentSkipList, SequentialAccess) { ...@@ -208,10 +208,10 @@ TEST(ConcurrentSkipList, SequentialAccess) {
void testConcurrentAdd(int numThreads) { void testConcurrentAdd(int numThreads) {
auto skipList(SkipListType::create(kHeadHeight)); auto skipList(SkipListType::create(kHeadHeight));
vector<boost::thread> threads; vector<std::thread> threads;
vector<SetType> verifiers(numThreads); vector<SetType> verifiers(numThreads);
for (int i = 0; i < numThreads; ++i) { for (int i = 0; i < numThreads; ++i) {
threads.push_back(boost::thread( threads.push_back(std::thread(
&randomAdding, 100, skipList, &verifiers[i], kMaxValue)); &randomAdding, 100, skipList, &verifiers[i], kMaxValue));
} }
for (int i = 0; i < threads.size(); ++i) { for (int i = 0; i < threads.size(); ++i) {
...@@ -238,10 +238,10 @@ void testConcurrentRemoval(int numThreads, int maxValue) { ...@@ -238,10 +238,10 @@ void testConcurrentRemoval(int numThreads, int maxValue) {
skipList.add(i); skipList.add(i);
} }
vector<boost::thread> threads; vector<std::thread> threads;
vector<SetType > verifiers(numThreads); vector<SetType > verifiers(numThreads);
for (int i = 0; i < numThreads; ++i) { for (int i = 0; i < numThreads; ++i) {
threads.push_back(boost::thread( threads.push_back(std::thread(
&randomRemoval, 100, skipList, &verifiers[i], maxValue)); &randomRemoval, 100, skipList, &verifiers[i], maxValue));
} }
FOR_EACH(t, threads) { FOR_EACH(t, threads) {
...@@ -284,24 +284,24 @@ static void testConcurrentAccess( ...@@ -284,24 +284,24 @@ static void testConcurrentAccess(
std::sort(skipValues[i].begin(), skipValues[i].end()); std::sort(skipValues[i].begin(), skipValues[i].end());
} }
vector<boost::thread> threads; vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) { for (int i = 0; i < FLAGS_num_threads; ++i) {
switch (i % 8) { switch (i % 8) {
case 0: case 0:
case 1: case 1:
threads.push_back(boost::thread( threads.push_back(std::thread(
randomAdding, numInsertions, skipList, &verifiers[i], maxValue)); randomAdding, numInsertions, skipList, &verifiers[i], maxValue));
break; break;
case 2: case 2:
threads.push_back(boost::thread( threads.push_back(std::thread(
randomRemoval, numDeletions, skipList, &verifiers[i], maxValue)); randomRemoval, numDeletions, skipList, &verifiers[i], maxValue));
break; break;
case 3: case 3:
threads.push_back(boost::thread( threads.push_back(std::thread(
concurrentSkip, &skipValues[i], skipList)); concurrentSkip, &skipValues[i], skipList));
break; break;
default: default:
threads.push_back(boost::thread(sumAllValues, skipList, &sums[i])); threads.push_back(std::thread(sumAllValues, skipList, &sums[i]));
break; break;
} }
} }
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "folly/FBString.h" #include "folly/FBString.h"
#include <cstdlib>
#include <list> #include <list>
#include <fstream> #include <fstream>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
...@@ -879,8 +881,11 @@ massa, ut accumsan magna. Donec imperdiet tempor nisi et \n\ ...@@ -879,8 +881,11 @@ massa, ut accumsan magna. Donec imperdiet tempor nisi et \n\
laoreet. Phasellus lectus quam, ultricies ut tincidunt in, dignissim \n\ laoreet. Phasellus lectus quam, ultricies ut tincidunt in, dignissim \n\
id eros. Mauris vulputate tortor nec neque pellentesque sagittis quis \n\ id eros. Mauris vulputate tortor nec neque pellentesque sagittis quis \n\
sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam."; sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam.";
const char* f = "/tmp/fbstring_testing"; char f[] = "/tmp/fbstring_testing.XXXXXX";
{ int fd = mkstemp(f);
EXPECT_TRUE(fd > 0);
if (fd > 0) {
close(fd); // Yeah
std::ofstream out(f); std::ofstream out(f);
if (!(out << s1)) { if (!(out << s1)) {
EXPECT_TRUE(0) << "Couldn't write to temp file."; EXPECT_TRUE(0) << "Couldn't write to temp file.";
...@@ -889,12 +894,15 @@ sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam."; ...@@ -889,12 +894,15 @@ sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam.";
} }
vector<fbstring> v; vector<fbstring> v;
boost::split(v, s1, boost::is_any_of("\n")); boost::split(v, s1, boost::is_any_of("\n"));
{
ifstream input(f); ifstream input(f);
fbstring line; fbstring line;
FOR_EACH (i, v) { FOR_EACH (i, v) {
EXPECT_TRUE(getline(input, line)); EXPECT_TRUE(getline(input, line));
EXPECT_EQ(line, *i); EXPECT_EQ(line, *i);
} }
}
unlink(f);
} }
TEST(FBString, testMoveCtor) { TEST(FBString, testMoveCtor) {
......
...@@ -14,10 +14,14 @@ TESTS= \ ...@@ -14,10 +14,14 @@ TESTS= \
bits_test \ bits_test \
bit_iterator_test bit_iterator_test
lib_LTLIBRARIES = libgtestmain.la lib_LTLIBRARIES = libgtestmain.la libgtest.la
libgtestmain_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src libgtestmain_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
libgtestmain_la_SOURCES = gtest-1.6.0/src/gtest-all.cc gtest-1.6.0/src/gtest_main.cc libgtestmain_la_SOURCES = gtest-1.6.0/src/gtest-all.cc gtest-1.6.0/src/gtest_main.cc
libgtest_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
libgtest_la_SOURCES = gtest-1.6.0/src/gtest-all.cc
noinst_HEADERS = FBStringTestBenchmarks.cpp.h \ noinst_HEADERS = FBStringTestBenchmarks.cpp.h \
FBVectorTestBenchmarks.cpp.h FBVectorTestBenchmarks.cpp.h
...@@ -109,23 +113,56 @@ endian_test_SOURCES = EndianTest.cpp ...@@ -109,23 +113,56 @@ endian_test_SOURCES = EndianTest.cpp
endian_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la endian_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += endian_test TESTS += endian_test
# needs externals/glog to use third-party glog rw_spinlock_test_SOURCES = RWSpinLockTest.cpp
# rw_spinlock_test_SOURCES = RWSpinLockTest.cpp rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
# rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS) TESTS += rw_spinlock_test
# TESTS += rw_spinlock_test
synchronized_test_SOURCES = SynchronizedTest.cpp synchronized_test_SOURCES = SynchronizedTest.cpp
synchronized_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la synchronized_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += synchronized_test TESTS += synchronized_test
# needs externals/glog to use third-party glog concurrent_skiplist_test_SOURCES = ConcurrentSkipListTest.cpp
# concurrent_skiplist_test_SOURCES = ConcurrentSkipListTest.cpp concurrent_skiplist_test_LDADD = libgtest.la $(top_builddir)/libfolly.la
# concurrent_skiplist_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la TESTS += concurrent_skiplist_test
# TESTS += concurrent_skiplist_test
concurrent_skiplist_benchmark_SOURCES = ConcurrentSkipListBenchmark.cpp
concurrent_skiplist_benchmark_LDADD = $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS)
noinst_PROGRAMS += concurrent_skiplist_benchmark
histogram_test_SOURCES = HistogramTest.cpp
histogram_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += histogram_test
group_varint_test_SOURCES = GroupVarintTest.cpp
group_varint_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += group_varint_test
map_util_test_SOURCES = MapUtilTest.cpp
map_util_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += map_util_test
string_test_SOURCES = StringTest.cpp
string_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
TESTS += string_test
producer_consumer_queue_test_SOURCES = ProducerConsumerQueueTest.cpp
producer_consumer_queue_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += producer_consumer_queue_test
atomic_hash_array_test_SOURCES = AtomicHashArrayTest.cpp
atomic_hash_array_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
TESTS += atomic_hash_array_test
atomic_hash_map_test_SOURCES = AtomicHashMapTest.cpp
atomic_hash_map_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
TESTS += atomic_hash_map_test
format_test_SOURCES = FormatTest.cpp
format_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollybenchmark.la
TESTS += format_test
# needs externals/glog to use third-party glog fingerprint_test_SOURCES = FingerprintTest.cpp
# concurrent_skiplist_benchmark_SOURCES = ConcurrentSkipListBenchmark.cpp fingerprint_test_LDADD = libgtest.la $(top_builddir)/libfolly.la $(top_builddir)/libfollyfingerprint.la $(top_builddir)/libfollybenchmark.la
# concurrent_skiplist_benchmark_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_THREAD_LIBS) TESTS += fingerprint_test
# noinst_PROGRAMS += concurrent_skiplist_benchmark
check_PROGRAMS= $(TESTS) check_PROGRAMS= $(TESTS)
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <vector> #include <vector>
#include <thread>
#include <boost/thread.hpp>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <gflags/gflags.h> #include <gflags/gflags.h>
...@@ -66,7 +65,7 @@ static void run(RWSpinLockType* lock) { ...@@ -66,7 +65,7 @@ static void run(RWSpinLockType* lock) {
++reads; ++reads;
} }
} }
VLOG(0) << "total reads: " << reads << "; total writes: " << writes; // VLOG(0) << "total reads: " << reads << "; total writes: " << writes;
} }
...@@ -152,9 +151,9 @@ TYPED_TEST(RWSpinLockTest, ConcurrentTests) { ...@@ -152,9 +151,9 @@ TYPED_TEST(RWSpinLockTest, ConcurrentTests) {
RWSpinLockType l; RWSpinLockType l;
srand(time(NULL)); srand(time(NULL));
std::vector<boost::thread> threads; std::vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) { for (int i = 0; i < FLAGS_num_threads; ++i) {
threads.push_back(boost::thread(&run<RWSpinLockType>, &l)); threads.push_back(std::thread(&run<RWSpinLockType>, &l));
} }
sleep(1); sleep(1);
...@@ -223,9 +222,9 @@ TEST(RWSpinLock, concurrent_holder_test) { ...@@ -223,9 +222,9 @@ TEST(RWSpinLock, concurrent_holder_test) {
} }
}; };
std::vector<boost::thread> threads; std::vector<std::thread> threads;
for (int i = 0; i < FLAGS_num_threads; ++i) { for (int i = 0; i < FLAGS_num_threads; ++i) {
threads.push_back(boost::thread(go)); threads.push_back(std::thread(go));
} }
sleep(5); sleep(5);
......
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