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

Update SourceKitten, SwiftyTextTable and support swift test #555

Merged
merged 14 commits into from
Mar 30, 2016

Conversation

norio-nomura
Copy link
Collaborator

@norio-nomura
Copy link
Collaborator Author

On jpsim/SourceKitten#176, I wrote changelog entry in Breaking.
How should I write changelog entry on this?

@norio-nomura
Copy link
Collaborator Author

Now, this depends on jpsim/SourceKitten#178. After that will be merged to master and tagged next SourceKitten, this PR will be modified to referencing them in submodule, Cartfile and Package.swift.

@norio-nomura
Copy link
Collaborator Author

jpsim/SourceKitten#178 contains supporting swift test. So I tested adapting SwiftLint to swift test on this PR, but it seems we need updating https://github.com/scottrhoyt/SwiftyTextTable to adapting swift test before that.
I'd write another PR for adapting SwiftLint to swift test.

@scottrhoyt
Copy link
Contributor

@norio-nomura @jpsim updated SwiftyTextTable with JP's PR. Cut a new release 0.3.0. There is a small breaking change in 0.3.0, but if you apply this patch after updating, you'll be good to go:

diff --git a/Source/swiftlint/Commands/RulesCommand.swift b/Source/swiftlint/Commands/RulesCommand.swift
index 4286221..da1489c 100644
--- a/Source/swiftlint/Commands/RulesCommand.swift
+++ b/Source/swiftlint/Commands/RulesCommand.swift
@@ -90,12 +90,13 @@ extension TextTable {
                 }
                 return nil
             }()
-            addRow(ruleID,
+            addRow([
+                ruleID,
                 (rule is OptInRule) ? "yes" : "no",
                 (rule is CorrectableRule) ? "yes" : "no",
                 configuredRule != nil ? "yes" : "no",
                 (configuredRule ?? rule).configurationDescription
-            )
+            ])
         }
     }
 }

patch.diff.zip

@norio-nomura norio-nomura force-pushed the nn-use-xcode-select-p-dlsym branch from e69d79f to 67bb05f Compare March 19, 2016 00:54
@norio-nomura
Copy link
Collaborator Author

@scottrhoyt @jpsim Thanks!
Now, this PR contains supporting swift test.
But on local testing, swift compiler crashes randomly and not yet success swift test.

@norio-nomura norio-nomura changed the title [WIP] Use xcode-select -p (dlsym() approach) [WIP] Update SourceKitten, SwiftyTextTable and support swift test Mar 19, 2016
@norio-nomura norio-nomura force-pushed the nn-use-xcode-select-p-dlsym branch from 67bb05f to 55fce2c Compare March 19, 2016 01:05
@norio-nomura
Copy link
Collaborator Author

SPM test failed on https://travis-ci.org/realm/SwiftLint/jobs/117049352#L762

/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a.xctoolchain/usr/bin/swift test
:0: error: unable to build node: '<Package.test>' (node is produced by multiple commands; e.g., '<swiftlint.exe>' and '%,������test>m/SwiftL��R����R��p��R����R����R�����R��')

On local machine:

% swift test
<unknown>:0: error: unable to build node: '<Package.test>' (node is produced by multiple commands; e.g., '<swiftlint.exe>' and '')
error: exit(1): swift-build-tool -f /Users/norio/Documents/workspace/github/SwiftLint/.build/debug.yaml test

😞

@norio-nomura
Copy link
Collaborator Author

@norio-nomura
Copy link
Collaborator Author

At last, swift build --configuration release has succeeded by swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a. Previous snapshots crashed on swift build --configuration release.

The durations of linting Carthage-0.15.2,
swift-2.1.1 (Xcode 7.2.1):

/usr/local/bin/swiftlint lint --config ~/.swiftlint-test.yml  14.36s user 0.85s system 79% cpu 19.045 total

swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a:

../SwiftLint/.build/release/swiftlint lint --config ~/.swiftlint-test.yml  11.59s user 0.90s system 78% cpu 15.941 total


* Failed to launch swiftlint when Xcode.app was placed at non standard path.
[Norio Nomura](https://github.com/norio-nomura)
[#593](https://github.com/realm/SwiftLint/issues/593)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Entries in Enhancements and Bug Fixes are essentially same. Would it be a single entry?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's fine to keep them separate.

@norio-nomura
Copy link
Collaborator Author

I disabled make spm_test on Travis-CI because I think that the failing is caused by swift-test's bug. https://bugs.swift.org/browse/SR-989

@norio-nomura norio-nomura changed the title [WIP] Update SourceKitten, SwiftyTextTable and support swift test Update SourceKitten, SwiftyTextTable and support swift test Mar 25, 2016
@jpsim
Copy link
Collaborator

jpsim commented Mar 25, 2016

This is fine. 👍

@jpsim jpsim merged commit 3f350ec into master Mar 30, 2016
@jpsim jpsim deleted the nn-use-xcode-select-p-dlsym branch March 30, 2016 00:49
@norio-nomura
Copy link
Collaborator Author

Thanks for merging! 🙏

@mxcl
Copy link

mxcl commented Mar 31, 2016

I have confirmed that swiftlang/swift-package-manager#224 seems to fix this, however you must couple it with the recently completed: swiftlang/swift-package-manager#230 in order to build Swift 2 projects against the latest swift-build

@jpsim
Copy link
Collaborator

jpsim commented Mar 31, 2016

Thanks for the update @mxcl!

@norio-nomura
Copy link
Collaborator Author

@mxcl Hi, I built swiftpm(e702428) and tested as following:

$ export SWIFT_EXEC=/Library/Developer/Toolchains/swift-2.2.1-SNAPSHOT-2016-03-28-a.xctoolchain/usr/bin/swiftc
$ cd ~/github/SwiftLint
$ ~/github/Apple/swiftpm/.build/debug/swift-build
Compiling Swift Module 'Result' (2 sources)
Compiling Swift Module 'SWXMLHash' (2 sources)
Compiling Swift Module 'Yaml' (6 sources)
Compiling Swift Module 'SwiftyTextTable' (1 sources)

<SNIP>

Compiling Swift Module 'swiftlint' (8 sources)
Linking .build/debug/swiftlint
~/github/Apple/swiftpm/.build/debug/swift-build  68.84s user 11.04s system 203% cpu 39.286 total
$  ~/github/Apple/swiftpm/.build/debug/swift-test
Compiling Swift Module 'SwiftyTextTableTestSuite' (1 sources)
Compiling Swift Module 'SwiftLintFrameworkTestSuite' (16 sources)
Compiling Swift Module 'SourceKittenFrameworkTestSuite' (12 sources)
Linking .build/debug/SwiftyTextTable.xctest/Contents/MacOS/SwiftyTextTable
Linking .build/debug/SourceKitten.xctest/Contents/MacOS/SourceKitten
Linking .build/debug/SwiftLint.xctest/Contents/MacOS/SwiftLint
Test Suite 'All tests' started at 2016-04-04 23:51:01.625
Test Suite 'SourceKitten.xctest' started at 2016-04-04 23:51:01.626
Test Suite 'ClangTranslationUnitTests' started at 2016-04-04 23:51:01.626
Test Case '-[SourceKittenFrameworkTestSuite.ClangTranslationUnitTests testBasicObjectiveCDocs]' started.
Test Case '-[SourceKittenFrameworkTestSuite.ClangTranslationUnitTests testBasicObjectiveCDocs]' passed (0.972 seconds).
Test Case '-[SourceKittenFrameworkTestSuite.ClangTranslationUnitTests testParsesObjectiveCHeaderFilesAndXcodebuildArguments]' started.
Test Case '-[SourceKittenFrameworkTestSuite.ClangTranslationUnitTests testParsesObjectiveCHeaderFilesAndXcodebuildArguments]' passed (0.000 seconds).
Test Case '-[SourceKittenFrameworkTestSuite.ClangTranslationUnitTests testRealmObjectiveCDocs]' started.

<SNIP>

Test Case '-[SourceKittenFrameworkTestSuite.SwiftDocsTests testSubscript]' failed (0.017 seconds).
Test Suite 'SwiftDocsTests' failed at 2016-04-04 23:52:02.019.
     Executed 3 tests, with 2 failures (0 unexpected) in 0.112 (0.112) seconds
Test Suite 'SyntaxTests' started at 2016-04-04 23:52:02.019
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testGenerateSameSyntaxMapFileAndContents]' started.
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testGenerateSameSyntaxMapFileAndContents]' passed (0.017 seconds).
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testPrintEmptySyntax]' started.
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testPrintEmptySyntax]' passed (0.001 seconds).
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testSubscript]' started.
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testSubscript]' passed (0.001 seconds).
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testSyntaxMapPrintValidJSON]' started.
Test Case '-[SourceKittenFrameworkTestSuite.SyntaxTests testSyntaxMapPrintValidJSON]' passed (0.001 seconds).
Test Suite 'SyntaxTests' passed at 2016-04-04 23:52:02.039.
     Executed 4 tests, with 0 failures (0 unexpected) in 0.019 (0.019) seconds
Test Suite 'SourceKitten.xctest' failed at 2016-04-04 23:52:02.039.
     Executed 40 tests, with 7 failures (0 unexpected) in 60.409 (60.413) seconds
Test Suite 'All tests' failed at 2016-04-04 23:52:02.039.
     Executed 40 tests, with 7 failures (0 unexpected) in 60.409 (60.414) seconds

The build passes. But swift-test runs SourceKittenFrameworkTestSuite only that is one of dependencies of SwiftLint. I tried specifying SwiftLintFrameworkTestSuite module and could not run that as:

$ ~/github/Apple/swiftpm/.build/debug/swift-test SwiftLintFrameworkTestSuite
Test Suite 'Selected tests' started at 2016-04-04 23:55:38.145
Test Suite 'Selected tests' passed at 2016-04-04 23:55:38.145.
     Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds

Is this known issue?

@mxcl
Copy link

mxcl commented Apr 4, 2016

@norio-nomura thanks, will fix.

@norio-nomura
Copy link
Collaborator Author

@mxcl Thanks! I filed https://bugs.swift.org/browse/SR-1159

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