Fix test inter-dependencies

Cannot depend on another test target?
This commit is contained in:
Davide De Rosa 2021-11-02 22:52:47 +01:00
parent d977c3317c
commit e49e3cad08
19 changed files with 39 additions and 30 deletions

View File

@ -89,13 +89,11 @@ let package = Package(
.testTarget( .testTarget(
name: "TunnelKitCoreTests", name: "TunnelKitCoreTests",
dependencies: [ dependencies: [
"TunnelKitCore", "TunnelKitCore"
"_TunnelKitCoreObjC"
]), ]),
.testTarget( .testTarget(
name: "TunnelKitOpenVPNTests", name: "TunnelKitOpenVPNTests",
dependencies: [ dependencies: [
"TunnelKitCoreTests",
"TunnelKitOpenVPN", "TunnelKitOpenVPN",
"_TunnelKitOpenVPNObjC", "_TunnelKitOpenVPNObjC",
"TunnelKitLZO" "TunnelKitLZO"
@ -106,6 +104,7 @@ let package = Package(
.testTarget( .testTarget(
name: "TunnelKitLZOTests", name: "TunnelKitLZOTests",
dependencies: [ dependencies: [
"TunnelKitCore",
"TunnelKitLZO" "TunnelKitLZO"
]), ]),
] ]

View File

@ -1,6 +1,6 @@
// //
// DataManipulationTests.swift // DataManipulationTests.swift
// TunnelKitTests // TunnelKitCoreTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// RandomTests.swift // RandomTests.swift
// TunnelKitTests // TunnelKitCoreTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// RawPerformanceTests.swift // RawPerformanceTests.swift
// TunnelKitTests // TunnelKitCoreTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// RoutingTests.swift // RoutingTests.swift
// TunnelKitTests // TunnelKitCoreTests
// //
// Created by Davide De Rosa on 4/30/19. // Created by Davide De Rosa on 4/30/19.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// TestUtils+Core.swift // TestUtils.swift
// TunnelKitTests // TunnelKitCoreTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.
@ -38,10 +38,6 @@ import Foundation
@testable import TunnelKitCore @testable import TunnelKitCore
public class TestUtils { public class TestUtils {
public static func uniqArray(_ v: [Int]) -> [Int] {
return v.reduce([]){ $0.contains($1) ? $0 : $0 + [$1] }
}
public static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] { public static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] {
var suite = [Data]() var suite = [Data]()
for _ in 0..<count { for _ in 0..<count {

View File

@ -1,6 +1,6 @@
// //
// CompressionTests.swift // CompressionTests.swift
// TunnelKitTests // TunnelKitLZOTests
// //
// Created by Davide De Rosa on 3/18/19. // Created by Davide De Rosa on 3/18/19.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// AppExtensionTests.swift // AppExtensionTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 10/23/17. // Created by Davide De Rosa on 10/23/17.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// ConfigurationParserTests.swift // ConfigurationParserTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 11/10/18. // Created by Davide De Rosa on 11/10/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// ControlChannelTests.swift // ControlChannelTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 9/10/18. // Created by Davide De Rosa on 9/10/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// DataPathEncryptionTests.swift // DataPathEncryptionTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/11/18. // Created by Davide De Rosa on 7/11/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// DataPathPerformanceTests.swift // DataPathPerformanceTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.
@ -38,7 +38,6 @@ import XCTest
@testable import TunnelKitCore @testable import TunnelKitCore
@testable import TunnelKitOpenVPN @testable import TunnelKitOpenVPN
import _TunnelKitOpenVPNObjC import _TunnelKitOpenVPNObjC
import TunnelKitCoreTests
class DataPathPerformanceTests: XCTestCase { class DataPathPerformanceTests: XCTestCase {
private var dataPath: DataPath! private var dataPath: DataPath!

View File

@ -1,6 +1,6 @@
// //
// EncryptionPerformanceTests.swift // EncryptionPerformanceTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.
@ -38,7 +38,6 @@ import XCTest
@testable import TunnelKitCore @testable import TunnelKitCore
import _TunnelKitCoreObjC import _TunnelKitCoreObjC
import _TunnelKitOpenVPNObjC import _TunnelKitOpenVPNObjC
import TunnelKitCoreTests
class EncryptionPerformanceTests: XCTestCase { class EncryptionPerformanceTests: XCTestCase {
private var cbcEncrypter: Encrypter! private var cbcEncrypter: Encrypter!

View File

@ -1,6 +1,6 @@
// //
// EncryptionTests.swift // EncryptionTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// LinkTests.swift // LinkTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.
@ -37,7 +37,6 @@
import XCTest import XCTest
@testable import TunnelKitCore @testable import TunnelKitCore
@testable import _TunnelKitCoreObjC @testable import _TunnelKitCoreObjC
import TunnelKitCoreTests
class LinkTests: XCTestCase { class LinkTests: XCTestCase {

View File

@ -1,6 +1,6 @@
// //
// PacketTests.swift // PacketTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 9/9/18. // Created by Davide De Rosa on 9/9/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// PushTests.swift // PushTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 8/24/18. // Created by Davide De Rosa on 8/24/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// StaticKeyTests.swift // StaticKeyTests.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 9/11/18. // Created by Davide De Rosa on 9/11/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.

View File

@ -1,6 +1,6 @@
// //
// TestUtils+OpenVPN.swift // TestUtils.swift
// TunnelKitTests // TunnelKitOpenVPNTests
// //
// Created by Davide De Rosa on 7/7/18. // Created by Davide De Rosa on 7/7/18.
// Copyright (c) 2021 Davide De Rosa. All rights reserved. // Copyright (c) 2021 Davide De Rosa. All rights reserved.
@ -39,6 +39,23 @@ import Foundation
import _TunnelKitCoreObjC import _TunnelKitCoreObjC
import _TunnelKitOpenVPNObjC import _TunnelKitOpenVPNObjC
public class TestUtils {
public static func uniqArray(_ v: [Int]) -> [Int] {
return v.reduce([]){ $0.contains($1) ? $0 : $0 + [$1] }
}
public static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] {
var suite = [Data]()
for _ in 0..<count {
suite.append(try! SecureRandom.data(length: size))
}
return suite
}
private init() {
}
}
extension Encrypter { extension Encrypter {
func encryptData(_ data: Data, flags: UnsafePointer<CryptoFlags>?) throws -> Data { func encryptData(_ data: Data, flags: UnsafePointer<CryptoFlags>?) throws -> Data {
let srcLength = data.count let srcLength = data.count