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

Test errors in Tests+Privacy.swift when running tests on the command line. #2

Closed
GeekAndDad opened this issue Sep 22, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@GeekAndDad
Copy link
Contributor

GeekAndDad commented Sep 22, 2021

Below is the sample build log and sequence of commands I did on the command line where I see the errors.

The log below is for the build is being done using the fixes in #3 so as to test Xcode 12.5.1 (Swift 5.4.2).

Doing this build in Xcode 12.5.1 by opening the package folder and then running tests works without test failures.

Likewise on main pre-PR-merged-branch, these tests succeed in Xcode 13.0 but fail on the command line.

Logging % sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Logging % swift --version
swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: arm64-apple-macosx11.0

Logging % swift package clean 

Logging % swift test
[14/14] Build complete!
Test Suite 'All tests' started at 2021-09-22 15:58:43.731
Test Suite 'LoggingPackageTests.xctest' started at 2021-09-22 15:58:43.731
Test Suite 'FloatTests' started at 2021-09-22 15:58:43.731
Test Case '-[LoggingTests.FloatTests testFloats]' started.
Test Case '-[LoggingTests.FloatTests testFloats]' passed (0.002 seconds).
Test Suite 'FloatTests' passed at 2021-09-22 15:58:43.733.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.002 (0.002) seconds
Test Suite 'IntegerTests' started at 2021-09-22 15:58:43.733
Test Case '-[LoggingTests.IntegerTests testSigned]' started.
Test Case '-[LoggingTests.IntegerTests testSigned]' passed (0.000 seconds).
Test Case '-[LoggingTests.IntegerTests testUnsigned]' started.
Test Case '-[LoggingTests.IntegerTests testUnsigned]' passed (0.000 seconds).
Test Suite 'IntegerTests' passed at 2021-09-22 15:58:43.734.
	 Executed 2 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'PrivateTests' started at 2021-09-22 15:58:43.734
Test Case '-[LoggingTests.PrivateTests testPrivate]' started.
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:16: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("name") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:19: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("-3.141593") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:21: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("-3") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:23: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+-3.141593") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:25: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+-3") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:28: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("-3.141593") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:30: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("-3.141593") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:32: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("-3.1") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:34: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+-3.141593") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:36: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+-3.1") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:39: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("true") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:41: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("yes") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:43: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("true") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:46: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("mock") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:48: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("Mock") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:50: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("<NSObject: 0x13377fc60>") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:53: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("3") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:55: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("3") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:57: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+3") is not equal to ("<redacted>")
/Users/Shared/OpenSource/Logging/Tests/LoggingTests/Test+Private.swift:59: error: -[LoggingTests.PrivateTests testPrivate] : XCTAssertEqual failed: ("+3") is not equal to ("<redacted>")
Test Case '-[LoggingTests.PrivateTests testPrivate]' failed (0.239 seconds).
Test Suite 'PrivateTests' failed at 2021-09-22 15:58:43.972.
	 Executed 1 test, with 20 failures (0 unexpected) in 0.239 (0.239) seconds
Test Suite 'PublicTests' started at 2021-09-22 15:58:43.972
Test Case '-[LoggingTests.PublicTests testPublic]' started.
Test Case '-[LoggingTests.PublicTests testPublic]' passed (0.000 seconds).
Test Suite 'PublicTests' passed at 2021-09-22 15:58:43.972.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'LoggingPackageTests.xctest' failed at 2021-09-22 15:58:43.973.
	 Executed 5 tests, with 20 failures (0 unexpected) in 0.241 (0.241) seconds
Test Suite 'All tests' failed at 2021-09-22 15:58:43.973.
	 Executed 5 tests, with 20 failures (0 unexpected) in 0.241 (0.242) seconds
@GeekAndDad GeekAndDad added the bug Something isn't working label Sep 22, 2021
@GeekAndDad GeekAndDad changed the title Test errors under Xcode 5.5 final (Xcode 13.0 release) Test errors in Tests+Privacy.swift when running tests on the command line. Sep 22, 2021
@shaps80
Copy link
Owner

shaps80 commented Sep 24, 2021

Ah ok, this is not a bug. In Xcode I've setup tests to run in Release mode since that's the only time privacy is applied.

You can do this from the command line as well, but I'm guessing you didn't?

@shaps80 shaps80 closed this as completed Sep 24, 2021
@shaps80
Copy link
Owner

shaps80 commented Sep 24, 2021

@GeekAndDadDad – btw I came across an old post on your blog and left a comment (the SwiftUI previews one). Feel free to ignore but in case its helpful 👍

@GeekAndDad
Copy link
Contributor Author

Ah, I didn't see the .swiftpm (hidden folder) with the xcscheme inside that does this (nice that this works!).
Too bad that isn't paid attention to from the command line by default.

GeekAndDad added a commit to GeekAndDadLLC/Logging that referenced this issue Sep 29, 2021
Alternate method of fixing this issue which allows tests to run in both Release or Debug configurations via a new DEBUG build only configuration variable in LogPrivacy which may be set in tests.
shaps80 added a commit that referenced this issue Sep 29, 2021
fix #2 via a property settable in tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants