-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile.rules
More file actions
executable file
·199 lines (153 loc) · 8.41 KB
/
Copy pathmakefile.rules
File metadata and controls
executable file
·199 lines (153 loc) · 8.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#
# Copyright (C) 2012-2023 Intel Corporation.
# SPDX-License-Identifier: MIT
#
##############################################################
#
# 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 := inscount0 inscount1 inscount2 proccount imageload staticcount detach malloctrace \
malloc_mt inscount_tls stack-debugger pinatrace itrace isampling safecopy invocation countreps \
nonstatica
# 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 := fibonacci little_malloc
# 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 += buffer_linux fork_jit_tool follow_child_tool strace emudiv replacesigprobed
TEST_ROOTS += statica
SA_TOOL_ROOTS += statica
APP_ROOTS += fork_app follow_child_app1 follow_child_app2 divide_by_zero
endif
# macOS*
ifeq ($(TARGET_OS),mac)
TEST_TOOL_ROOTS += fork_jit_tool follow_child_tool strace
TEST_ROOTS += statica prefer_parse_image_from_file
SA_TOOL_ROOTS += statica
APP_ROOTS += fork_app follow_child_app1 follow_child_app2
endif
# Windows
ifeq ($(TARGET_OS),windows)
TEST_TOOL_ROOTS += w_malloctrace buffer_windows emudiv replacesigprobed dumpargv
APP_ROOTS += divide_by_zero
endif
###### Handle exceptions here (OS/arch related) ######
RUNNABLE_TESTS := $(TEST_TOOL_ROOTS) $(TEST_ROOTS)
###### Handle exceptions here (bugs related) ######
# TODO: These tests fail - fix and remove the following:
# See Mantis 4311 for nonstatica
ifeq ($(TARGET_OS),windows)
TEST_TOOL_ROOTS := $(filter-out nonstatica, $(TEST_TOOL_ROOTS))
endif
ifeq ($(TARGET_OS),mac)
MACOS_VERSION_GE_1100 := $(shell $(TOOLS_ROOT)/Utils/testMacOsVersion ge 11.0.0)
ifeq ($(MACOS_VERSION_GE_1100), 1)
# See mantis 4883
TEST_TOOL_ROOTS := $(filter-out follow_child_tool, $(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
inscount_tls.test: $(OBJDIR)inscount_tls$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -t $(OBJDIR)inscount_tls$(PINTOOL_SUFFIX) -- $(THREAD_APP) > $(OBJDIR)inscount_tls.out 2>&1
$(RM) $(OBJDIR)inscount_tls.out
replacesigprobed.test: $(OBJDIR)replacesigprobed$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)replacesigprobed$(PINTOOL_SUFFIX) \
-- $(TESTAPP) makefile $(OBJDIR)replacesigprobed.makefile.copy > $(OBJDIR)replacesigprobed.out
$(DIFF) makefile $(OBJDIR)replacesigprobed.makefile.copy
$(EGREP) "NewMalloc|Skip replacing" $(OBJDIR)replacesigprobed.out
$(RM) $(OBJDIR)replacesigprobed.makefile.copy $(OBJDIR)replacesigprobed.out
malloc_mt.test: $(OBJDIR)malloc_mt$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -t $(OBJDIR)malloc_mt$(PINTOOL_SUFFIX) -- $(THREAD_APP) > $(OBJDIR)malloc_mt.out 2>&1
$(RM) $(OBJDIR)malloc_mt.out
buffer_linux.test: $(OBJDIR)buffer_linux$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -t $(OBJDIR)buffer_linux$(PINTOOL_SUFFIX) -- $(THREAD_APP) > $(OBJDIR)buffer_linux.out 2>&1
$(RM) $(OBJDIR)buffer_linux.out
buffer_windows.test: $(OBJDIR)buffer_windows$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -t $(OBJDIR)buffer_windows$(PINTOOL_SUFFIX) -emit 0 \
-- $(THREAD_APP) > $(OBJDIR)buffer_windows.out 2>&1
$(RM) $(OBJDIR)buffer_windows.out
invocation.test: $(OBJDIR)invocation$(PINTOOL_SUFFIX) $(OBJDIR)little_malloc$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)invocation$(PINTOOL_SUFFIX) -- $(OBJDIR)little_malloc$(EXE_SUFFIX) > $(OBJDIR)invocation.out 2>&1
$(RM) $(OBJDIR)invocation.out
# This tool is tested in "Debugger/makefile". However, leave this line because it is referenced in the user manual.
# The user may invoke make stack-debugger.test to build the tool and app shown in the manual.
# There is an intentional "empty" line which contains a tab character so this "test" will have an empty recipe.
stack-debugger.test: $(OBJDIR)stack-debugger$(PINTOOL_SUFFIX) $(OBJDIR)fibonacci$(EXE_SUFFIX)
# stand alone pin tool
statica.test: $(OBJDIR)statica$(SATOOL_SUFFIX)
$(SET_DLL_PATH) $(OBJDIR)statica$(SATOOL_SUFFIX) -i $(OBJDIR)statica$(SATOOL_SUFFIX) > $(OBJDIR)statica.dmp
$(RM) $(OBJDIR)statica.dmp
nonstatica.test: $(OBJDIR)nonstatica$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)nonstatica$(PINTOOL_SUFFIX) \
-- $(TESTAPP) makefile $(OBJDIR)nonstatica.makefile.copy > $(OBJDIR)nonstatica.dmp
$(DIFF) makefile $(OBJDIR)nonstatica.makefile.copy
$(RM) $(OBJDIR)nonstatica.makefile.copy $(OBJDIR)nonstatica.dmp
emudiv.test: $(OBJDIR)emudiv$(PINTOOL_SUFFIX) $(OBJDIR)divide_by_zero$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)emudiv$(PINTOOL_SUFFIX) -- $(OBJDIR)divide_by_zero$(EXE_SUFFIX) > $(OBJDIR)emudiv.out 2>&1
$(QGREP) "Caught divide by zero exception" $(OBJDIR)emudiv.out
$(RM) $(OBJDIR)emudiv.out
fork_jit_tool.test: $(OBJDIR)fork_jit_tool$(PINTOOL_SUFFIX) $(OBJDIR)fork_app$(EXE_SUFFIX)
$(PIN) -t $(OBJDIR)fork_jit_tool$(PINTOOL_SUFFIX) -- $(OBJDIR)fork_app$(EXE_SUFFIX)
follow_child_tool.test: $(OBJDIR)follow_child_tool$(PINTOOL_SUFFIX) $(OBJDIR)follow_child_app1$(EXE_SUFFIX) $(OBJDIR)follow_child_app2$(EXE_SUFFIX)
$(PIN) -follow_execv 1 -t $(OBJDIR)follow_child_tool$(PINTOOL_SUFFIX) \
-- $(OBJDIR)follow_child_app1$(EXE_SUFFIX) $(OBJDIR)follow_child_app2$(EXE_SUFFIX)
dumpargv.test: $(OBJDIR)dumpargv$(PINTOOL_SUFFIX) $(THREAD_APP)
$(PIN) -error_file '\\isamba\nfs\site\ptl\bistro\log' -t $(OBJDIR)dumpargv$(PINTOOL_SUFFIX) \
-- $(THREAD_APP) > $(OBJDIR)dumpargv.out 2>&1
$(RM) $(OBJDIR)dumpargv.out
# Testing -prefer_parse_macho_from_mem 0 with this chosen test
prefer_parse_image_from_file.test: $(OBJDIR)imageload$(PINTOOL_SUFFIX) $(TESTAPP)
$(PIN) -t $(OBJDIR)imageload$(PINTOOL_SUFFIX) -prefer_parse_macho_from_mem 0 -o $(OBJDIR)prefer_parse_image_from_file_tool.log \
-- $(TESTAPP) makefile $(OBJDIR)prefer_parse_image_from_file.makefile.copy > $(OBJDIR)prefer_parse_image_from_file.out
$(RM) $(OBJDIR)prefer_parse_image_from_file.makefile.copy $(OBJDIR)prefer_parse_image_from_file_tool.log \
$(OBJDIR)prefer_parse_image_from_file.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)divide_by_zero$(EXE_SUFFIX): divide_by_zero_$(OS_TYPE).c
$(APP_CC) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS)