Skip to content

[windows][toolchain] Run non-executable Swift Runtime tests for aarch64 Android #79185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ elif platform.system() == 'Darwin':
config.substitutions.append( ('%lto_flags', lto_flags) )
config.substitutions.append( ('%use_just_built_liblto', use_just_built_liblto) )
config.substitutions.append( ('%llvm_libs_dir', llvm_libs_dir) )
config.substitutions.append( ('%llvm_plugin_ext', llvm_plugin_ext) )

if llvm_plugin_ext is not None:
config.substitutions.append( ('%llvm_plugin_ext', llvm_plugin_ext) )

# Allow tests to restore the original environment if they need to.
config.substitutions.append( ('%original_path_env', config.environment['PATH']) )
Expand Down Expand Up @@ -395,28 +397,6 @@ lit_config.note('Using resource dir: ' + test_resource_dir)
test_clang_resource_dir = lit.util.executeCommand([config.clang, '-print-resource-dir'])[0].rstrip()
lit_config.note('Using Clang resource dir: ' + test_clang_resource_dir)

config.swift_system_overlay_opt = ""
config.clang_system_overlay_opt = ""
config.windows_vfs_overlay_opt = ""
if kIsWindows:
# ucrt.modulemap currently requires -fbuiltin-headers-in-system-modules. -strict-implicit-module-context
# is necessary for -Xcc arguments to be passed through ModuleInterfaceLoader.
config.swift_system_overlay_opt = "-vfsoverlay {} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
# this variant is for extract-symbolgraph which doesn't accept all the same arugments as swiftc
# so the extra ceremony lets us pass in the relevant pieces needed for Windows SDK access.
config.windows_vfs_overlay_opt = "-Xcc -vfsoverlay -Xcc {} -Xcc -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
config.clang_system_overlay_opt = "-Xcc -ivfsoverlay -Xcc {} -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
config.substitutions.append( ('%windows_vfs_overlay_opt', config.windows_vfs_overlay_opt) )
stdlib_resource_dir_opt = config.resource_dir_opt
sourcekitd_framework_dir = config.swift_lib_dir
config.substitutions.append( ('%test-resource-dir', test_resource_dir) )

# Parse the variant triple.
# FIXME: We ought to parse 'run_environment' separately from 'run_os'.
(run_cpu, run_vendor, run_os, run_vers) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups()
Expand Down Expand Up @@ -479,6 +459,28 @@ if test_sdk_overlay_dir is not None:
lit_config.note('Using SDK overlay dir: ' + test_sdk_overlay_dir)
config.resource_dir_opt += (" %s" % sdk_overlay_dir_opt)

config.swift_system_overlay_opt = ""
config.clang_system_overlay_opt = ""
config.windows_vfs_overlay_opt = ""
if kIsWindows and run_os in ['windows-msvc']:
# ucrt.modulemap currently requires -fbuiltin-headers-in-system-modules. -strict-implicit-module-context
# is necessary for -Xcc arguments to be passed through ModuleInterfaceLoader.
config.swift_system_overlay_opt = "-vfsoverlay {} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
# this variant is for extract-symbolgraph which doesn't accept all the same arugments as swiftc
# so the extra ceremony lets us pass in the relevant pieces needed for Windows SDK access.
config.windows_vfs_overlay_opt = "-Xcc -vfsoverlay -Xcc {} -Xcc -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
config.clang_system_overlay_opt = "-Xcc -ivfsoverlay -Xcc {} -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules".format(
os.path.join(config.swift_obj_root, "stdlib", "windows-vfs-overlay.yaml")
)
config.substitutions.append( ('%windows_vfs_overlay_opt', config.windows_vfs_overlay_opt) )
stdlib_resource_dir_opt = config.resource_dir_opt
sourcekitd_framework_dir = config.swift_lib_dir
config.substitutions.append( ('%test-resource-dir', test_resource_dir) )

# Default to Swift 4 for now.
# Note that this accepts both `--param swift-version` (like the compiler flag)
# and `--param swift_version` (like a lit configuration parameter).
Expand Down Expand Up @@ -1944,6 +1946,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
config.target_swift_symbolgraph_extract = ' '.join([
config.swift_symbolgraph_extract,
'-target', config.variant_triple,
'-sdk', config.variant_sdk, config.resource_dir_opt,
mcp_opt])
config.target_swift_synthesize_interface = ' '.join([
config.swift_synthesize_interface,
Expand Down Expand Up @@ -2747,6 +2750,7 @@ config.substitutions.insert(0, ('%check-c-header-in-clang',
# Verifies that a C++ file can be compiled without warnings except for some exceptions.
config.substitutions.insert(0, ('%check-cxx-header-in-clang',
'%clangxx -fsyntax-only -x c++-header ' + extraCheckWarningFlags +
' --sysroot %r ' % config.variant_sdk +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weliveindetail, it appears this change broke several tests on the community Android CI, which cross-compiles them from a linux host for Android:

FAIL: Swift(android-aarch64) :: Interop/SwiftToCxx/class/nested-classes-in-cxx.swift (4507 of 18928)
******************** TEST 'Swift(android-aarch64) :: Interop/SwiftToCxx/class/nested-classes-in-cxx.swift' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf "/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp" && mkdir -p "/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp"
+ rm -rf /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp
+ mkdir -p /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp
RUN: at line 2: /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/bin/swift-frontend -target aarch64-unknown-linux-android -sdk /home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -resource-dir /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/lib/swift -module-cache-path /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache -swift-version 4  -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.1' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -typo-correction-limit 10  /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Interop/SwiftToCxx/class/nested-classes-in-cxx.swift -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h
+ /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/bin/swift-frontend -target aarch64-unknown-linux-android -sdk /home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -resource-dir /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/lib/swift -module-cache-path /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache -swift-version 4 -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.1' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -typo-correction-limit 10 /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Interop/SwiftToCxx/class/nested-classes-in-cxx.swift -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h
RUN: at line 3: '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/bin/clang++' -fmodules-cache-path='/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot '/home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot' -F '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Inputs/clang-importer-sdk'/frameworks -I /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/include  -isysroot '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test'/Inputs/clang-importer-sdk -std=c++14 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -I/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/./lib/swift /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17 && '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/bin/clang++' -fmodules-cache-path='/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot '/home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot' -F '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Inputs/clang-importer-sdk'/frameworks -I /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/include  -isysroot '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test'/Inputs/clang-importer-sdk -std=c++17 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -I/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/./lib/swift /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17 && '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/bin/clang++' -fmodules-cache-path='/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot '/home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot' -F '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Inputs/clang-importer-sdk'/frameworks -I /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/include  -isysroot '/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test'/Inputs/clang-importer-sdk -std=c++20 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -I/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/./lib/swift /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17
+ /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/bin/clang++ -fmodules-cache-path=/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension --sysroot /home/swiftci/android/ndk/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -F /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Inputs/clang-importer-sdk/frameworks -I /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/llvm-linux-x86_64/include -isysroot /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/swift/test/Inputs/clang-importer-sdk -std=c++14 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -I/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/./lib/swift /home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17
/home/swiftci/jenkins/workspace/oss-swift-RA-linux-ubuntu-24.04-android-arm64/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Interop/SwiftToCxx/class/Output/nested-classes-in-cxx.swift.tmp/classes.h:29:10: fatal error: 'cstdint' file not found
   29 | #include <cstdint>
      |          ^~~~~~~~~
1 error generated.

Are these Interop/SwiftToCxx tests passing for you on a Windows host when cross-compiled to Android? The good news is that this change has no effect when natively running the compiler validation suite on an Android AArch64 device, the same tests pass there. 😃

It looks like you made this change because otherwise the file was not checked against the NDK, so I think you are right to add this flag for Android, but it will require more flags to work properly on the linux-hosted CI.

I plan to spend time in the coming month fixing the remaining tests on the Android CI run with a linux host, so it would be good to then communicate with whoever is checking these on your Android CI for a Windows host to make sure we get the same results.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our SDK has cstdint at swift-6.1-RELEASE-android-24-0.1.artifactbundle/swift-6.1-release-android-24-sdk/android-27c-sysroot/usr/include/c++/v1/cstdint. I wonder if we manually add <sysroot>/usr/include/c++/v1/ to the include paths if it might find it…

% find $ANDROID_HOME/ndk -name cstdint

~/Library/Android/sdk/ndk/27.0.12077973/sources/cxx-stl/system/include/cstdint
~/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/include/c++/4.9.x/cstdint
~/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/cstdint

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tried that and then saw some other C++ macro errors. I've seen some weird logic in the clang Driver related to the "gcc-toolchain" which allows it to find the C++ headers automatically in the system linux sysroot, but I think not in the Android sysroot. This is probably caused by that, but then it should fail on Windows also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK clang on Windows always needs --sysroot in order to cross-compile for Android, because the location of the NDK cannot be inferred. This is one of the places that lacked the argument. It worked when it merged, but looking at this run of the nightly bot, it has regressed already:

FAIL: Swift(android-x86_64) :: Interop/SwiftToCxx/class/nested-classes-in-cxx.swift (4495 of 18856)

I didn't finish the integration of the downstream filters. In particular, the feature to skip tests in LIT doesn't seem to work in Swift. #80148 unblocked the nightly bots, but also removed visibility of these failures.

IMHO we won't get away without such build-platform specific filters. At least to mark parts of the test suite as "not yet supported" in the mid-term. The test suite is too clunky and toolchain requirements are too diverse. Also, we cannot specify the build-OS in the REQUIRES/UNSUPPORTED/etc. clauses of individual tests (and it would add another layer of mess to the test suite if we did that).

It would be great to fix the skip feature, so we can exclude flaky and xpass tests per build-platform. xfail works. On Windows we load the filter for Android here:

swift/utils/build.ps1

Lines 2230 to 2231 in 22a3ec0

# Filter known issues when testing on Windows
Load-LitTestOverrides $PSScriptRoot/windows-swift-android-lit-test-overrides.txt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK clang on Windows always needs --sysroot in order to cross-compile for Android, because the location of the NDK cannot be inferred. This is one of the places that lacked the argument.

Oh yeah, as I said above, this change appears right, but incomplete when cross-compiling.

It worked when it merged, but looking at this run of the nightly bot, it has regressed already

I'm surprised it ever worked on your Windows host, as it's listed as XFAIL for AArch64 in that output, and fails as expected for the other Android arches on Windows too:

FAIL: Swift(android-x86_64) :: Interop/SwiftToCxx/class/nested-classes-in-cxx.swift (4495 of 18856)
******************** TEST 'Swift(android-x86_64) :: Interop/SwiftToCxx/class/nested-classes-in-cxx.swift' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf "T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp" && mkdir -p "T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp"
# executed command: rm -rf 'T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp'
# executed command: mkdir -p 'T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp'
# RUN: at line 2
t:\5\bin\swift-frontend.exe -target x86_64-unknown-linux-android -sdk T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -resource-dir T:/x86_64-unknown-linux-android28/Runtime/./lib/swift -module-cache-path T:\x86_64-unknown-linux-android28\Runtime\swift-test-results\x86_64-unknown-linux-android\clang-module-cache -swift-version 4  -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.1' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -typo-correction-limit 10  C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\test\Interop\SwiftToCxx\class\nested-classes-in-cxx.swift -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h
# executed command: 't:\5\bin\swift-frontend.exe' -target x86_64-unknown-linux-android -sdk T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -resource-dir T:/x86_64-unknown-linux-android28/Runtime/./lib/swift -module-cache-path 'T:\x86_64-unknown-linux-android28\Runtime\swift-test-results\x86_64-unknown-linux-android\clang-module-cache' -swift-version 4 -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.1' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -typo-correction-limit 10 'C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\test\Interop\SwiftToCxx\class\nested-classes-in-cxx.swift' -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path 'T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h'
# RUN: at line 3
't:\\5\\bin\\clang++.exe' -fmodules-cache-path='T:\\x86_64-unknown-linux-android28\\Runtime\\swift-test-results\\x86_64-unknown-linux-android\\clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot 'T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot' -F 'C:\\Users\\swift-ci\\jenkins\\workspace\\swift-main-windows-toolchain\\swift\\test\\Inputs\\clang-importer-sdk'/frameworks -I T:\x86_64-unknown-linux-android28\LLVM\include  -isysroot 'C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift\\test'/Inputs/clang-importer-sdk -std=c++14 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -IT:/x86_64-unknown-linux-android28/Runtime/./lib/swift T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17 && 't:\\5\\bin\\clang++.exe' -fmodules-cache-path='T:\\x86_64-unknown-linux-android28\\Runtime\\swift-test-results\\x86_64-unknown-linux-android\\clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot 'T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot' -F 'C:\\Users\\swift-ci\\jenkins\\workspace\\swift-main-windows-toolchain\\swift\\test\\Inputs\\clang-importer-sdk'/frameworks -I T:\x86_64-unknown-linux-android28\LLVM\include  -isysroot 'C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift\\test'/Inputs/clang-importer-sdk -std=c++17 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -IT:/x86_64-unknown-linux-android28/Runtime/./lib/swift T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17 && 't:\\5\\bin\\clang++.exe' -fmodules-cache-path='T:\\x86_64-unknown-linux-android28\\Runtime\\swift-test-results\\x86_64-unknown-linux-android\\clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension  --sysroot 'T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot' -F 'C:\\Users\\swift-ci\\jenkins\\workspace\\swift-main-windows-toolchain\\swift\\test\\Inputs\\clang-importer-sdk'/frameworks -I T:\x86_64-unknown-linux-android28\LLVM\include  -isysroot 'C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift\\test'/Inputs/clang-importer-sdk -std=c++20 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -IT:/x86_64-unknown-linux-android28/Runtime/./lib/swift T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17
# executed command: 't:\\5\\bin\\clang++.exe' '-fmodules-cache-path=T:\\x86_64-unknown-linux-android28\\Runtime\\swift-test-results\\x86_64-unknown-linux-android\\clang-module-cache' -fsyntax-only -x c++-header -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -Wno-auto-import -Wno-variadic-macros -Wno-c++98-compat-pedantic -Wno-poison-system-directories -Wno-unused-command-line-argument -Wno-nullability-extension --sysroot T:/android-ndk-r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -F 'C:\\Users\\swift-ci\\jenkins\\workspace\\swift-main-windows-toolchain\\swift\\test\\Inputs\\clang-importer-sdk/frameworks' -I 'T:\x86_64-unknown-linux-android28\LLVM\include' -isysroot 'C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift\\test/Inputs/clang-importer-sdk' -std=c++14 -Wno-padded -Wno-c11-extensions -D_LIBCPP_CSTDLIB -IT:/x86_64-unknown-linux-android28/Runtime/./lib/swift 'T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h' -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17
# .---command stderr------------
# | T:\x86_64-unknown-linux-android28\Runtime\test-android-x86_64\Interop\SwiftToCxx\class\Output\nested-classes-in-cxx.swift.tmp/classes.h:29:10: fatal error: 'cstdint' file not found
# |    29 | #include <cstdint>
# |       |          ^~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

Good to see you're still running the compiler validation tests for armv7 though, as that was broken on the community Android CI for a year or so before we finally shut it down, and I think you're the first to run the tests for Android i686. 😃

The test suite is too clunky and toolchain requirements are too diverse. Also, we cannot specify the build-OS in the REQUIRES/UNSUPPORTED/etc. clauses of individual tests (and it would add another layer of mess to the test suite if we did that).

Understood, we can chip those lit fixes in over time.

Right now, I'm interested in fixing the compiler validation suite for Android when running on linux, which may cause regressions on your Windows host running the Android tests. Thanks for linking that Windows CI so I can check that: 😺 is there someone at TBC in charge of those Android tests who I can discuss such failures with?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there someone at TBC in charge of those Android tests who I can discuss such failures with?

I am in another busy project this summer. For the moment I guess @compnerd might be able to help you here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He seems super busy too though. :| My concern is that when I start fixing the Android tests on linux, some may then break on Windows. I can then check that in the toolchain CI you linked above and try to fix them, but may not be able to, as I don't use Windows myself. But I suppose if you don't have anybody in charge of these Android tests run on Windows, most of my changes will fix tests on Windows too, so let's just see how it goes...

# Use standard header/framework search paths.
'-F %%clang-importer-sdk-path/frameworks '
'-I %%clang-include-dir %%cxx-stdlib-include '
Expand Down
4 changes: 2 additions & 2 deletions test/refactoring/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
config.substitutions.append((r'%refactor-check-compiles', f'{config.python} {config.refactor_check_compiles} -swift-refactor {config.swift_refactor} -swift-frontend {config.swift_frontend} -temp-dir %t {config.resource_dir_opt}'))
config.substitutions.append((r'%refactor', f'{config.swift_refactor} {config.resource_dir_opt}'))
config.substitutions.append((r'%refactor-check-compiles', f'{config.python} {config.refactor_check_compiles} -swift-refactor {config.swift_refactor} -swift-frontend {config.swift_frontend} -temp-dir %t {config.resource_dir_opt} -target {config.variant_triple}'))
config.substitutions.append((r'%refactor', f'{config.swift_refactor} {config.resource_dir_opt} -target {config.variant_triple}'))
75 changes: 60 additions & 15 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,24 @@ function Write-PList {
-OutFile $Path
}

function Load-LitTestOverrides($Filename) {
function Select-LitTestOverrides($Prefix) {
$MatchingLines = Get-Content $Filename | Select-String -Pattern "`^${Prefix}.*$"
return $MatchingLines | ForEach-Object { ($_ -replace $Prefix,"").Trim() }
}

$TestsToXFail = Select-LitTestOverrides "xfail"
Write-Host "TestsToXFail=$TestsToXFail"
if ($TestsToXFail -and $TestsToXFail.Length -ne 0) {
$env:LIT_XFAIL = $TestsToXFail -join ";"
}
$TestsToSkip = Select-LitTestOverrides "skip"
Write-Host "TestsToSkip=$TestsToSkip"
if ($TestsToSkip -and $TestsToSkip.Length -gt 0) {
$env:LIT_FILTER_OUT = "($($TestsToSkip -join '|'))"
}
}

function Build-Compilers() {
[CmdletBinding(PositionalBinding = $false)]
param
Expand Down Expand Up @@ -1676,19 +1694,8 @@ function Build-Compilers() {
if ($TestLLDB) {
$Targets += @("check-lldb")

function Select-LitTestOverrides {
param([string] $TestStatus)

$MatchingLines=(Get-Content $PSScriptRoot/windows-llvm-lit-test-overrides.txt | Select-String -Pattern "`^${TestStatus}.*$")
$TestNames=$MatchingLines | ForEach-Object { ($_ -replace $TestStatus,"").Trim() }
return $TestNames
}

# Override some test results with llvm-lit.
$TestsToXFail=Select-LitTestOverrides "xfail"
$TestsToSkip=Select-LitTestOverrides "skip"
$env:LIT_XFAIL=$TestsToXFail -join ";"
$env:LIT_FILTER_OUT="($($TestsToSkip -join '|'))"
# Override test filter for known issues in downstream LLDB
Load-LitTestOverrides $PSScriptRoot/windows-llvm-lit-test-overrides.txt

# Transitive dependency of _lldb.pyd
$RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
Expand Down Expand Up @@ -2138,8 +2145,6 @@ function Build-Runtime([Platform]$Platform, $Arch) {
$PlatformDefines += @{
LLVM_ENABLE_LIBCXX = "YES";
SWIFT_USE_LINKER = "lld";
SWIFT_INCLUDE_TESTS = "NO";
SWIFT_INCLUDE_TEST_BINARIES = "NO";
# Clang[<18] doesn't provide the _Builtin_float module.
SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT = "YES";
}
Expand Down Expand Up @@ -2183,6 +2188,40 @@ function Build-Runtime([Platform]$Platform, $Arch) {
}
}

function Test-Runtime([Platform]$Platform, $Arch) {
if ($IsCrossCompiling) {
throw "Swift runtime tests are not supported when cross-compiling"
}
if (-not (Test-Path (Get-TargetProjectBinaryCache $Arch Runtime))) {
throw "Swift runtime tests are supposed to reconfigure the existing build"
}
$CompilersBinaryCache = Get-HostProjectBinaryCache Compilers
if (-not (Test-Path "$CompilersBinaryCache\bin\FileCheck.exe")) {
# These will exist if we test any of llvm/clang/lldb/lld/swift as well
throw "LIT test utilities not found in $CompilersBinaryCache\bin"
}

Invoke-IsolatingEnvVars {
# Filter known issues when testing on Windows
Load-LitTestOverrides $PSScriptRoot/windows-swift-android-lit-test-overrides.txt
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path};$UnixToolsBinDir"
Build-CMakeProject `
-Src $SourceCache\swift `
-Bin (Get-TargetProjectBinaryCache $Arch Runtime) `
-Arch $Arch `
-Platform $Platform `
-UseBuiltCompilers C,CXX,Swift `
-BuildTargets check-swift-validation-only_non_executable `
-Defines @{
SWIFT_INCLUDE_TESTS = "YES";
SWIFT_INCLUDE_TEST_BINARIES = "YES";
SWIFT_BUILD_TEST_SUPPORT_MODULES = "YES";
SWIFT_NATIVE_LLVM_TOOLS_PATH = Join-Path -Path $CompilersBinaryCache -ChildPath "bin";
LLVM_LIT_ARGS = "-vv";
}
}
}

function Build-ExperimentalRuntime {
[CmdletBinding(PositionalBinding = $false)]
param
Expand Down Expand Up @@ -3322,6 +3361,12 @@ if (-not $IsCrossCompiling) {
if ($Test -contains "swiftpm") { Test-PackageManager $HostArch }
if ($Test -contains "swift-format") { Test-Format }
if ($Test -contains "sourcekit-lsp") { Test-SourceKitLSP }

if ($Test -contains "swift") {
foreach ($Arch in $AndroidSDKArchs) {
Test-Runtime Android $Arch
}
}
}

# Custom exception printing for more detailed exception information
Expand Down
Loading