Skip to content

Fix async_extended_frame_info_watchos test #62949

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

Conversation

etcwilde
Copy link
Member

The optimizer got smarter and stopped emitting a stack frame for the empty someAsyncFunction, so the test started failing. Adding an opaque function call to the function body forces the function to get set up properly, so the test starts passing again.

Fixes rdar://97790231

The optimizer got smarter and stopped emitting a stack frame for the
empty `someAsyncFunction`, so the test started failing. Adding an opaque
function call to the function body forces the function to get set up
properly, so the test starts passing again.

rdar97790231
@etcwilde etcwilde requested a review from meg-gupta January 10, 2023 19:48
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde etcwilde requested a review from DougGregor January 11, 2023 03:42
@etcwilde
Copy link
Member Author

We may want to fix the REQUIRES lines for this test. The compiler doesn't need to be running on watchOS, or on armv7k or arm64_32, it just needs the code-generator that supports them and the watchOS SDK. That should avoid this test failing in the future.

To help this test run in production environments, I've reduced the
requirements of the test. It used to require that the compiler was
running on an armv7k or arm64_32 watchOS device, which I don't think is
a test configuration that gets hit all that often.

The new requirements are that you're on watchOS or the simulator, and
can produce arm64_32 code. The test only verifies that the emitted asm
is valid, not that it runs, so we don't need to be running on the
specific hardware. Additionally, the test only checks the output of
arm64_32, not of armvk7, so we only require the 64-bit arm backend.

It would be better if we could check for available SDKs though. The test
only requires an SDK, it doesn't need to be run on the simulator or the
watch.
Adding test to verify correct behavior from swift when targeting arm64
macOS. We caught the fact that the optimizer got smarter on arm64 in the
watchOS test, which doesn't seem to get run in PR testing. The updated
test catches it now.
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde
Copy link
Member Author

Linux failure:

FAIL: Swift(linux-x86_64) :: Concurrency/Runtime/async_taskgroup_throw_rethrow.swift (553 of 15990)
******************** TEST 'Swift(linux-x86_64) :: Concurrency/Runtime/async_taskgroup_throw_rethrow.swift' FAILED ********************
Script:
--
: 'RUN: at line 1';   rm -rf "/home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp" && mkdir -p "/home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp" && /home/build-user/build/buildbot_linux/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu -toolchain-stdlib-rpath  -module-cache-path /home/build-user/build/buildbot_linux/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache -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 9999, iOS 9999, watchOS 9999, tvOS 9999' -O -module-cache-path /home/build-user/build/buildbot_linux/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache /home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift  -Xfrontend -disable-availability-checking -parse-as-library -o /home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp/a.out -module-name main  && echo /home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp/a.out && /usr/bin/env LD_LIBRARY_PATH='/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux'  /home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp/a.out | /usr/bin/python3.8 /home/build-user/swift/utils/PathSanitizingFileCheck --allow-unused-prefixes --sanitize BUILD_DIR=/home/build-user/build/buildbot_linux/swift-linux-x86_64 --sanitize SOURCE_DIR=/home/build-user/swift --use-filecheck /home/build-user/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck  /home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift --dump-input=always
--
Exit Code: 1

Command Output (stdout):
--
/home/build-user/build/buildbot_linux/swift-linux-x86_64/test-linux-x86_64/Concurrency/Runtime/Output/async_taskgroup_throw_rethrow.swift.tmp/a.out

--
Command Output (stderr):
--
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:75:29: warning: result of call to 'echo' is unused
      group.addTask { await echo(1) }
                            ^   ~~~
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:94:15: warning: result of call to 'echo' is unused
        await echo(1)
              ^   ~~~
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:129:15: warning: result of call to 'echo' is unused
        await echo(1)
              ^   ~~~
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:127:15: warning: result of call to 'withThrowingDiscardingTaskGroup(returning:body:)' is unused
    try await withThrowingDiscardingTaskGroup(returning: Int.self) { group in
              ^                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:156:15: warning: result of call to 'withThrowingDiscardingTaskGroup(returning:body:)' is unused
    try await withThrowingDiscardingTaskGroup(returning: Int.self) { group in
              ^                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift:84:12: error: CHECK: expected string not found in input
 // CHECK: rethrown: Boom(
           ^
<stdin>:8:52: note: scanning from here
==== test_discardingTaskGroup_automaticallyRethrows() ------
                                                   ^
<stdin>:9:19: note: possible intended match here
Expected error to be thrown, but got: 13
                  ^

Input file: <stdin>
Check file: /home/build-user/swift/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ==== test_taskGroup_throws_rethrows() ------ 
            2: next: 1 
            3: next: 2 
            4: error caught and rethrown in group: Boom(id: "main/async_taskgroup_throw_rethrow.swift:31") 
            5: rethrown: Boom(id: "main/async_taskgroup_throw_rethrow.swift:31") 
            6: ==== test_taskGroup_noThrow_ifNotAwaitedThrowingTask() ------ 
            7: Expected no error to be thrown, got: 1 
            8: ==== test_discardingTaskGroup_automaticallyRethrows() ------ 
check:84'0                                                        X~~~~~~~~~ error: no match found
            9: Expected error to be thrown, but got: 13 
check:84'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:84'1                       ?                       possible intended match
           10: ==== test_discardingTaskGroup_automaticallyRethrowsOnlyFirst() ------ 
check:84'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: Throwing: Boom(id: "first, isCancelled:false") 
           12: Awoken, throwing: CancellationError() 
           13: rethrown: Boom(id: "first, isCancelled:false") 
           14: ==== test_discardingTaskGroup_automaticallyRethrows_first_withThrowingBodyFirst() ------ 
           15: Throwing: Boom(id: "body, first, isCancelled:false") 
           16: Throwing: Boom(id: "task, second, isCancelled:true") 
           17: rethrown: Boom(id: "body, first, isCancelled:false") 
           18: ==== test_discardingTaskGroup_automaticallyRethrows_first_withThrowingBodySecond() ------ 
           19: Throwing: Boom(id: "task, first, isCancelled:false") 
           20: Throwing: Boom(id: "body, second, isCancelled:true") 
           21: rethrown: Boom(id: "body, second, isCancelled:true") 
>>>>>>

--

This change doesn't affect Linux, or this test, so this looks unrelated.

@etcwilde
Copy link
Member Author

Verified from logs;

watchOS simulator testing is now running and passing swift_async_extended_frame_info_watchos, and macOS testing is running and passing the updated swift_async_extended_frame_info test.

PASS: Swift(macosx-x86_64) :: IRGen/swift_async_extended_frame_info.swift (2766 of 15791)
PASS: Swift(watchsimulator-x86_64) :: IRGen/swift_async_extended_frame_info_watchos.swift (2930 of 15791)

@etcwilde
Copy link
Member Author

@swift-ci please test Linux

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks!

@etcwilde etcwilde merged commit c3fd8a3 into swiftlang:main Jan 13, 2023
@etcwilde etcwilde deleted the ewilde/fix-async_extended_stack_frame_info_watchos_test branch January 13, 2023 17:04
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.

2 participants