Skip to content

Commit bc111a9

Browse files
committed
IMPROVE: custom makefile.rules
1 parent a8b0a9a commit bc111a9

1 file changed

Lines changed: 5 additions & 121 deletions

File tree

makefile.rules

Lines changed: 5 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# This defines tests which run tools of the same name. This is simply for convenience to avoid
1818
# defining the test name twice (once in TOOL_ROOTS and again in TEST_ROOTS).
1919
# Tests defined here should not be defined in TOOL_ROOTS and TEST_ROOTS.
20-
TEST_TOOL_ROOTS := syscall_time
20+
TEST_TOOL_ROOTS := addrIntercept
2121

2222
# This defines the tests to be run that were not already defined in TEST_TOOL_ROOTS.
2323
TEST_ROOTS :=
@@ -32,7 +32,7 @@ TOOL_ROOTS :=
3232
# Note: Static analysis tools are in fact executables linked with the Pin Static Analysis Library.
3333
# This library provides a subset of the Pin APIs which allows the tool to perform static analysis
3434
# of an application or dll. Pin itself is not used when this tool runs.
35-
SA_TOOL_ROOTS :=
35+
SA_TOOL_ROOTS :=
3636

3737
# This defines all the applications that will be run during the tests.
3838
APP_ROOTS :=
@@ -46,34 +46,6 @@ DLL_ROOTS :=
4646
# This defines any static libraries (archives), that need to be built.
4747
LIB_ROOTS :=
4848

49-
###### Place OS-specific definitions here ######
50-
51-
# Linux
52-
ifeq ($(TARGET_OS),linux)
53-
TEST_TOOL_ROOTS += mmap close_all_files
54-
TEST_ROOTS += ppollEmulationSuccessful ppollEmulationSignalInterrupt ppollEmulationTimeOut ppollEmulationNullSigmask \
55-
system_syscall_client_lock popen_syscall_client_lock clone_syscall_different_process_client_lock \
56-
clone_syscall_same_process_client_lock pin_clone exit_restartable_syscall
57-
TOOL_ROOTS += syscalls_and_locks_tool
58-
APP_ROOTS += ppollEmulation_app syscalls_and_locks_app mmap_app close_all_files_app pin_clone_app exit_restartable_syscall_app
59-
60-
ifeq ($(TARGET),ia32e)
61-
TEST_ROOTS += check_prctl
62-
APP_ROOTS += check_prctl_app
63-
endif
64-
endif
65-
66-
ifeq ($(TARGET_OS),mac)
67-
TEST_TOOL_ROOTS += mmap close_all_files
68-
TEST_ROOTS += exit_restartable_syscall
69-
APP_ROOTS += mmap_app close_all_files_app exit_restartable_syscall_app
70-
endif
71-
72-
# Windows
73-
ifeq ($(TARGET_OS),windows)
74-
TEST_ROOTS += syscall_tracing_compare
75-
endif
76-
7749
###### Define the sanity subset ######
7850

7951
# This defines the list of tests that should run in sanity. It should include all the tests listed in
@@ -91,94 +63,6 @@ SANITY_SUBSET := $(TEST_TOOL_ROOTS) $(TEST_ROOTS)
9163
# See makefile.default.rules for the default test rules.
9264
# All tests in this section should adhere to the naming convention: <testname>.test
9365

94-
ppollEmulationSuccessful.test: $(OBJDIR)ppollEmulation_app$(EXE_SUFFIX)
95-
$(PIN) -- $< 1 $(OBJDIR)$(@:%.test=%.out) $(OBJDIR)$(@:%.test=%Pipe)
96-
$(QGREP) "ppoll succeeded" $(OBJDIR)$(@:%.test=%.out)
97-
$(RM) $(OBJDIR)$(@:%.test=%.out)
98-
99-
ppollEmulationSignalInterrupt.test: $(OBJDIR)ppollEmulation_app$(EXE_SUFFIX)
100-
$(PIN) -- $< 2 $(OBJDIR)$(@:%.test=%.out) $(OBJDIR)$(@:%.test=%Pipe)
101-
$(QGREP) "sigalarm interrupted the ppoll system call" $(OBJDIR)$(@:%.test=%.out)
102-
$(RM) $(OBJDIR)$(@:%.test=%.out)
103-
104-
ppollEmulationTimeOut.test: $(OBJDIR)ppollEmulation_app$(EXE_SUFFIX)
105-
$(PIN) -- $< 3 $(OBJDIR)$(@:%.test=%.out) $(OBJDIR)$(@:%.test=%Pipe)
106-
$(QGREP) "The call timed out and no file descriptors were ready" $(OBJDIR)$(@:%.test=%.out)
107-
$(RM) $(OBJDIR)$(@:%.test=%.out)
108-
109-
ppollEmulationNullSigmask.test: $(OBJDIR)ppollEmulation_app$(EXE_SUFFIX)
110-
$(PIN) -- $< 4 $(OBJDIR)$(@:%.test=%.out) $(OBJDIR)$(@:%.test=%Pipe)
111-
$(QGREP) "ppoll succeeded" $(OBJDIR)$(@:%.test=%.out)
112-
$(RM) $(OBJDIR)$(@:%.test=%.out)
113-
114-
system_syscall_client_lock.test: $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX)
115-
$(PIN) -t $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX) -lock_type 3 \
116-
-- $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) 1
117-
118-
popen_syscall_client_lock.test: $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX)
119-
$(PIN) -t $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX) -lock_type 3 \
120-
-- $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) 2
121-
122-
clone_syscall_different_process_client_lock.test: $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX)
123-
$(PIN) -t $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX) -lock_type 3 \
124-
-- $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) 3
125-
126-
clone_syscall_same_process_client_lock.test: $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX)
127-
$(PIN) -t $(OBJDIR)syscalls_and_locks_tool$(PINTOOL_SUFFIX) -lock_type 3 \
128-
-- $(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX) 4
129-
130-
mmap.test: $(OBJDIR)mmap$(PINTOOL_SUFFIX) $(OBJDIR)mmap_app$(EXE_SUFFIX)
131-
$(PIN) -t $(OBJDIR)mmap$(PINTOOL_SUFFIX) -o $(OBJDIR)mmap.out -- $(OBJDIR)mmap_app$(EXE_SUFFIX) $(OBJDIR)mmap.dat
132-
$(QGREP) "Success!" $(OBJDIR)mmap.out
133-
$(RM) $(OBJDIR)mmap.dat $(OBJDIR)mmap.out
134-
135-
# This test checks that Pin guards the file descriptors opened by itself and the
136-
# tool, and doesn't let the application to close them.
137-
# Checking "exit" string appears in $(OBJDIR)close_all_files_pin.log (when using log_syscall) in order to confirm pin.log
138-
# is not closed when application closed all application descriptors. Seeing system exit in the log verifies that.
139-
close_all_files.test: $(OBJDIR)close_all_files$(PINTOOL_SUFFIX) $(OBJDIR)close_all_files_app$(EXE_SUFFIX)
140-
$(PIN) -logfile $(OBJDIR)close_all_files_pin.log -xyzzy -mesgon log_syscall -t $(OBJDIR)close_all_files$(PINTOOL_SUFFIX) \
141-
-o $(OBJDIR)close_all_files.out -f $(OBJDIR)afterForkInChild_tool.log \
142-
-- $(OBJDIR)close_all_files_app$(EXE_SUFFIX) > $(OBJDIR)close_all_files_app.out
143-
$(QGREP) "exit" $(OBJDIR)close_all_files_pin.log
144-
$(QGREP) "success" $(OBJDIR)afterForkInChild_tool.log
145-
$(QGREP) "C Success!" $(OBJDIR)close_all_files.out_for_c
146-
$(QGREP) "C++ Success!" $(OBJDIR)close_all_files.out_for_cpp
147-
$(QGREP) "Application is done" $(OBJDIR)close_all_files_app.out
148-
$(RM) $(OBJDIR)close_all_files.out_for_c $(OBJDIR)close_all_files.out_for_cpp
149-
$(PIN) -t $(OBJDIR)close_all_files$(PINTOOL_SUFFIX) -probe -o $(OBJDIR)close_all_files.out -f $(OBJDIR)afterForkInChildProbed_tool.log \
150-
-- $(OBJDIR)close_all_files_app$(EXE_SUFFIX) > $(OBJDIR)close_all_files_app.out
151-
$(QGREP) "success" $(OBJDIR)afterForkInChildProbed_tool.log
152-
$(QGREP) "C Success!" $(OBJDIR)close_all_files.out_for_c
153-
$(QGREP) "C++ Success!" $(OBJDIR)close_all_files.out_for_cpp
154-
$(QGREP) "Application is done" $(OBJDIR)close_all_files_app.out
155-
$(RM) $(OBJDIR)close_all_files.out_for_c $(OBJDIR)close_all_files.out_for_cpp $(OBJDIR)close_all_files_app.out
156-
157-
syscall_tracing_compare.test: $(OBJDIR) $(TESTAPP)
158-
$(PIN) -xyzzy -syscall_tracer seh -log_server -mesgon log_winloader -logfile $(OBJDIR)syscall_tracing_compare_seh.log \
159-
-- $(TESTAPP) makefile $(OBJDIR)syscall_tracing_compare_seh.makefile.copy
160-
$(CMP) makefile $(OBJDIR)syscall_tracing_compare_seh.makefile.copy
161-
$(GREP) "syscall number =" $(OBJDIR)syscall_tracing_compare_seh.log | $(SED) 's/trace ended.*syscall/syscall/' > $(OBJDIR)syscall_numbers_seh.log
162-
$(PIN) -xyzzy -syscall_tracer dbg -log_server -mesgon log_winloader -logfile $(OBJDIR)syscall_tracing_compare_dbg.log \
163-
-- $(TESTAPP) makefile $(OBJDIR)syscall_tracing_compare_dbg.makefile.copy
164-
$(CMP) makefile $(OBJDIR)syscall_tracing_compare_dbg.makefile.copy
165-
$(GREP) "syscall number =" $(OBJDIR)syscall_tracing_compare_dbg.log | $(SED) 's/trace ended.*syscall/syscall/' > $(OBJDIR)syscall_numbers_dbg.log
166-
$(CMP) $(OBJDIR)syscall_numbers_seh.log $(OBJDIR)syscall_numbers_dbg.log
167-
$(RM) $(OBJDIR)syscall_tracing_compare_*.makefile.copy $(OBJDIR)syscall_tracing_compare_*.log $(OBJDIR)syscall_numbers_*.log
168-
169-
pin_clone.test: $(OBJDIR)pin_clone_app$(EXE_SUFFIX)
170-
$(PIN) -- $(OBJDIR)pin_clone_app$(EXE_SUFFIX)
171-
172-
exit_restartable_syscall.test: $(OBJDIR)exit_restartable_syscall_app$(EXE_SUFFIX)
173-
$(PIN) -- $(OBJDIR)exit_restartable_syscall_app$(EXE_SUFFIX)
174-
175-
syscall_time.test: $(OBJDIR)syscall_time$(PINTOOL_SUFFIX) $(THREAD_APP)
176-
$(PIN) -t $(OBJDIR)syscall_time$(PINTOOL_SUFFIX) -- $(THREAD_APP) > $(OBJDIR)syscall_time.out 2>&1
177-
$(RM) $(OBJDIR)syscall_time.out
178-
179-
check_prctl.test: $(OBJDIR)check_prctl_app$(EXE_SUFFIX)
180-
$(PIN) -- $(OBJDIR)check_prctl_app$(EXE_SUFFIX)
181-
18266

18367
##############################################################
18468
#
@@ -189,7 +73,7 @@ check_prctl.test: $(OBJDIR)check_prctl_app$(EXE_SUFFIX)
18973
# This section contains the build rules for all binaries that have special build rules.
19074
# See makefile.default.rules for the default build rules.
19175

192-
###### Special applications' build rules ######
76+
###### Special tools' build rules ######
19377

194-
$(OBJDIR)syscalls_and_locks_app$(EXE_SUFFIX): syscalls_and_locks_app.cpp
195-
$(APP_CXX) $(APP_CXXFLAGS_NOOPT) $(COMP_EXE)$@ $< $(APP_LDFLAGS_NOOPT) $(APP_LIBS) $(CXX_LPATHS) $(CXX_LIBS)
78+
$(OBJDIR)addrIntercept$(PINTOOL_SUFFIX): $(OBJDIR)addrIntercept$(OBJ_SUFFIX) $(CONTROLLERLIB)
79+
$(LINKER) $(TOOL_LDFLAGS) $(LINK_EXE)$@ $^ $(TOOL_LPATHS) $(TOOL_LIBS)

0 commit comments

Comments
 (0)