diff options
author | Kostya Serebryany <kcc@google.com> | 2012-06-20 15:19:17 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-06-20 15:19:17 +0000 |
commit | 98390d0b71bd5bda577b43e087683fb1d05c0246 (patch) | |
tree | 24066df0e060baac9899c77b985351c943dbe589 | |
parent | 421a5ba06dd25eb90bf28108819a159ca5814098 (diff) | |
download | bcm5719-llvm-98390d0b71bd5bda577b43e087683fb1d05c0246.tar.gz bcm5719-llvm-98390d0b71bd5bda577b43e087683fb1d05c0246.zip |
[tsan] a bit more lint and Makefile changes to run tests from sanitizer_common
llvm-svn: 158821
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_libc.cc | 2 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 6 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h | 1 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_win.cc | 2 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/Makefile.old | 17 |
5 files changed, 17 insertions, 11 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc b/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc index 0ec47125e6d..c4332423bf3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc @@ -149,7 +149,7 @@ char *internal_strstr(const char *haystack, const char *needle) { } s64 internal_simple_strtoll(const char *nptr, char **endptr, int base) { - CHECK(base == 10); + CHECK_EQ(base, 10); while (IsSpace(*nptr)) nptr++; int sgn = 1; u64 res = 0; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index b1e638491f3..8b2c67b4ed3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -86,7 +86,7 @@ void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, if (at_initialization) { // This is the main thread. Libpthread may not be initialized yet. struct rlimit rl; - CHECK(getrlimit(RLIMIT_STACK, &rl) == 0); + CHECK_EQ(getrlimit(RLIMIT_STACK, &rl), 0); // Find the mapping that contains a stack variable. ProcessMaps proc_maps; @@ -114,7 +114,7 @@ void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, return; } pthread_attr_t attr; - CHECK(pthread_getattr_np(pthread_self(), &attr) == 0); + CHECK_EQ(pthread_getattr_np(pthread_self(), &attr), 0); uptr stacksize = 0; void *stackaddr = 0; pthread_attr_getstack(&attr, &stackaddr, (size_t*)&stacksize); @@ -158,7 +158,7 @@ ProcessMaps::ProcessMaps() { proc_self_maps_buff_len_ = ReadFileToBuffer("/proc/self/maps", &proc_self_maps_buff_, &proc_self_maps_buff_mmaped_size_, 1 << 26); - CHECK(proc_self_maps_buff_len_ > 0); + CHECK_GT(proc_self_maps_buff_len_, 0); // internal_write(2, proc_self_maps_buff_, proc_self_maps_buff_len_); Reset(); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h index 2140106e2f3..15dc6985239 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h @@ -29,6 +29,7 @@ class ProcessMaps { bool GetObjectNameAndOffset(uptr addr, uptr *offset, char filename[], uptr filename_size); ~ProcessMaps(); + private: // Default implementation of GetObjectNameAndOffset. // Quite slow, because it iterates through the whole process map for each diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc index 2f8af189f1e..fc5c93a3779 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc @@ -33,7 +33,7 @@ void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, CHECK(stack_top); CHECK(stack_bottom); MEMORY_BASIC_INFORMATION mbi; - CHECK(VirtualQuery(&mbi /* on stack */, &mbi, sizeof(mbi)) != 0); + CHECK_NE(VirtualQuery(&mbi /* on stack */, &mbi, sizeof(mbi)), 0); // FIXME: is it possible for the stack to not be a single allocation? // Are these values what ASan expects to get (reserved, not committed; // including stack guard page) ? diff --git a/compiler-rt/lib/tsan/Makefile.old b/compiler-rt/lib/tsan/Makefile.old index 7e0f1dbfd14..d8cbf154cfa 100644 --- a/compiler-rt/lib/tsan/Makefile.old +++ b/compiler-rt/lib/tsan/Makefile.old @@ -15,6 +15,8 @@ GTEST_INCLUDE=-I$(GTEST_ROOT)/include GTEST_BUILD_DIR=$(GTEST_ROOT)/build GTEST_LIB=$(GTEST_BUILD_DIR)/gtest-all.o +SANITIZER_COMMON_TESTS_SRC=$(wildcard ../sanitizer_common/tests/*.cc) +SANITIZER_COMMON_TESTS_OBJ=$(patsubst %.cc,%.o,$(SANITIZER_COMMON_TESTS_SRC)) RTL_TEST_SRC=$(wildcard rtl_tests/*.cc) RTL_TEST_OBJ=$(patsubst %.cc,%.o,$(RTL_TEST_SRC)) UNIT_TEST_SRC=$(wildcard unit_tests/*_test.cc) @@ -39,13 +41,14 @@ $(LIBTSAN): libtsan libtsan: $(MAKE) -C rtl -f Makefile.old DEBUG=$(DEBUG) -unit_tests/%_test.o: unit_tests/%_test.cc $(UNIT_TEST_HDR) +%.o: %.cc $(UNIT_TEST_HDR) $(CXX) $(CXXFLAGS) $(CFLAGS) $(INCLUDES) -o $@ -c $< -rtl_tests/%.o: rtl_tests/%.cc $(LIBTSAN_HEADERS) - $(CXX) $(CXXFLAGS) $(CFLAGS) $(INCLUDES) -o $@ -c $< +#rtl_tests/%.o: rtl_tests/%.cc $(LIBTSAN_HEADERS) +# $(CXX) $(CXXFLAGS) $(CFLAGS) $(INCLUDES) -o $@ -c $< -tsan_test: $(TEST_OBJ) $(UNIT_TEST_OBJ) $(RTL_TEST_OBJ) $(LIBTSAN) $(GTEST_LIB) +tsan_test: $(TEST_OBJ) $(UNIT_TEST_OBJ) $(RTL_TEST_OBJ) \ + $(SANITIZER_COMMON_TESTS_OBJ) $(LIBTSAN) $(GTEST_LIB) $(CXX) $^ -o $@ $(LDFLAGS) test: libtsan tsan_test @@ -75,9 +78,11 @@ RTL_LINT_FITLER=-legal/copyright,-build/include,-readability/casting,-build/head lint: lint_tsan lint_tests lint_tsan: - third_party/cpplint/cpplint.py --filter=$(RTL_LINT_FITLER) rtl/*.{cc,h} + third_party/cpplint/cpplint.py --filter=$(RTL_LINT_FITLER) rtl/*.{cc,h} \ + ../sanitizer_common/*.{cc,h} lint_tests: - third_party/cpplint/cpplint.py --filter=$(RTL_LINT_FITLER) rtl_tests/*.{cc,h} unit_tests/*.cc + third_party/cpplint/cpplint.py --filter=$(RTL_LINT_FITLER) \ + rtl_tests/*.{cc,h} unit_tests/*.cc ../sanitizer_common/tests/*.cc install_deps: rm -rf third_party |