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

[SR-12008] SwiftPM: On Linux, enable-test-discovery stumbles over deprecated tests #4628

Open
weissi opened this issue Jan 10, 2020 · 5 comments

Comments

@weissi
Copy link
Member

weissi commented Jan 10, 2020

Previous ID SR-12008
Radar rdar://problem/58475855
Original Reporter @weissi
Type Bug
Status In Progress
Resolution
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Bug, Linux
Assignee 3a4oT (JIRA)
Priority Medium

md5: fc60a1ed0f31111134228b7e176436d5

Issue Description:

It's very important to also test deprecated functionality which on Darwin is easily possible by deprecating the test method. When manually generating LinuxMain and friends, this is also possible via a small hack.

Repro:

git clone https://github.com/apple/swift-nio
cd swift-nio
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" swift:5.1.3 swift test -Xswiftc -warnings-as-errors --enable-test-discovery

Expected:

Runs the tests just fine like on Darwin or without enable-test-discovery

Actual:

many errors.

/Users/johannes/devel/swift-nio/.build/x86_64-unknown-linux/debug/testlist.derived/NIOConcurrencyHelpersTests.swift:6:24: error: 'testAddSub()' is deprecated: deprecated because it tests deprecated functionality
        ("testAddSub", testAddSub),
                       ^
/Users/johannes/devel/swift-nio/.build/x86_64-unknown-linux/debug/testlist.derived/NIOConcurrencyHelpersTests.swift:8:35: error: 'testAllOperationsBool()' is deprecated: deprecated because it tests deprecated functionality
        ("testAllOperationsBool", testAllOperationsBool),
                                  ^
@weissi
Copy link
Member Author

weissi commented Jan 10, 2020

@swift-ci create

@weissi
Copy link
Member Author

weissi commented Jan 10, 2020

CC @aciidb0mb3r, can we adapt the generation so that it allows deprecated tests? They're really important.

@ankitspd
Copy link
Member

I guess the hack used by NIO is our best option unless @briancroom has better ideas.

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2020

Comment by Petro Rovenskyy (JIRA)

@aciidb0mb3r, Based on PR feedback there was a suggestion to focus on compiler feature that allows disabling warning in sections of the code. My understanding it's something similar to what we have for Objective-C preprocessor)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// actual code causing the deprecated warning
#pragma clang diagnostic pop

Is this assumption correct? Unfortunately, I do not have experience with the development of swiftc, and it would be awesome if you can clarify some possible action here.

  • Should I file a JIRA enhancement request or there is existing one we can link?
  • Is it possible to get some "pointers" in what direction to move and where to start with implementing such a feature? (Feel's bad by asking it since I totally understand that it would take someone's time which can be spent on something more important)

In case such a feature will be implemented where the changes should go, to swiftPM's generated code (as was proposed on a first PR revision) or leave this option to the end-users(disable warnings in consumers code)?

Thanks in advance! cc @weissi

@ankitspd
Copy link
Member

ankitspd commented Feb 5, 2020

> Should I file a JIRA enhancement request or there is existing one we can link?

You can try doing a quick search on JIRA and file a new one if you can't find something.

> Is it possible to get some "pointers" in what direction to move and where to start with implementing such a feature?

I think this would first require going through the swift-evolution process in order to figure out what the right feature looks like. You can find out about the evolution process here: https://github.com/apple/swift-evolution

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants