mirror of
https://github.com/darlinghq/darling-dyld.git
synced 2024-11-26 22:00:26 +00:00
01ca8e46cb
dyld-733.6 |
||
---|---|---|
.. | ||
include | ||
nocr | ||
test-cases | ||
build_tests.py | ||
get_task_allow_entitlement.plist | ||
README.txt | ||
run_all_dyld_tests.py | ||
task_for_pid_entitlement.plist |
When the dyld_tests target is built, all test cases are built into /AppleInternal/. A test case is a directory in $SRCROOT/testing/test-cases/ whose name ends in ".dtest". The build system reads any .c or .cxx files in the .dtest directory looking for BUILD: or RUN: lines. The BUILD: lines are use to build the test case binaries. The RUN: lines are used to build the information needed for BATS to run the test cases. Example, main.c may contain: // BUILD: $CC main.c -o $BUILD_DIR/example.exe // RUN: ./example.exe int main() { return 0; } When build lines are executed, the current directory is set to the test case's .dtest dir. Build lines may contain the follow variables: $BUILD_DIR - expands to the directory in $DSTROOT where this test case binaries are installed $RUN_DIR - expands to the directory in /AppleInternal/ where this test case binaries will be run $TEMP_DIR - expands to a temporary directory that will be delete after this test case is built $CC - expands to the C compiler command line for the current platform. It includes the min-os-version option, then SDK option, and the architectures. $CXX - expands to the C++ compiler plus standard options When run lines are executed, the current directory is set to what $RUN_DIR was during build. Run lines may contain the follow variables: $RUN_DIR - expands to the directory in /AppleInternal/ where this test case binaries are installed $REQUIRE_CRASH - expands to the 'nocr' tool which is used when a program is expected to "crash" in order to pass When a test program runs, it should initially print out the name of the test case. Ex: [BEGIN] dlfoo-thread-safe Then it should print a pass or fail message with the same test name. Ex: [PASS] dlfoo-thread-safe To support tests that dyld is supposed to terminate, use $REQUIRE_CRASH on the RUN: line along with setting env var NOCR_TEST_NAME to the name of the test case. When that env var is set, the nocr tool wil print out the [BEGIN], then [PASS] if the test crashes otherwise [FAIL]. Ex: // RUN: NOCR_TEST_NAME="dylib-static-link missing" $REQUIRE_CRASH ./dylib-static-missing.exe To support tests that are platform specific, add the BUILD_ONLY: line which specifies the platform. Valid platforms are: MacOSX, iOS, watchOS, and tvOS. When a specific platform is specified, a new min OS version can also be specified via the BUILD_MIN_OS option. For instance: // BUILD_ONLY: MacOSX // BUILD_MIN_OS: 10.5