]> git.saurik.com Git - apple/dyld.git/blame - testing/README.txt
dyld-421.2.tar.gz
[apple/dyld.git] / testing / README.txt
CommitLineData
9f83892a
A
1
2When the dyld_tests target is built, all test cases are built into /AppleInternal/.
3A test case is a directory in $SRCROOT/testing/test-cases/ whose name ends in ".dtest".
4The build system scraps any .c or .cxx files in the .dtest directory looking for BUILD: or RUN: lines.
5The BUILD: lines are use to build the test case binaries.
6The RUN: lines are used to build the information needed for BATS to run the test cases.
7Example, main.c may contain:
8
9 // BUILD: $CC main.c -o $BUILD_DIR/example.exe
10 // RUN: ./example.exe
11 int main() { return 0; }
12
13When build lines are executed, the current directory is set to the test case's .dtest dir.
14Build lines may contain the follow variables:
15 $BUILD_DIR - expands to the directory in $DSTROOT where this test case binaries are installed
16 $RUN_DIR - expands to the directory in /AppleInternal/ where this test case binaries will be run
17 $TEMP_DIR - expands to a temporary directory that will be delete after this test case is built
18 $CC - expands to the C compiler command line for the current platform. It includes
19 the min-os-version option, then SDK option, and the architectures.
20 $CXX - expands to the C++ compiler plus standard options
21
22When run lines are executed, the current directory is set to what $RUN_DIR was during build.
23Run lines may contain the follow variables:
24 $RUN_DIR - expands to the directory in /AppleInternal/ where this test case binaries are installed
25 $REQUIRE_CRASH - expands to the 'nocr' tool which is used when a program is expected to "crash" in order to pass
26
27
28When a test program runs, it should initially print out the name of the test case. Ex:
29 [BEGIN] dlfoo-thread-safe
30Then it should print a pass or fail message with the same test name. Ex:
31 [PASS] dlfoo-thread-safe
32
33
34To support tests that dyld is supposed to terminate, use $REQUIRE_CRASH on the RUN: line
35along with setting env var NOCR_TEST_NAME to the name of the test case. When that env
36var is set, the nocr tool wil print out the [BEGIN], then [PASS] if the test crashes
37otherwise [FAIL]. Ex:
38 // RUN: NOCR_TEST_NAME="dylib-static-link missing" $REQUIRE_CRASH ./dylib-static-missing.exe
39
40
41To support tests that are platform specific, add the BUILD_ONLY: line which specifies the platform.
42Valid platforms are: MacOSX, iOS, watchOS, and tvOS. When a specific platform is specified, a
43new min OS version can also be specified via the BUILD_MIN_OS option. For instance:
44 // BUILD_ONLY: MacOSX
45 // BUILD_MIN_OS: 10.5
46
47