Skip to content

Commit

Permalink
Use enable-code-coverage for Linux tests (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett authored May 20, 2020
1 parent 48e1c1b commit 1029d42
Show file tree
Hide file tree
Showing 18 changed files with 9 additions and 263 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 1
- name: SPM tests
run: swift test --enable-code-coverage
run: swift test --enable-code-coverage --sanitize=thread
- name: Convert coverage files
run: |
xcrun llvm-cov export -format "lcov" \
Expand All @@ -46,7 +46,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
tag: ['swift:5.1', 'swift:5.2']
tag:
- swift:5.1
- swift:5.2
container:
image: ${{ matrix.tag }}
steps:
Expand All @@ -57,16 +59,16 @@ jobs:
- name: Install dependencies
run: |
apt-get update -qq
apt-get install -q -y tzdata libssl-dev zlib1g-dev
apt-get install -q -y tzdata libssl-dev zlib1g-dev curl
- name: Test
run: swift test --parallel --enable-code-coverage --enable-test-discovery
run: swift test --enable-test-discovery --enable-code-coverage --sanitize=thread
- name: Convert coverage files
run: |
llvm-cov export -format="lcov" \
.build/debug/aws-sdk-swift-corePackageTests.xctest \
-ignore-filename-regex="\/Tests\/" \
-instr-profile .build/debug/codecov/default.profdata > info.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v1.0.3
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
file: info.lcov
13 changes: 0 additions & 13 deletions Tests/AWSCryptoTests/AWSCryptoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,6 @@ final class AWSCryptoTests: XCTestCase {
XCTAssertEqual(authenticationKey, authenticationKey2)
XCTAssertEqual(authenticationKey.hexDigest(), authenticationKey2.hexDigest())
}

static var allTests = [
("testMD5", testMD5),
("testSHA256", testSHA256),
("testSHA384", testSHA384),
("testSHA512", testSHA512),
("testHMAC", testHMAC),
("testMD5InitUpdateFinal", testMD5InitUpdateFinal),
("testSHA256InitUpdateFinal", testSHA256InitUpdateFinal),
("testSHA384InitUpdateFinal", testSHA384InitUpdateFinal),
("testSHA512InitUpdateFinal", testSHA512InitUpdateFinal),
("testHMACInitUpdateFinal", testHMACInitUpdateFinal)
]
}

public extension Sequence where Element == UInt8 {
Expand Down
37 changes: 0 additions & 37 deletions Tests/AWSSDKSwiftCoreTests/AWSClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,6 @@ class AWSClientTests: XCTestCase {
}
}

static var allTests : [(String, (AWSClientTests) -> () throws -> Void)] {
return [
("testGetCredential", testGetCredential),
("testExpiredCredential", testExpiredCredential),
("testCreateAWSRequest", testCreateAWSRequest),
("testCreateNIORequest", testCreateNIORequest),
("testUnsignedClient", testUnsignedClient),
("testProtocolContentType", testProtocolContentType),
("testHeaderEncoding", testHeaderEncoding),
("testQueryEncoding", testQueryEncoding),
("testQueryEncodedArray", testQueryEncodedArray),
("testQueryEncodedDictionary", testQueryEncodedDictionary),
("testURIEncoding", testURIEncoding),
("testValidateXMLResponse", testValidateXMLResponse),
("testValidateXMLCodablePayloadResponse", testValidateXMLCodablePayloadResponse),
("testXMLError", testXMLError),
("testValidateQueryError", testQueryError),
("testValidateJSONResponse", testValidateJSONResponse),
("testValidateJSONCodablePayloadResponse", testValidateJSONCodablePayloadResponse),
("testValidateJSONRawPayloadResponse", testValidateJSONRawPayloadResponse),
("testValidateJSONError", testJSONError),
("testProcessHAL", testProcessHAL),
("testDataInJsonPayload", testDataInJsonPayload),
("testPayloadDataInResponse", testPayloadDataInResponse),
("testClientNoInputNoOutput", testClientNoInputNoOutput),
("testClientWithInputNoOutput", testClientWithInputNoOutput),
("testClientNoInputWithOutput", testClientNoInputWithOutput),
("testEC2ClientRequest", testEC2ClientRequest),
("testEC2ValidateError", testEC2ValidateError),
("testRegionEnum", testRegionEnum),
("testServerError", testServerError),
("testClientRetry", testClientRetry),
("testClientRetryFail", testClientRetryFail),
("testClientResponseEventLoop", testClientResponseEventLoop),
]
}

struct C: AWSEncodableShape {
public static var _encoding: [AWSMemberEncoding] = [
AWSMemberEncoding(label: "value", location: .header(locationName: "value"))
Expand Down
13 changes: 0 additions & 13 deletions Tests/AWSSDKSwiftCoreTests/CredentialTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,4 @@ class CredentialTests: XCTestCase {
XCTFail("\(error)")
}
}

static var allTests : [(String, (CredentialTests) -> () throws -> Void)] {
return [
("testSharedCredentials", testSharedCredentials),
("testSharedCredentialsMissingSessionToken", testSharedCredentialsMissingSessionToken),
("testSharedCredentialsMissingAccessKey", testSharedCredentialsMissingAccessKey),
("testSharedCredentialsMissingSecretKey", testSharedCredentialsMissingSecretKey),
("testSharedCredentialsMissingProfile", testSharedCredentialsMissingProfile),
("testSharedCredentialsParseFailure", testSharedCredentialsParseFailure),
("testExpiringCredential", testExpiringCredential),
("testSharedCredentialINIParser", testSharedCredentialINIParser)
]
}
}
21 changes: 0 additions & 21 deletions Tests/AWSSDKSwiftCoreTests/DictionaryEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -405,26 +405,5 @@ class DictionaryEncoderTests: XCTestCase {
XCTFail("\(error)")
}
}

static var allTests : [(String, (DictionaryEncoderTests) -> () throws -> Void)] {
return [
("testDecode", testDecode),
("testDecodeFail", testDecodeFail),
("testSimpleStructureDecodeEncode", testSimpleStructureDecodeEncode),
("testBaseTypesDecodeEncode", testBaseTypesDecodeEncode),
("testContainingStructureDecodeEncode", testContainingStructureDecodeEncode),
("testEnumDecodeEncode", testEnumDecodeEncode),
("testArrayDecodeEncode", testArrayDecodeEncode),
("testArrayOfStructuresDecodeEncode", testArrayOfStructuresDecodeEncode),
("testDictionaryDecodeEncode", testDictionaryDecodeEncode),
("testEnumDictionaryDecodeEncode", testEnumDictionaryDecodeEncode),
("testDataDecodeEncode", testDataDecodeEncode),
("testFloatOverflowDecodeErrors", testFloatOverflowDecodeErrors),
("testInvalidValueDecodeErrors", testInvalidValueDecodeErrors),
("testMissingKeyDecodeErrors", testMissingKeyDecodeErrors),
("testNestedContainer", testNestedContainer),
("testSupercoder", testSupercoder)
]
}
}

8 changes: 0 additions & 8 deletions Tests/AWSSDKSwiftCoreTests/HTTPClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ class AsyncHTTPClientTests: XCTestCase {
func testBody() {
HTTPClientTests(client).testBody()
}

static var allTests : [(String, (AsyncHTTPClientTests) -> () throws -> Void)] {
return [
("testGet", testGet),
("testHeaders", testHeaders),
("testBody", testBody)
]
}
}

/// HTTP Client tests, to be used with any HTTP client that conforms to AWSHTTPClient
Expand Down
6 changes: 0 additions & 6 deletions Tests/AWSSDKSwiftCoreTests/JSONCoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ class JSONCoderTests: XCTestCase {
XCTFail(error.localizedDescription)
}
}

static var allTests : [(String, (JSONCoderTests) -> () throws -> Void)] {
return [
("testSerializeToDictionaryAndJSON", testSerializeToDictionaryAndJSON),
]
}
}


7 changes: 0 additions & 7 deletions Tests/AWSSDKSwiftCoreTests/MetaDataServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ import NIOFoundationCompat
@testable import AWSSDKSwiftCore

class MetaDataServiceTests: XCTestCase {
static var allTests : [(String, (MetaDataServiceTests) -> () throws -> Void)] {
return [
("testInstanceMetaDataService", testInstanceMetaDataService),
("testInstanceMetaDataServiceFail", testInstanceMetaDataServiceFail),
("testMetaDataGetCredential", testMetaDataGetCredential)
]
}

func testInstanceMetaDataService() {
let body: [String: String] = ["Code" : "Success",
Expand Down
9 changes: 0 additions & 9 deletions Tests/AWSSDKSwiftCoreTests/PaginateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,4 @@ class PaginateTests: XCTestCase {
print(error)
}
}

static var allTests : [(String, (PaginateTests) -> () throws -> Void)] {
return [
("testIntegerTokenPaginate", testIntegerTokenPaginate),
("testStringTokenPaginate", testStringTokenPaginate),
("testPaginateError", testPaginateError),
("testPaginateErrorAfterFirstRequest", testPaginateErrorAfterFirstRequest),
]
}
}
8 changes: 0 additions & 8 deletions Tests/AWSSDKSwiftCoreTests/PayloadTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,4 @@ class PayloadTests: XCTestCase {
XCTFail("Unexpected error: \(error)")
}
}

static var allTests : [(String, (PayloadTests) -> () throws -> Void)] {
return [
("testStringRequestPayload", testStringRequestPayload),
("testDataRequestPayload", testDataRequestPayload),
("testByteBufferRequestPayload", testByteBufferRequestPayload),
]
}
}
16 changes: 0 additions & 16 deletions Tests/AWSSDKSwiftCoreTests/PerformanceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,20 +318,4 @@ class PerformanceTests: XCTestCase {
}
}
}

static var allTests : [(String, (PerformanceTests) -> () throws -> Void)] {
return [
("testHeaderRequest", testHeaderRequest),
("testXMLRequest", testXMLRequest),
("testXMLPayloadRequest", testXMLPayloadRequest),
("testJSONRequest", testJSONRequest),
("testJSONPayloadRequest", testJSONPayloadRequest),
("testQueryRequest", testQueryRequest),
("testUnsignedRequest", testUnsignedRequest),
("testSignedURLRequest", testSignedURLRequest),
("testSignedHeadersRequest", testSignedHeadersRequest),
("testValidateXMLResponse", testValidateXMLResponse),
("testValidateJSONResponse", testValidateJSONResponse),
]
}
}
21 changes: 1 addition & 20 deletions Tests/AWSSDKSwiftCoreTests/QueryEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,25 +241,6 @@ class QueryEncoderTests: XCTestCase {
XCTAssertEqual(queryAsString, "Object.Data=Hello")
} catch {
XCTFail("\(error)")
}


}

static var allTests : [(String, (QueryEncoderTests) -> () throws -> Void)] {
return [
("testSimpleStructureEncode", testSimpleStructureEncode),
("testContainingStructureEncode", testContainingStructureEncode),
("testEnumEncode", testEnumEncode),
("testArrayEncode", testArrayEncode),
("testArrayOfStructuresEncode", testArrayOfStructuresEncode),
("testDictionaryEncode", testDictionaryEncode),
("testDictionaryEnumKeyEncode", testDictionaryEnumKeyEncode),
("testArrayEncodingEncode", testArrayEncodingEncode),
("testDictionaryEncodingEncode", testDictionaryEncodingEncode),
("testDictionaryEncodingEncode2", testDictionaryEncodingEncode2),
("testDataBlobEncode", testDataBlobEncode),
("testEC2Encode", testEC2Encode)
]
}
}
}
12 changes: 0 additions & 12 deletions Tests/AWSSDKSwiftCoreTests/TimeStampTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,4 @@ class TimeStampTests: XCTestCase {
XCTFail("\(error)")
}
}

static var allTests : [(String, (TimeStampTests) -> () throws -> Void)] {
return [
("testDecodeISOFromJSON", testDecodeISOFromJSON),
("testDecodeISOFromXML", testDecodeISOFromXML),
("testDecodeHttpFormattedTimestamp", testDecodeHttpFormattedTimestamp),
("testDecodeUnixEpochTimestamp", testDecodeUnixEpochTimestamp),
("testEncodeISO8601ToXML", testEncodeISO8601ToXML),
("testEncodeHTTPHeaderToJSON", testEncodeHTTPHeaderToJSON),
("testEncodeUnixEpochToJSON", testEncodeUnixEpochToJSON)
]
}
}
11 changes: 0 additions & 11 deletions Tests/AWSSDKSwiftCoreTests/ValidationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,4 @@ class ValidationTests: XCTestCase {
let a4 = A(path:"/%hello/test/")
testValidationSuccess(a4)
}

static var allTests : [(String, (ValidationTests) -> () throws -> Void)] {
return [
("testNumericMinMaxValidation", testNumericMinMaxValidation),
("testFloatingPointMinMaxValidation", testFloatingPointMinMaxValidation),
("testStringLengthMinMaxValidation", testStringLengthMinMaxValidation),
("testArrayLengthMinMaxValidation", testArrayLengthMinMaxValidation),
("testStringPatternValidation", testStringPatternValidation),
("testStringPattern2Validation", testStringPattern2Validation),
]
}
}
25 changes: 0 additions & 25 deletions Tests/AWSSDKSwiftCoreTests/XMLCoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -470,29 +470,4 @@ class XMLCoderTests: XCTestCase {
XCTFail(error.localizedDescription)
}
}

static var allTests : [(String, (XMLCoderTests) -> () throws -> Void)] {
return [
("testSimpleStructureDecodeEncode", testSimpleStructureDecodeEncode),
("testContainingStructureDecodeEncode", testContainingStructureDecodeEncode),
("testEnumDecodeEncode", testEnumDecodeEncode),
("testArrayDecodeEncode", testArrayDecodeEncode),
("testArrayOfStructuresDecodeEncode", testArrayOfStructuresDecodeEncode),
("testDictionaryDecodeEncode", testDictionaryDecodeEncode),
("testDataDecodeEncode", testDataDecodeEncode),
("testSerializeToXML", testSerializeToXML),
("testDecodeExpandedContainers", testDecodeExpandedContainers),
("testArrayEncodingDecodeEncode", testArrayEncodingDecodeEncode),
("testArrayOfStructuresEncodingDecodeEncode", testArrayOfStructuresEncodingDecodeEncode),
("testDictionaryEncodingDecodeEncode", testDictionaryEncodingDecodeEncode),
("testDictionaryOfStructuresEncodingDecodeEncode", testDictionaryOfStructuresEncodingDecodeEncode),
("testFlatDictionaryEncodingDecodeEncode", testFlatDictionaryEncodingDecodeEncode),
("testEnumDictionaryEncodingDecodeEncode", testEnumDictionaryEncodingDecodeEncode),
("testEnumFlatDictionaryEncodingDecodeEncode", testEnumFlatDictionaryEncodingDecodeEncode),

("testEncodeDecodeXML", testEncodeDecodeXML),
("testDecodeFail", testDecodeFail),
("testEncodeDecodeDictionariesXML", testEncodeDecodeDictionariesXML)
]
}
}
19 changes: 0 additions & 19 deletions Tests/AWSSDKSwiftCoreTests/XMLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,5 @@ class XMLTests: XCTestCase {
XCTFail(error.localizedDescription)
}
}

static var allTests : [(String, (XMLTests) -> () throws -> Void)] {
return [
("testAddChild", testAddChild),
("testAddRemoveChild", testAddRemoveChild),
("testAttributeAdd", testAttributeAdd),
("testAttributeReplace", testAttributeReplace),
("testNamespaceAdd", testNamespaceAdd),
("testNamespaceReplace", testNamespaceReplace),
("testDocumentDefaultOutput", testDocumentDefaultOutput),
("testNullNamespaceReplace", testNamespaceReplace),
("testAttributesDecodeEncode", testAttributesDecodeEncode),
("testNamespacesDecodeEncode", testNamespacesDecodeEncode),
("testArrayDecodeEncode", testArrayDecodeEncode),
("testCommentDecodeEncode", testArrayDecodeEncode),
("testCDATADecodeEncode", testArrayDecodeEncode),
("testWhitespaceDecodeEncode", testWhitespaceDecodeEncode),
]
}
}

11 changes: 0 additions & 11 deletions Tests/AWSSignerTests/AWSSignerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,4 @@ final class AWSSignerTests: XCTestCase {
}
}
}

static var allTests = [
("testSignGetHeaders", testSignGetHeaders),
("testSignPutHeaders", testSignPutHeaders),
("testSignS3GetURL", testSignS3GetURL),
("testSignS3GetWithQueryURL", testSignS3GetWithQueryURL),
("testSignS3PutURL", testSignS3PutURL),
("testBodyData", testBodyData),
("testPerformanceSignedURL", testPerformanceSignedURL),
("testPerformanceSignedHeaders", testPerformanceSignedHeaders),
]
}
21 changes: 0 additions & 21 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,3 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import XCTest
@testable import AWSSDKSwiftCoreTests
@testable import AWSSignerTests

XCTMain([
testCase(AsyncHTTPClientTests.allTests),
testCase(AWSClientTests.allTests),
testCase(CredentialTests.allTests),
testCase(DictionaryEncoderTests.allTests),
testCase(JSONCoderTests.allTests),
testCase(MetaDataServiceTests.allTests),
testCase(PaginateTests.allTests),
testCase(PerformanceTests.allTests),
testCase(QueryEncoderTests.allTests),
testCase(TimeStampTests.allTests),
testCase(ValidationTests.allTests),
testCase(XMLCoderTests.allTests),
testCase(XMLTests.allTests),
testCase(AWSSignerTests.allTests)
])

0 comments on commit 1029d42

Please sign in to comment.