Skip to content
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

[lldb] Propagate SDKROOT env var in Shell tests on Windows #9416

Conversation

weliveindetail
Copy link
Member

The manual lookup in lldb/source/Host/windows/HostInfoWindowsSwift.cpp must be successful so that SwiftASTContext::CreateInstance() doesn't fail with: Cannot create Swift scratch context (couldn't load the Swift stdlib)

@weliveindetail
Copy link
Member Author

Tests that are expected to pass with this change:

lldb-shell :: SwiftREPL/Basic.test
lldb-shell :: SwiftREPL/Class.test
lldb-shell :: SwiftREPL/ComputedProperties.test
lldb-shell :: SwiftREPL/Deadlock.test
lldb-shell :: SwiftREPL/DiagnosticOptions.test
lldb-shell :: SwiftREPL/Dict.test
lldb-shell :: SwiftREPL/ErrorReturn.test
lldb-shell :: SwiftREPL/ExclusivityREPL.test
lldb-shell :: SwiftREPL/GenericTypealias.test
lldb-shell :: SwiftREPL/Generics.test
lldb-shell :: SwiftREPL/ImportError.test
lldb-shell :: SwiftREPL/MetatypeRepl.test
lldb-shell :: SwiftREPL/Optional.test
lldb-shell :: SwiftREPL/PropertyWrapperTopLevel.test
lldb-shell :: SwiftREPL/RecursiveClass.test
lldb-shell :: SwiftREPL/Redefinition.test
lldb-shell :: SwiftREPL/RedirectInput.test
lldb-shell :: SwiftREPL/RedirectInputNoSuchFile.test
lldb-shell :: SwiftREPL/SimpleExpressions.test
lldb-shell :: SwiftREPL/Struct.test
lldb-shell :: SwiftREPL/Subclassing.test
lldb-shell :: SwiftREPL/SwiftTypeLookup.test
lldb-shell :: SwiftREPL/SyntaxError.test
lldb-shell :: SwiftREPL/UninitVariables.test
lldb-shell :: SwiftREPL/ZeroSizeStruct.test
lldb-shell :: SwiftREPL/enum-singlecase.test
lldb-shell :: SwiftREPL/one-char-string.test

@weliveindetail weliveindetail marked this pull request as ready for review October 14, 2024 13:59
@weliveindetail
Copy link
Member Author

We now dump the value of SDKROOT like macOS and warn if it is not found in the system environment.

@weliveindetail
Copy link
Member Author

Thanks for reviewing @hyp, I think this is ready t land.

@hyp
Copy link

hyp commented Oct 16, 2024

Looks good!

@hyp
Copy link

hyp commented Oct 16, 2024

@swift-ci please test

@weliveindetail
Copy link
Member Author

weliveindetail commented Oct 16, 2024

macOS is looking good so far 👍

The Linux build failed with the following error. It looks like the llvm-project version that we checked out isn't matching:

/home/build-user/swift/include/swift/Basic/StableHasher.h:136:29: error: no member named 'endianness' in namespace 'llvm::support'; did you mean 'llvm::endianness'?
    constexpr auto endian = llvm::support::endianness::little;
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
                            llvm::endianness
/home/build-user/llvm-project/llvm/include/llvm/ADT/bit.h:70:12: note: 'llvm::endianness' declared here
enum class endianness {
           ^

macOS fails with the same error. This is a LLVM version mismatch:

/Users/ec2-user/jenkins/workspace/apple-llvm-project-pr-macos/branch-next/swift/include/swift/Basic/StableHasher.h:149:29: error: no member named 'endianness' in namespace 'llvm::support'; did you mean 'llvm::endianness'?
    constexpr auto endian = llvm::support::endianness::little;
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
                            llvm::endianness

The Windows build failed with the following error. This seems unrelated to the actual change as well, since it happens when building T:/0 which doesn't even run llvm-lit:

[22/24][ 91%][6.832s] Building CXX object tools\clang\utils\TableGen\CMakeFiles\clang-tblgen.dir\ClangAttrEmitter.cpp.obj
[23/24][ 95%][7.812s] Building CXX object tools\clang\utils\TableGen\CMakeFiles\clang-tblgen.dir\RISCVVEmitter.cpp.obj
[24/24][100%][8.126s] Linking CXX executable bin\clang-tblgen.exe
ninja: error: unknown target 'clang-pseudo-gen'
Error: Error: cmake.exe exited with code 1.

@bnbarham
Copy link

The Linux build failed with the following error. It looks like the llvm-project version that we checked out isn't matching:

See swiftlang/swift#77070 (comment)

We need the manual lookup in lldb/source/Host/windows/HostInfoWindowsSwift.cpp to succeed.
Otherwise SwiftASTContext::CreateInstance() fails with: Cannot create Swift scratch context (couldn't load the Swift stdlib)
@weliveindetail weliveindetail force-pushed the lldb-test-shell-win-propagate-sdkroot branch from e8d8b4b to 1dcabd2 Compare October 21, 2024 09:29
@weliveindetail weliveindetail changed the base branch from next to stable/20240723 October 21, 2024 09:30
@weliveindetail
Copy link
Member Author

To all the new reviewers: sorry for the noise, I had to update the base branch to fix pre-merge checks

@hjyamauchi
Copy link

@swift-ci please test

@weliveindetail
Copy link
Member Author

Windows platform failed due to unrelated Swift constraints-solver tests:

FAIL: Swift(windows-x86_64) :: Constraints/common_type.swift (1113 of 11233)
******************** TEST 'Swift(windows-x86_64) :: Constraints/common_type.swift' FAILED ********************
Exit Code: 3221225477

Command Output (stdout):
--
# RUN: at line 1
't:\\5\\bin\\swift-frontend.exe' -target x86_64-unknown-windows-msvc  -module-cache-path T:\5\swift-test-results\x86_64-unknown-windows-msvc\clang-module-cache -vfsoverlay T:/5/tools/swift\stdlib\windows-vfs-overlay.yaml -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules -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 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -typo-correction-limit 10  -typecheck -verify -disable-objc-attr-requires-foundation-module C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\test\Constraints\common_type.swift -debug-constraints 2>T:\5\tools\swift\test-windows-x86_64\Constraints\Output\common_type.swift.tmp.err
# executed command: 't:\\5\\bin\\swift-frontend.exe' -target x86_64-unknown-windows-msvc -module-cache-path 'T:\5\swift-test-results\x86_64-unknown-windows-msvc\clang-module-cache' -vfsoverlay 'T:/5/tools/swift\stdlib\windows-vfs-overlay.yaml' -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules -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 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -typo-correction-limit 10 -typecheck -verify -disable-objc-attr-requires-foundation-module 'C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\test\Constraints\common_type.swift' -debug-constraints
# .---redirected output from 'T:\5\tools\swift\test-windows-x86_64\Constraints\Output\common_type.swift.tmp.err'
# | 
# | ---Constraint solving at [C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\test\Constraints\common_type.swift:5:34 - line:5:34]---
# | 
# | ---Initial constraints for the given expression---
# | (integer_literal_expr type="$T0" location=C:\\Users\\swift-ci\\jenkins\\workspace\\apple-llvm-project-pull-request-windows\\swift\\test\\Constraints\\common_type.swift:5:34 range=[C:\\Users\\swift-ci\\jenkins\\workspace\\apple-llvm-project-pull-request-windows\\swift\\test\\Constraints\\common_type.swift:5:34 - line:5:34] value="0" builtin_initializer="**NULL**" initializer="**NULL**")
# | 
# | Score: <default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>
# | Contextual Type: Int at IntegerLiteral@C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\test\Constraints\common_type.swift:5:34
# | Type Variables:
# |   $T0 [allows bindings to: noescape] [with possible bindings: (subtypes of) Int] @ locator@0x1b3e8118cb8 [IntegerLiteral@C:\Users\swift-ci\jenkins\workspace\apple-llvm-pr
# | ...
# `---data was truncated--------
# note: command had no output on stdout or stderr
# error: command failed with exit status: 0xc0000005

@hjyamauchi
Copy link

@swift-ci please test Windows Platform

@weliveindetail
Copy link
Member Author

4 failures in swift-foundation-tests. All unrelated. Not sure what was the 'unexpected' one, the log only reports details for 3 of them:

[535/536] Linking T:\x64\swift-foundation-tests\x86_64-unknown-windows-msvc\release\swift-foundationPackageTests.xctest
Build complete! (1341.90s)
Test Suite 'All tests'
...
Test Case 'TestJSONEncoder.test_SR17581_codingEmptyDictionaryWithNonstringKeyDoesRoundtrip' failed (0.001 seconds)
...
Test Case 'TestJSONEncoder.test_encodingDateCustom' failed (0.0 seconds)
...
Test Case 'TestJSONEncoder.test_encodingDateFormatted' failed (0.001 seconds)
...
Test Suite 'release.xctest' failed at 2024-10-25 20:49:52.215

	 Executed 1881 tests, with 63 tests skipped and 4 failures (1 unexpected) in 69.221 (69.221) seconds

Test Suite 'All tests' failed at 2024-10-25 20:49:52.216

	 Executed 1881 tests, with 63 tests skipped and 4 failures (1 unexpected) in 69.221 (69.221) seconds

Error: swift.exe exited with code 1.
Invocation:
  T:\Program Files\Swift\Toolchains\0.0.0+Asserts\usr\bin\swift.exe test --scratch-path T:\x64\foundation-tests --package-path C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift-corelibs-foundation -c release -Xbuild-tools-swiftc -IT:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift -Xbuild-tools-swiftc -LT:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows -Xcc -IT:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift -Xlinker -LT:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows -debug-info-format none

@hjyamauchi
Copy link

@swift-ci please test Windows Platform

@weliveindetail
Copy link
Member Author

This will be part of #9513

@weliveindetail weliveindetail deleted the lldb-test-shell-win-propagate-sdkroot branch November 5, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants