You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
6.0 KiB

##############################################################
#
# This file includes all the test targets as well as all the
# non-default build rules and test recipes.
#
##############################################################
##############################################################
#
# Test targets
#
##############################################################
###### Place all generic definitions here ######
# This defines tests which run tools of the same name. This is simply for convenience to avoid
# defining the test name twice (once in TOOL_ROOTS and again in TEST_ROOTS).
# Tests defined here should not be defined in TOOL_ROOTS and TEST_ROOTS.
TEST_TOOL_ROOTS := memtrace memtrace_simple
# This defines the tests to be run that were not already defined in TEST_TOOL_ROOTS.
TEST_ROOTS := memtracemt memtrace_simple_mt
# This defines the tools which will be run during the the tests, and were not already defined in
# TEST_TOOL_ROOTS.
TOOL_ROOTS :=
# This defines the static analysis tools which will be run during the the tests. They should not
# be defined in TEST_TOOL_ROOTS. If a test with the same name exists, it should be defined in
# TEST_ROOTS.
# Note: Static analysis tools are in fact executables linked with the Pin Static Analysis Library.
# This library provides a subset of the Pin APIs which allows the tool to perform static analysis
# of an application or dll. Pin itself is not used when this tool runs.
SA_TOOL_ROOTS :=
# This defines all the applications that will be run during the tests.
APP_ROOTS := thread
# This defines any additional object files that need to be compiled.
OBJECT_ROOTS :=
# This defines any additional dlls (shared objects), other than the pintools, that need to be compiled.
DLL_ROOTS :=
# This defines any static libraries (archives), that need to be built.
LIB_ROOTS :=
###### Place OS-specific definitions here ######
# Linux
ifeq ($(TARGET_OS),linux)
TEST_TOOL_ROOTS += membuffer membuffer_simple membuffer_simple_tid
TEST_ROOTS += membuffermt membuffer_simple_mt
APP_ROOTS += thread2
OBJECT_ROOTS += atomic_increment_$(TARGET)
endif
# Windows
ifeq ($(TARGET_OS),windows)
TEST_TOOL_ROOTS += membuffer membuffer_simple membuffer_simple_tid membuffer_threadpool memtrace_threadpool
TEST_ROOTS += membuffer_threadpool_mt memtrace_threadpool_mt
APP_ROOTS += thread2
OBJECT_ROOTS += atomic_increment_$(TARGET)
endif
###### Handle exceptions here ######
# TODO: These tests fail - fix and remove the following:
###### Define the sanity subset ######
# This defines the list of tests that should run in sanity. It should include all the tests listed in
# TEST_TOOL_ROOTS and TEST_ROOTS excluding only unstable tests.
SANITY_SUBSET := $(TEST_TOOL_ROOTS) $(TEST_ROOTS)
##############################################################
#
# Test recipes
#
##############################################################
# This section contains recipes for tests other than the default.
# See makefile.default.rules for the default test rules.
# All tests in this section should adhere to the naming convention: <testname>.test
memtracemt.test: $(OBJDIR)memtrace$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)memtrace$(PINTOOL_SUFFIX) -emit 0 -- $(OBJDIR)thread$(EXE_SUFFIX)
membuffermt.test: $(OBJDIR)membuffer$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)membuffer$(PINTOOL_SUFFIX) -emit 0 -- $(OBJDIR)thread$(EXE_SUFFIX)
membuffer_simple_mt.test: $(OBJDIR)membuffer_simple$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)membuffer_simple$(PINTOOL_SUFFIX) -- $(OBJDIR)thread$(EXE_SUFFIX)
membuffer_simple_tid.test: $(OBJDIR)membuffer_simple_tid$(PINTOOL_SUFFIX) $(OBJDIR)thread2$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)membuffer_simple_tid$(PINTOOL_SUFFIX) -- $(OBJDIR)thread2$(EXE_SUFFIX)
memtrace_simple_mt.test: $(OBJDIR)memtrace_simple$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)memtrace_simple$(PINTOOL_SUFFIX) -- $(OBJDIR)thread$(EXE_SUFFIX)
# The following 4 tests do not support late exit because the tests were not designed
# to gracefully finish active internal threads at regular exit point.
membuffer_threadpool_mt.test: $(OBJDIR)membuffer_threadpool$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)membuffer_threadpool$(PINTOOL_SUFFIX) \
-- $(OBJDIR)thread$(EXE_SUFFIX) > $(OBJDIR)$(@:.test=.out) 2>&1
-$(RM) $(OBJDIR)$(@:.test=.out)
memtrace_threadpool_mt.test: $(OBJDIR)memtrace_threadpool$(PINTOOL_SUFFIX) $(OBJDIR)thread$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)memtrace_threadpool$(PINTOOL_SUFFIX) \
-- $(OBJDIR)thread$(EXE_SUFFIX) > $(OBJDIR)$(@:.test=.out) 2>&1
-$(RM) $(OBJDIR)$(@:.test=.out)
membuffer_threadpool.test: $(OBJDIR)membuffer_threadpool$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)$(@:.test=)$(PINTOOL_SUFFIX) -- $(TESTAPP) makefile \
$(OBJDIR)$(@:.test=.makefile.copy) > $(OBJDIR)$(@:.test=.out) 2>&1
$(CMP) makefile $(OBJDIR)$(@:.test=.makefile.copy)
$(RM) $(OBJDIR)$(@:.test=.makefile.copy)
-$(RM) $(OBJDIR)$(@:.test=.out)
memtrace_threadpool.test: $(OBJDIR)memtrace_threadpool$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)$(@:.test=)$(PINTOOL_SUFFIX) -- $(TESTAPP) makefile \
$(OBJDIR)$(@:.test=.makefile.copy) > $(OBJDIR)$(@:.test=.out) 2>&1
$(CMP) makefile $(OBJDIR)$(@:.test=.makefile.copy)
$(RM) $(OBJDIR)$(@:.test=.makefile.copy)
-$(RM) $(OBJDIR)$(@:.test=.out)
##############################################################
#
# Build rules
#
##############################################################
# This section contains the build rules for all binaries that have special build rules.
# See makefile.default.rules for the default build rules.
###### Special applications' build rules ######
$(OBJDIR)thread$(EXE_SUFFIX): thread.c $(THREADLIB)
$(APP_CC) $(APP_CXXFLAGS) $(COMP_EXE)$@ $^ $(APP_LDFLAGS) $(APP_LIBS)
$(OBJDIR)thread2$(EXE_SUFFIX): thread2.cpp $(THREADLIB) $(OBJDIR)atomic_increment_$(TARGET)$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) $(APP_LIBS)