From d569016fca7b6f2d509e12533a3e6429aab402de Mon Sep 17 00:00:00 2001 From: Aliaksandr Bialiauski Date: Mon, 31 May 2021 13:09:14 +0300 Subject: [PATCH 1/2] Upgrade SPM version to 5.4 for Linux builds Fixes #539. SPM 5.4 has automatic test discovery support, so that we can remove manually generated files for running Linux tests. --- .circleci/config.yml | 2 +- Tests/LinuxMain.swift | 8 - .../XCTestManifests.swift | 241 ------------------ 3 files changed, 1 insertion(+), 250 deletions(-) delete mode 100644 Tests/LinuxMain.swift delete mode 100644 Tests/MapboxDirectionsTests/XCTestManifests.swift diff --git a/.circleci/config.yml b/.circleci/config.yml index b3d554dc5..a99429bc5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ commands: jobs: spm-linux-job: docker: - - image: swift:5.3 + - image: swift:5.4 steps: - checkout # Limiting number of parallel jobs to avoid build crash bug. diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift deleted file mode 100644 index fc1094527..000000000 --- a/Tests/LinuxMain.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -import MapboxDirectionsTests - -var tests = [XCTestCaseEntry]() -tests += MapboxDirectionsTests.__allTests() - -XCTMain(tests) diff --git a/Tests/MapboxDirectionsTests/XCTestManifests.swift b/Tests/MapboxDirectionsTests/XCTestManifests.swift deleted file mode 100644 index 2cdfdf6a2..000000000 --- a/Tests/MapboxDirectionsTests/XCTestManifests.swift +++ /dev/null @@ -1,241 +0,0 @@ -#if !canImport(ObjectiveC) -import XCTest - -extension CredentialsTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__CredentialsTests = [ - ("testCredentialsCreation", testCredentialsCreation), - ] -} - -extension DirectionsCredentialsTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__DirectionsCredentialsTests = [ - ("testCustomConfiguration", testCustomConfiguration), - ("testDefaultConfiguration", testDefaultConfiguration), - ] -} - -extension DirectionsErrorTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__DirectionsErrorTests = [ - ("testEquality", testEquality), - ("testFailureReasons", testFailureReasons), - ("testRecoverySuggestions", testRecoverySuggestions), - ] -} - -extension GeoJSONTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__GeoJSONTests = [ - ("testInitialization", testInitialization), - ("testZeroLengthWorkaround", testZeroLengthWorkaround), - ] -} - -extension IntersectionTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__IntersectionTests = [ - ("testCoding", testCoding), - ] -} - -extension MatchOptionsTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__MatchOptionsTests = [ - ("testCoding", testCoding), - ("testRouteOptionsConvertedFromMatchOptions", testRouteOptionsConvertedFromMatchOptions), - ("testWaypointSerialization", testWaypointSerialization), - ] -} - -extension MatchTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__MatchTests = [ - ("testCoding", testCoding), - ] -} - -extension QuickLookTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__QuickLookTests = [ - ("testQuickLookURL", testQuickLookURL), - ] -} - -extension RoadTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RoadTests = [ - ("testDestinations", testDestinations), - ("testEmpty", testEmpty), - ("testExitCodes", testExitCodes), - ("testNamesCodes", testNamesCodes), - ("testRotaryNames", testRotaryNames), - ] -} - -extension RouteLegTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteLegTests = [ - ("testSegmentRanges", testSegmentRanges), - ] -} - -extension RouteOptionsTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteOptionsTests = [ - ("testApproachesURLQueryParams", testApproachesURLQueryParams), - ("testCoding", testCoding), - ("testDecimalPrecision", testDecimalPrecision), - ("testMissingApproaches", testMissingApproaches), - ("testResponseWithDestinationName", testResponseWithDestinationName), - ("testResponseWithManuallySetDestinationName", testResponseWithManuallySetDestinationName), - ("testResponseWithoutDestinationName", testResponseWithoutDestinationName), - ("testWaypointSerialization", testWaypointSerialization), - ] -} - -extension RouteRefreshTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteRefreshTests = [ - ("testDecoding", testDecoding), - ("testEncoding", testEncoding), - ] -} - -extension RouteResponseTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteResponseTests = [ - ("testRouteResponseEncodingAndDecoding", testRouteResponseEncodingAndDecoding), - ] -} - -extension RouteStepTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteStepTests = [ - ("testCoding", testCoding), - ("testDecoding", testDecoding), - ("testEncodingPronunciations", testEncodingPronunciations), - ("testIncidentsCoding", testIncidentsCoding), - ("testRouteStepTypicalTravelTime", testRouteStepTypicalTravelTime), - ] -} - -extension RouteTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RouteTests = [ - ("testCoding", testCoding), - ("testNullVoiceLocaleRoundtrip", testNullVoiceLocaleRoundtrip), - ("testRouteTypicalTravelTime", testRouteTypicalTravelTime), - ] -} - -extension SpokenInstructionTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__SpokenInstructionTests = [ - ("testCoding", testCoding), - ("testEquality", testEquality), - ] -} - -extension TransportTypeTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__TransportTypeTests = [ - ("testDecoding", testDecoding), - ] -} - -extension VisualInstructionComponentTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__VisualInstructionComponentTests = [ - ("testImageComponent", testImageComponent), - ("testLaneComponent", testLaneComponent), - ("testTextComponent", testTextComponent), - ("testUnrecognizedComponent", testUnrecognizedComponent), - ] -} - -extension WalkingOptionsTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__WalkingOptionsTests = [ - ("testURLQueryParams", testURLQueryParams), - ] -} - -extension WaypointTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__WaypointTests = [ - ("testAccuracies", testAccuracies), - ("testCoding", testCoding), - ("testEquality", testEquality), - ("testHeading", testHeading), - ("testSeparatesLegs", testSeparatesLegs), - ("testTracepointEquality", testTracepointEquality), - ] -} - -public func __allTests() -> [XCTestCaseEntry] { - return [ - testCase(CredentialsTests.__allTests__CredentialsTests), - testCase(DirectionsCredentialsTests.__allTests__DirectionsCredentialsTests), - testCase(DirectionsErrorTests.__allTests__DirectionsErrorTests), - testCase(GeoJSONTests.__allTests__GeoJSONTests), - testCase(IntersectionTests.__allTests__IntersectionTests), - testCase(MatchOptionsTests.__allTests__MatchOptionsTests), - testCase(MatchTests.__allTests__MatchTests), - testCase(QuickLookTests.__allTests__QuickLookTests), - testCase(RoadTests.__allTests__RoadTests), - testCase(RouteLegTests.__allTests__RouteLegTests), - testCase(RouteOptionsTests.__allTests__RouteOptionsTests), - testCase(RouteRefreshTests.__allTests__RouteRefreshTests), - testCase(RouteResponseTests.__allTests__RouteResponseTests), - testCase(RouteStepTests.__allTests__RouteStepTests), - testCase(RouteTests.__allTests__RouteTests), - testCase(SpokenInstructionTests.__allTests__SpokenInstructionTests), - testCase(TransportTypeTests.__allTests__TransportTypeTests), - testCase(VisualInstructionComponentTests.__allTests__VisualInstructionComponentTests), - testCase(WalkingOptionsTests.__allTests__WalkingOptionsTests), - testCase(WaypointTests.__allTests__WaypointTests), - ] -} -#endif From 0a4e054392830165eaf3888e232f9b6f00fb1f8c Mon Sep 17 00:00:00 2001 From: Aliaksandr Bialiauski Date: Mon, 31 May 2021 15:34:26 +0300 Subject: [PATCH 2/2] Update CONTRIBUTING.md removing unneeded step --- CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1fd62decd..d545ef067 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,12 +54,10 @@ To add any type, constant, or member to the package’s public interface: 1. Add a file to Tests/MapboxDirectionsTests/ 1. Add a file reference to the MapboxDirectionsTests group in MapboxDirections.xcodeproj. -1. Rerun `swift test --generate-linuxmain`, which updates [XCTestManifests.swift](./Tests/MapboxDirectionsTests/XCTestManifests.swift) for builds that use Swift Package Manager. ### Adding a test case 1. Add a `test*` method to one of the classes in one of the files in [Tests/MapboxDirectionsTests/](./Tests/MapboxDirectionsTests/). -1. Rerun `swift test --generate-linuxmain`, which updates [XCTestManifests.swift](./Tests/MapboxDirectionsTests/XCTestManifests.swift) for builds that use Swift Package Manager. ### Adding a test fixture