Skip to content

Instantly share code, notes, and snippets.

@Viranchee
Last active September 20, 2023 15:57
Show Gist options
  • Save Viranchee/f4e96c41c60199d20c9028fca8899205 to your computer and use it in GitHub Desktop.
Save Viranchee/f4e96c41c60199d20c9028fca8899205 to your computer and use it in GitHub Desktop.
LIT script for a test
../llvm-project/llvm/utils/lit/lit.py -sv /Users/viranchee/appleSwift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/AutoDiff/ --show-xfail --show-unsupported --filter differentiable_protocol_requirements.swift
BUILD_DIR=/Users/viranchee/appleSwift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64;
TEST_ARG=test-macosx-arm64/AutoDiff/validation-test/Output/differentiable_protocol_requirements.swift;
TEST_FILE=/Users/viranchee/appleSwift/swift/test/AutoDiff/validation-test/differentiable_protocol_requirements.swift;
XCODE_DEV_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer;
SWIFTC_PATH=$BUILD_DIR/bin/swiftc;
LIB_PATH=$BUILD_DIR/lib;
DYLD_LIB_PATH=$BUILD_DIR/lib/swift/macosx;
# custom toolchain, dyld path and lib path
TOOLCHAIN_PATH="/Users/viranchee/Downloads/toolchain/extracted/swift-DEVELOPMENT-SNAPSHOT-2023-09-13-a-osx";
DYLD_LIB_PATH=$TOOLCHAIN_PATH/usr/lib/swift/macosx;
LIB_PATH=$TOOLCHAIN_PATH/usr/lib;
# Custom Swiftc from toolchain fails: error: no such module 'StdlibUnittest'
# SWIFTC_PATH=" /$TOOLCHAIN_PATH/usr/bin/swiftc";
set \
-o pipefail; \
{ : 'RUN: at line 1'; \
rm -rf $BUILD_DIR/$TEST_ARG.tmp \
&& mkdir -p $BUILD_DIR/$TEST_ARG.tmp \
&& xcrun \
--toolchain default \
--sdk $XCODE_DEV_PATH/SDKs/MacOSX13.3.sdk \
$SWIFTC_PATH \
-target arm64-apple-macosx10.13 \
-module-cache-path $BUILD_DIR/swift-test-results/arm64-apple-macosx10.13/clang-module-cache \
-F $XCODE_DEV_PATH/Library/Frameworks \
-toolchain-stdlib-rpath \
-Xlinker \
-rpath \
-Xlinker $XCODE_DEV_PATH/Library/Frameworks \
-Xlinker \
-rpath \
-Xlinker /usr/lib/swift \
-Xlinker \
-headerpad_max_install_names \
-swift-version 4 \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' \
-Xfrontend \
-define-availability \
-Xfrontend 'SwiftStdlib 5.10:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' \
-F $LIB_PATH \
-Xlinker \
-rpath \
-Xlinker $LIB_PATH \
-module-cache-path $BUILD_DIR/swift-test-results/arm64-apple-macosx10.13/clang-module-cache \
$TEST_FILE \
-o $BUILD_DIR/$TEST_ARG.tmp/a.out \
-module-name main \
&& /Users/viranchee/appleSwift/swift/utils/swift-darwin-postprocess.py $BUILD_DIR/$TEST_ARG.tmp/a.out \
&& /usr/bin/env DYLD_LIBRARY_PATH=$DYLD_LIB_PATH \
$BUILD_DIR/$TEST_ARG.tmp/a.out; \
} \
@Viranchee
Copy link
Author

the test script is generated in this file:

build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/AutoDiff/validation-test/Output/differentiable_protocol_requirements.swift.script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment