921921if [[ ! " ${SKIP_BUILD_SWIFTPM} " ]] ; then
922922 PRODUCTS=(" ${PRODUCTS[@]} " swiftpm)
923923fi
924- if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
925- PRODUCTS=(" ${PRODUCTS[@]} " xctest)
926- fi
924+ # XCTest has a dependency upon Foundation. It must be added to the list of
925+ # products *after* Foundation.
927926if [[ ! " ${SKIP_BUILD_FOUNDATION} " ]] ; then
928927 PRODUCTS=(" ${PRODUCTS[@]} " foundation)
929928fi
929+ if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
930+ PRODUCTS=(" ${PRODUCTS[@]} " xctest)
931+ fi
930932if [[ ! " ${SKIP_BUILD_LIBDISPATCH} " ]] ; then
931933 PRODUCTS=(" ${PRODUCTS[@]} " libdispatch)
932934fi
@@ -1796,16 +1798,6 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
17961798 # swiftpm installs itself with a bootstrap method. No further cmake building is performed.
17971799 continue
17981800 ;;
1799- xctest)
1800- SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
1801- SWIFT_BUILD_PATH=" $( build_directory ${deployment_target} swift) "
1802- set -x
1803- " ${XCTEST_SOURCE_DIR} " /build_script.py --swiftc=" ${SWIFTC_BIN} " --build-dir=" ${build_dir} " --swift-build-dir=" ${SWIFT_BUILD_PATH} "
1804- { set +x; } 2> /dev/null
1805-
1806- # XCTest builds itself and doesn't rely on cmake
1807- continue
1808- ;;
18091801 foundation)
18101802 # the configuration script requires knowing about XCTest's location for building and running the tests
18111803 XCTEST_BUILD_DIR=$( build_directory ${deployment_target} xctest)
@@ -1831,6 +1823,23 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
18311823 # Foundation builds itself and doesn't use cmake
18321824 continue
18331825 ;;
1826+ xctest)
1827+ if [[ " $( uname -s) " == " Darwin" ]] ; then
1828+ set -x
1829+ xcodebuild -project " ${XCTEST_SOURCE_DIR} " /XCTest.xcodeproj -scheme SwiftXCTest SKIP_INSTALL=NO DEPLOYMENT_LOCATION=YES DSTROOT=" ${build_dir} " INSTALL_PATH=" /"
1830+ { set +x; } 2> /dev/null
1831+ else
1832+ SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
1833+ SWIFT_BUILD_PATH=" $( build_directory ${deployment_target} swift) "
1834+ FOUNDATION_BUILD_DIR=" $( build_directory ${deployment_target} foundation) " /Foundation
1835+ set -x
1836+ " ${XCTEST_SOURCE_DIR} " /build_script.py --swiftc=" ${SWIFTC_BIN} " --build-dir=" ${build_dir} " --swift-build-dir=" ${SWIFT_BUILD_PATH} " --foundation-build-dir=" ${FOUNDATION_BUILD_DIR} "
1837+ { set +x; } 2> /dev/null
1838+ fi
1839+
1840+ # XCTest builds itself and doesn't rely on cmake
1841+ continue
1842+ ;;
18341843 libdispatch)
18351844 LIBDISPATCH_BUILD_DIR=$( build_directory ${deployment_target} ${product} )
18361845
@@ -2017,13 +2026,6 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
20172026 # As swiftpm tests itself, we break early here.
20182027 continue
20192028 ;;
2020- xctest)
2021- if [[ " ${SKIP_TEST_XCTEST} " ]]; then
2022- continue
2023- fi
2024- # FIXME: We don't test xctest, yet...
2025- continue
2026- ;;
20272029 foundation)
20282030 if [[ " ${SKIP_TEST_FOUNDATION} " ]]; then
20292031 continue
@@ -2040,6 +2042,28 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
20402042 echo " --- Finished tests for ${product} ---"
20412043 continue
20422044 ;;
2045+ xctest)
2046+ if [[ " ${SKIP_TEST_XCTEST} " ]]; then
2047+ continue
2048+ fi
2049+ echo " --- Running tests for ${product} ---"
2050+ if [[ " $( uname -s) " == " Darwin" ]] ; then
2051+ set -x
2052+ xcodebuild -project " ${XCTEST_SOURCE_DIR} " /XCTest.xcodeproj -scheme SwiftXCTestFunctionalTests
2053+ { set +x; } 2> /dev/null
2054+ else
2055+ SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
2056+ SWIFT_BUILD_PATH=" $( build_directory ${deployment_target} swift) "
2057+ FOUNDATION_BUILD_PATH=" $( build_directory ${deployment_target} foundation) " /Foundation
2058+ set -x
2059+ # FIXME: This re-builds swift-corelibs-xctest. Instead, 'build_script.py' should take
2060+ # a top-level 'test' command that only tests an already built XCTest.
2061+ " ${XCTEST_SOURCE_DIR} " /build_script.py --swiftc=" ${SWIFTC_BIN} " --build-dir=" ${build_dir} " --swift-build-dir=" ${SWIFT_BUILD_PATH} " --foundation-build-dir=" ${FOUNDATION_BUILD_PATH} " --test
2062+ { set +x; } 2> /dev/null
2063+ fi
2064+ echo " --- Finished tests for ${product} ---"
2065+ continue
2066+ ;;
20432067 libdispatch)
20442068 if [[ " ${SKIP_TEST_LIBDISPATCH} " ]]; then
20452069 continue
0 commit comments