[llvm-commits] [compiler-rt] r158821 - in /compiler-rt/trunk/lib: sanitizer_common/sanitizer_libc.cc sanitizer_common/sanitizer_linux.cc sanitizer_common/sanitizer_procmaps.h sanitizer_common/sanitizer_win.cc tsan/Makefile.old
Kostya Serebryany
kcc at google.com
Wed Jun 20 08:19:17 PDT 2012
Author: kcc
Date: Wed Jun 20 10:19:17 2012
New Revision: 158821
URL: http://llvm.org/viewvc/llvm-project?rev=158821&view=rev
Log:
[tsan] a bit more lint and Makefile changes to run tests from sanitizer_common
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
compiler-rt/trunk/lib/tsan/Makefile.old
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc?rev=158821&r1=158820&r2=158821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc Wed Jun 20 10:19:17 2012
@@ -149,7 +149,7 @@
}
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;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=158821&r1=158820&r2=158821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Wed Jun 20 10:19:17 2012
@@ -86,7 +86,7 @@
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 @@
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 @@
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();
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h?rev=158821&r1=158820&r2=158821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h Wed Jun 20 10:19:17 2012
@@ -29,6 +29,7 @@
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
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=158821&r1=158820&r2=158821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Wed Jun 20 10:19:17 2012
@@ -33,7 +33,7 @@
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) ?
Modified: compiler-rt/trunk/lib/tsan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/Makefile.old?rev=158821&r1=158820&r2=158821&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/Makefile.old (original)
+++ compiler-rt/trunk/lib/tsan/Makefile.old Wed Jun 20 10:19:17 2012
@@ -15,6 +15,8 @@
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:
$(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 @@
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
More information about the llvm-commits
mailing list