[tsan] run more kinds of builds as presubmit test (and fix gcc debug build)

llvm-svn: 156616
This commit is contained in:
Kostya Serebryany 2012-05-11 14:42:24 +00:00
parent 09de6ae399
commit 07c4805175
6 changed files with 24 additions and 16 deletions

View File

@ -50,18 +50,23 @@ test: $(LIBTSAN) tsan_test
run: all
(ulimit -s 8192; ./tsan_test)
./output_tests/test_output.sh
presubmit:
$(MAKE) -f Makefile.old lint -j 4
# Debug build with clang.
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=1 -j 16 CC=clang CXX=clang++
./output_tests/test_output.sh
# Release build gcc
# Release build with clang.
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=clang CXX=clang++
# Debug build with gcc
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=1 -j 16 CC=gcc CXX=g++
# Release build with gcc
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=gcc CXX=g++
./check_analyze.sh
./output_tests/test_output.sh
@ echo PRESUBMIT PASSED
RTL_LINT_FITLER=-legal/copyright,-build/include,-readability/casting,-build/header_guard

View File

@ -10,15 +10,18 @@ NO_SYSROOT=--sysroot=.
CXXFLAGS+=$(EXTRA_CXXFLAGS)
ifeq ($(DEBUG), 0)
CXXFLAGS+=-fomit-frame-pointer
endif
ifeq ($(CXX), g++)
CXXFLAGS+=-Wframe-larger-than=512
endif # CXX=g++
endif # DEBUG=0
ifeq ($(CXX), clang++)
# Global constructors are banned.
CXXFLAGS+=-Wglobal-constructors
else
CXXFLAGS+=-Wframe-larger-than=512
endif
all: libtsan.a
LIBTSAN_HEADERS=tsan_allocator.h \

View File

@ -41,23 +41,23 @@ struct ThreadClock {
public:
ThreadClock();
u64 get(int tid) const {
u64 get(unsigned tid) const {
DCHECK(tid < kMaxTid);
return clk_[tid];
}
void set(int tid, u64 v) {
void set(unsigned tid, u64 v) {
DCHECK(tid < kMaxTid);
DCHECK(v >= clk_[tid]);
clk_[tid] = v;
if ((int)nclk_ <= tid)
if (nclk_ <= tid)
nclk_ = tid + 1;
}
void tick(int tid) {
void tick(unsigned tid) {
DCHECK(tid < kMaxTid);
clk_[tid]++;
if ((int)nclk_ <= tid)
if (nclk_ <= tid)
nclk_ = tid + 1;
}

View File

@ -30,7 +30,7 @@ typedef unsigned long uptr; // NOLINT
const uptr kPageSize = 4096;
const int kTidBits = 16;
const int kMaxTid = 1 << kTidBits;
const unsigned kMaxTid = 1 << kTidBits;
const int kClkBits = 40;
#ifdef TSAN_SHADOW_COUNT

View File

@ -307,8 +307,8 @@ struct Context {
int nmissed_expected;
Mutex thread_mtx;
int thread_seq;
int unique_thread_seq;
unsigned thread_seq;
unsigned unique_thread_seq;
int alive_threads;
int max_alive_threads;
ThreadContext *threads[kMaxTid];

View File

@ -40,7 +40,7 @@ void ThreadFinalize(ThreadState *thr) {
return;
Context *ctx = CTX();
Lock l(&ctx->thread_mtx);
for (int i = 0; i < kMaxTid; i++) {
for (unsigned i = 0; i < kMaxTid; i++) {
ThreadContext *tctx = ctx->threads[i];
if (tctx == 0)
continue;
@ -230,7 +230,7 @@ int ThreadTid(ThreadState *thr, uptr pc, uptr uid) {
CHECK_GT(thr->in_rtl, 0);
DPrintf("#%d: ThreadTid uid=%lu\n", thr->tid, uid);
Lock l(&CTX()->thread_mtx);
for (int tid = 0; tid < kMaxTid; tid++) {
for (unsigned tid = 0; tid < kMaxTid; tid++) {
if (CTX()->threads[tid] != 0
&& CTX()->threads[tid]->user_id == uid
&& CTX()->threads[tid]->status != ThreadStatusInvalid)