############################################################## # # 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 := mix-mt # This defines the tests to be run that were not already defined in TEST_TOOL_ROOTS. TEST_ROOTS := # 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 := marker-example # 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_ROOTS += test-mt APP_ROOTS += test-mt ifeq ($(TARGET),intel64) TEST_ROOTS += mix-length endif endif # Windows ifeq ($(TARGET_OS),windows) OBJECT_ROOTS += assy-support-$(TARGET) 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: .test mix-mt.test: $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) $(OBJDIR)marker-example$(EXE_SUFFIX) $(PIN) -t $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) -category -start_address marker_start_counting:repeat \ -stop_address marker_stop_counting:repeat -control stats-reset:address:marker_zero_stats:repeat \ -control stats-emit:address:marker_emit_stats:repeat -o $(OBJDIR)mix-mt.out -- $(OBJDIR)marker-example$(EXE_SUFFIX) $(RM) $(OBJDIR)mix-mt.out # MULTITHREADED TEST: mix-mt handles a variable number of threads test-mt.test: $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) $(OBJDIR)test-mt$(EXE_SUFFIX) $(PIN) -t $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) -start_address marker_start_counting:repeat \ -stop_address marker_stop_counting:repeat -control stats-reset:address:marker_zero_stats:repeat \ -control stats-emit:address:marker_emit_stats:repeat -o $(OBJDIR)test-mt.out -- $(OBJDIR)test-mt$(EXE_SUFFIX) $(RM) $(OBJDIR)test-mt.out # I allow some fuzz in the expected length because sometime we see ~950 and # sometimes 1000. This is because the length counter counts blocks and # that results in approximate counting. mix-length.test: $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) $(PIN) -t $(OBJDIR)mix-mt$(PINTOOL_SUFFIX) -length 1000 -o $(OBJDIR)mix-length.out -- /bin/ls $(BASHTEST) `tail $(OBJDIR)mix-length.out | $(GREP) total | $(AWK) '{print $$2}'` -lt 1010 $(BASHTEST) `tail $(OBJDIR)mix-length.out | $(GREP) total | $(AWK) '{print $$2}'` -gt 950 $(RM) $(OBJDIR)mix-length.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 tools' build rules ###### ifeq ($(TARGET_OS),windows) # On Windows, the mix-mt tool needs to be linked with the assy-support object file. $(OBJDIR)mix-mt$(PINTOOL_SUFFIX): $(OBJDIR)mix-mt$(OBJ_SUFFIX) $(OBJDIR)assy-support-$(TARGET)$(OBJ_SUFFIX) $(CONTROLLERLIB) $(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $^ $(TOOL_LPATHS) $(TOOL_LIBS) else $(OBJDIR)mix-mt$(PINTOOL_SUFFIX): $(OBJDIR)mix-mt$(OBJ_SUFFIX) $(CONTROLLERLIB) $(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $^ $(TOOL_LPATHS) $(TOOL_LIBS) endif