]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/README
ld64-77.tar.gz
[apple/ld64.git] / unit-tests / README
1
2 The easy way to run all tests is within Xcode. Just select "unit-tests" as the target and click Build.
3
4 When run from within Xcode, the just built linker will be used. If you cd into a test case and run it, the
5 installed linker (e.g. /usr/bin/ld) will be used.
6
7 Each test case is a directory with a Makefile. The Makefile default target should do whatever work is necessary
8 to perform the test. If successful is should print "PASS xxx" where xxx is the name of the test case. Otherwise
9 it should print "FAIL xxx reason". If nothing is printed (for instance a tool crashed), the harness will
10 automatically print that it failed. The harness will always pass ARCH to the Makefile to specify which
11 architecture to test. The Makefile should also have a "clean" target which removes and generated files.
12
13
14 There are some utility functions for use in Makefiles for generating the PASS/FAIL strings:
15
16 ${PASS_IFF} can be put in front of the last command in the make rule and it will print PASS
17 if the command returned 0 or FAIL otherwise. Example:
18 ${PASS_IFF} ${CC} foo.c -o foo
19 Will print PASS if and only if the compilation succeeded
20
21 ${PASS_IFF_EMPTY} can have data piped into it. It prints PASS if there is no data, otherwise FAIL.
22 Example:
23 otool -hv foo.o | grep SUBSECTIONS_VIA_SYMBOLS | ${PASS_IFF_EMPTY}
24 Will print PASS if and only if the output of otool does not contain SUBSECTIONS_VIA_SYMBOLS
25
26
27
28