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.

161 lines
8.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 := iarg_explicit_memory_ea iarg_uint64 iarg_branch_taken_correct iarg_branch_taken_error
# This defines the tests to be run that were not already defined in TEST_TOOL_ROOTS.
TEST_ROOTS := iarg_inst_ptr_error_msg_ref iarg_inst_ptr_error_msg_ret iarg_memory_size_fxsave_fxrstor
# This defines the tools which will be run during the the tests, and were not already defined in
# TEST_TOOL_ROOTS.
TOOL_ROOTS := iarg_inst_ptr_error_msg fxsave_size
# 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 := iarg_explicit_memory_ea_app fxsave_app use_rtm_app
# 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 ######
# Windows
ifeq ($(TARGET_OS),windows)
OBJECT_ROOTS += iarg_explicit_memory_ea_app_asm
endif
###### Handle exceptions here ######
ifeq ($(TARGET_OS),linux)
RTM_NOT_SUPPORTED := $(shell $(TOOLS_ROOT)/Utils/testGccVersion $(CXXPATH) 4.8.3)
ifeq ($(RTM_NOT_SUPPORTED),1)
APP_ROOTS := $(filter-out use_rtm_app, $(APP_ROOTS))
TEST_TOOL_ROOTS := $(filter-out iarg_branch_taken_correct, $(TEST_TOOL_ROOTS))
TEST_TOOL_ROOTS := $(filter-out iarg_branch_taken_error, $(TEST_TOOL_ROOTS))
endif
endif
###### 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
iarg_branch_taken_error.test: $(OBJDIR)iarg_branch_taken_error$(PINTOOL_SUFFIX) $(OBJDIR)use_rtm_app$(EXE_SUFFIX)
-$(PIN) -logfile $(OBJDIR)iarg_branch_taken_error.log -t $(OBJDIR)iarg_branch_taken_error$(PINTOOL_SUFFIX) \
-- $(OBJDIR)use_rtm_app$(EXE_SUFFIX) > $(OBJDIR)iarg_branch_taken_error.out
$(QGREP) "Pin does not support instrumenting this conditional branch" $(OBJDIR)iarg_branch_taken_error.log
$(RM) $(OBJDIR)iarg_branch_taken_error.log $(OBJDIR)iarg_branch_taken_error.out
iarg_branch_taken_correct.test: $(OBJDIR)iarg_branch_taken_correct$(PINTOOL_SUFFIX) $(OBJDIR)use_rtm_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)iarg_branch_taken_correct$(PINTOOL_SUFFIX) \
-- $(OBJDIR)use_rtm_app$(EXE_SUFFIX) > $(OBJDIR)iarg_branch_taken_correct.out
$(QGREP) "end of run: taken = " $(OBJDIR)iarg_branch_taken_correct.out
$(RM) $(OBJDIR)iarg_branch_taken_correct.out
iarg_explicit_memory_ea.test: $(OBJDIR)iarg_explicit_memory_ea$(PINTOOL_SUFFIX) $(OBJDIR)iarg_explicit_memory_ea_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)iarg_explicit_memory_ea$(PINTOOL_SUFFIX) -o $(OBJDIR)iarg_explicit_memory_ea.out \
-- $(OBJDIR)iarg_explicit_memory_ea_app$(EXE_SUFFIX)
$(RM) $(OBJDIR)iarg_explicit_memory_ea.out
iarg_inst_ptr_error_msg_ref.test: $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) $(TESTAPP)
-$(PIN) -logfile $(OBJDIR)iarg_inst_ptr_error_msg_ref.log -t $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) -reg_api 1 \
-o $(OBJDIR)iarg_inst_ptr_error_msg_ref.out -- $(TESTAPP) makefile $(OBJDIR)iarg_inst_ptr_error_msg_ref.makefile.copy
$(QGREP) "Calling IARG_REG_REFERENCE is not allowed with Instruction Pointer register" $(OBJDIR)iarg_inst_ptr_error_msg_ref.log
-$(RM) $(OBJDIR)iarg_inst_ptr_error_msg_ref.log $(OBJDIR)iarg_inst_ptr_error_msg_ref.out
iarg_inst_ptr_error_msg_ret.test: $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) $(TESTAPP)
-$(PIN) -logfile $(OBJDIR)iarg_inst_ptr_error_msg_ret.log -t $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) -reg_api 2 \
-o $(OBJDIR)iarg_inst_ptr_error_msg_ret.out -- $(TESTAPP) makefile $(OBJDIR)iarg_inst_ptr_error_msg_ret.makefile.copy
$(QGREP) "Calling IARG_RETURN_REGS is not allowed with Instruction Pointer register" $(OBJDIR)iarg_inst_ptr_error_msg_ret.log
-$(RM) $(OBJDIR)iarg_inst_ptr_error_msg_ret.log $(OBJDIR)iarg_inst_ptr_error_msg_ret.out
iarg_inst_ptr_error_msg_check_reference.test: $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)iarg_inst_ptr_error_msg$(PINTOOL_SUFFIX) -reg_api 3 -o $(OBJDIR)iarg_inst_ptr_error_msg_check_reference.out \
-- $(TESTAPP) makefile $(OBJDIR)iarg_inst_ptr_error_msg_check_reference.makefile.copy > $(OBJDIR)iarg_inst_ptr_error_msg_check_reference_output 2>&1
$(QGREP) "Great place to work!" $(OBJDIR)iarg_inst_ptr_error_msg_check_reference.out
-$(RM) $(OBJDIR)iarg_inst_ptr_error_msg_check_reference_output $(OBJDIR)iarg_inst_ptr_error_msg_check_reference.out
iarg_uint64.test: $(OBJDIR)iarg_uint64$(PINTOOL_SUFFIX) $(HELLO_APP)
$(PIN) -t $(OBJDIR)iarg_uint64$(PINTOOL_SUFFIX) -o $(OBJDIR)iarg_uint64.out -- $(HELLO_APP)
$(SYNC)
$(DIFF) iarg_uint64.reference $(OBJDIR)iarg_uint64.out
$(RM) $(OBJDIR)iarg_uint64.out
iarg_memory_size_fxsave_fxrstor.test: $(OBJDIR)fxsave_size$(PINTOOL_SUFFIX) $(OBJDIR)fxsave_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)fxsave_size$(PINTOOL_SUFFIX) -o $(OBJDIR)$(@:%.test=%.out) \
-- $(OBJDIR)fxsave_app$(EXE_SUFFIX) > $(OBJDIR)fxsave_app.out
$(RM) $(OBJDIR)$(@:%.test=%.out) $(OBJDIR)fxsave_app.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)use_rtm_app$(EXE_SUFFIX): use_rtm_app.cpp
$(APP_CXX) $(RTM_FLAGS) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
ifeq ($(TARGET_OS),windows)
$(OBJDIR)iarg_explicit_memory_ea_app$(EXE_SUFFIX): $(OBJDIR)iarg_explicit_memory_ea_app$(OBJ_SUFFIX) $(OBJDIR)iarg_explicit_memory_ea_app_asm$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
else #not windows
$(OBJDIR)iarg_explicit_memory_ea_app$(EXE_SUFFIX): iarg_explicit_memory_ea_app.cpp
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
endif
$(OBJDIR)fxsave_app$(EXE_SUFFIX): fxsave_app.cpp $(OBJDIR)DoFxsave$(OBJ_SUFFIX)
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $^ $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
###### Special objects' build rules ######
$(OBJDIR)iarg_explicit_memory_ea_app$(OBJ_SUFFIX): iarg_explicit_memory_ea_app.cpp
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_OBJ)$@ $<