diff --git a/Sources/XCParseCore/ActionTestPerformanceMetricSummary.swift b/Sources/XCParseCore/ActionTestPerformanceMetricSummary.swift index f71d82d..97e2193 100644 --- a/Sources/XCParseCore/ActionTestPerformanceMetricSummary.swift +++ b/Sources/XCParseCore/ActionTestPerformanceMetricSummary.swift @@ -8,6 +8,40 @@ import Foundation + +public enum ActionTestPerformanceMetric : ExpressibleByStringLiteral { + case ClockMonotonicTime + case CPUCycles + case CPUInstructionsRetired + case CPUTime + case DiskLogicalWrites + case MemoryPhysical + case MemoryPhysicalPeak + case Unknown(name: String) + + public init(stringLiteral name: String) { + switch name { + case "com.apple.dt.XCTMetric_Clock.time.monotonic": + self = .ClockMonotonicTime + case "com.apple.dt.XCTMetric_CPU.cycles": + self = .CPUCycles + case "com.apple.dt.XCTMetric_CPU.instructions_retired": + self = .CPUInstructionsRetired + case "com.apple.dt.XCTMetric_CPU.time": + self = .CPUTime + case "com.apple.dt.XCTMetric_Disk.logical.writes": + self = .DiskLogicalWrites + case "com.apple.dt.XCTMetric_Memory.physical": + self = .MemoryPhysical + case "com.apple.dt.XCTMetric_Memory.physical-peak": + self = .MemoryPhysicalPeak + default: + self = .Unknown(name: name) + } + } +} + + open class ActionTestPerformanceMetricSummary : Codable { public let displayName: String public let unitOfMeasurement: String @@ -20,6 +54,12 @@ open class ActionTestPerformanceMetricSummary : Codable { public let maxRegression: Double? public let maxStandardDeviation: Double? + // Derived + public var metricType : ActionTestPerformanceMetric { + let identifierString = identifier ?? "Identifier Missing" + return ActionTestPerformanceMetric(stringLiteral: identifierString) + } + enum ActionTestPerformanceMetricSummaryCodingKeys: String, CodingKey { case displayName case unitOfMeasurement diff --git a/Sources/XCParseCore/XCPResultDecoding.swift b/Sources/XCParseCore/XCPResultDecoding.swift index c211b9d..f38348d 100644 --- a/Sources/XCParseCore/XCPResultDecoding.swift +++ b/Sources/XCParseCore/XCPResultDecoding.swift @@ -350,6 +350,11 @@ extension KeyedDecodingContainer { let resultObj = try container.decode(XCResultObject.self) if let type = resultObj.type.getType() as? T.Type { list.append(try tmpContainer.decode(type)) + } else if let type = resultObj.type.getType() as? XCResultValueType.Type { + let decodedValue = try tmpContainer.decode(type) + if let value = decodedValue.getValue() as? T { + list.append(value) + } } } return list diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== new file mode 100644 index 0000000..1593e55 --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== @@ -0,0 +1 @@ +[{"name":"SearchMetricsTests-E9678AD1-865C-4FED-A207-7B7691D31172","type":2},{"name":"scheduling.log","type":1}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== b/Tests/Resources/testMetrics.xcresult/Data/data.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== new file mode 100644 index 0000000..4f00d8c Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== new file mode 100644 index 0000000..6f88dd2 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== b/Tests/Resources/testMetrics.xcresult/Data/data.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== new file mode 100644 index 0000000..a0e98eb --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== @@ -0,0 +1 @@ +[{"name":"SearchMetricsTests-B2B474B5-EBE3-41D5-866E-11B9061A59E7.xctestconfiguration","type":1}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== b/Tests/Resources/testMetrics.xcresult/Data/data.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== new file mode 100644 index 0000000..010c174 --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== @@ -0,0 +1 @@ +[{"name":"tmp","type":2}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== new file mode 100644 index 0000000..5de87cb Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== b/Tests/Resources/testMetrics.xcresult/Data/data.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== new file mode 100644 index 0000000..3ac8775 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== new file mode 100644 index 0000000..6aa2459 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== b/Tests/Resources/testMetrics.xcresult/Data/data.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== new file mode 100644 index 0000000..9534ca0 --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== @@ -0,0 +1 @@ +[{"name":"remote-container","type":2}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== new file mode 100644 index 0000000..b8a7394 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== new file mode 100644 index 0000000..e081e1f Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== b/Tests/Resources/testMetrics.xcresult/Data/data.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== new file mode 100644 index 0000000..f1c0725 --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== @@ -0,0 +1 @@ +[{"name":"B2B474B5-EBE3-41D5-866E-11B9061A59E7","type":2}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== b/Tests/Resources/testMetrics.xcresult/Data/data.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== new file mode 100644 index 0000000..9a0adba --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Data/data.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== @@ -0,0 +1 @@ +[{"name":"testmanagerd.log","type":1}] \ No newline at end of file diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== b/Tests/Resources/testMetrics.xcresult/Data/data.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== new file mode 100644 index 0000000..c0f974e Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== b/Tests/Resources/testMetrics.xcresult/Data/data.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== new file mode 100644 index 0000000..08f3602 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== b/Tests/Resources/testMetrics.xcresult/Data/data.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== new file mode 100644 index 0000000..8d551ed Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== b/Tests/Resources/testMetrics.xcresult/Data/data.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== new file mode 100644 index 0000000..7d1d71e Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== b/Tests/Resources/testMetrics.xcresult/Data/data.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== new file mode 100644 index 0000000..5ba79b1 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== b/Tests/Resources/testMetrics.xcresult/Data/data.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== new file mode 100644 index 0000000..baeb294 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== b/Tests/Resources/testMetrics.xcresult/Data/data.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== new file mode 100644 index 0000000..b87e1d9 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/data.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== b/Tests/Resources/testMetrics.xcresult/Data/data.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== new file mode 100644 index 0000000..237b8e4 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/data.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== new file mode 100644 index 0000000..6a4ac16 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~2cZk-rcfcJyIr0RMyhHn8Y66wRloJpYYpy_Uso1cGuGFqXcMufCktonXe3E1AW5WcRtngECJpQzAmjP8NIUSRA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~5KVP6nYPs-Yr5hFGnDRK2hXaIBRQORPEoS8i6apIBA1mqvol-_b54VklZ55B31c6T0Z4L_QuRmAyWzEIR7hFew== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== new file mode 100644 index 0000000..fb117cd Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~5s3-5BV1jxEIk5Ihk_mH_4P2XK0oAdk2T7zGhK1j6tmio55-EWaQICMM-GbLKyF2uCRiVjHuqFJeDPL6hgszbA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== new file mode 100644 index 0000000..73e701a Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~8nVAn0b5EP01lDGHHno97wQuNrVkgJ6rpbjAf7clB58UbXuhPxSCRxvqRT7E_cc6ZPyDigkCpEzU8vh51DA7LQ== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== new file mode 100644 index 0000000..cfd9079 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~AJwN_W4l3bSyi3kQ5xNhx0ikEYLjYplHuUMwritsZdoPEU5cgY6GYklyxUr_5Bl3XAoezt3XPt4PTgROJog5AQ== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~CJsaEjh-7Cqbe0uPNuxHLRY3uwz5cqUGHbDufWuCpTXt_QRH-AErecUs5kBXmsVPfwocQBKA3j8R70gcXzMiNA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== new file mode 100644 index 0000000..1eff73c Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~Im6O2_22kPqRqFNNNQHHe0d_c7-dv40dnbFjdE4nVm36dm2NS0n0mi2hdOIfzHqVgITYeCwgzlNsYfus6WVr3A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~TzjIxWffpqTF_0tq-Raw3jYnVXJg0VaagPf4NtKkQgd9P14Kxd9-JISi0sxw7_4vXxbHOPBcxdCEj2EeyB4vtA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== new file mode 100644 index 0000000..3b3032d Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~Xp8XnaKg1YV96SY8RgA0ohH5zVbTGR8uijnn57TAYoNs7XLu2nRh6PDiF3i626eJhB8G4H1cvD8oUPCm22cVPg== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~ZS9GwKLMs_kNALoVF28EiGp3T6kWdB2UBNFoQ0TBVfcjtTg1U6lORkeIDGbvqSsQVDyrfUNpLHZUEnmo6vc_KA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~a7Vlmq47u0Lpm69gGieHPOAknsRn1Qsaaar97b660Dj6frlAGD-VlYJfR7CMnGC-FCqaGdW67HpC1gnQ2AFsPA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== new file mode 100644 index 0000000..480d245 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~eV158v50XP6T425WfLN6MWQwxBe-OSVRQ8o2VgL9DCjoO9xHvf7rRb5YsJGXQa26AToX1MEIK6l3nW-qVpZWrA== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== new file mode 100644 index 0000000..4328f2e Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~f2b7QyoG8FBajH-Y7z7HPlvLAz3SP82z1rvklKYonLCD9_fxO1oC03ZpS5D-rR9-K2qwziOkHyIvJx-gp3JBRw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~flnPvaRumYUD0EyzIpFDpfKglmVoGNF7vtb3u_adZPQwR_EutrRNTL_18lgv3Kck0hTxc8wxYCxrln5J3QhR9A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~gdTzDhB6AbcSixtsM_nZ8JKBA68_i2TxaykVzdv767DUIuKE3_IPo5g4W7wjipiyNYSkf0q-9EFsHpMQv-K1Rw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~hcPYoefObdz7yoOUvXm9kC5KK4C2yxaL3FpH2ucu0PAjdHyNGKlkIDCDO-VLyqSqPyD6nq57xVwcb3JEtOwghw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== new file mode 100644 index 0000000..d8dad74 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== new file mode 100644 index 0000000..e7d317c Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~kkcINcZfK36jjcB3irAf-rcOctqnCDZ38gCg_RC5n7z73Ny-0B7g5XvecLf10lT1858DGr0wa1K2kZawAK7hZg== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~slegUmUaB1rO86R_XRLh-QReQ_JQeM8DxNLIUcR5teNRffimQPB0nq4OvaibvlwqvwHJ4OhgvwvNoVhgsGIoCw== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~uAczlmHLzgb93UM5EHn36yT60_eWd03afPKqMtGyTDbG_ex_uRixVIzRED8ra4I4vBbtWoSw1IMHw50UysJK4w== differ diff --git a/Tests/Resources/testMetrics.xcresult/Data/refs.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== b/Tests/Resources/testMetrics.xcresult/Data/refs.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Tests/Resources/testMetrics.xcresult/Data/refs.0~v61lLQfmRh7wn6YhQqf2UavyJtDRmbyOmojlb0QewIBAHO9CUUs-tyrHsIO9vtln-oCM0puwMX_g2BUDLQRI6A== differ diff --git a/Tests/Resources/testMetrics.xcresult/Info.plist b/Tests/Resources/testMetrics.xcresult/Info.plist new file mode 100644 index 0000000..a3e8d39 --- /dev/null +++ b/Tests/Resources/testMetrics.xcresult/Info.plist @@ -0,0 +1,29 @@ + + + + + dateCreated + 2020-08-24T22:35:35Z + externalLocations + + rootId + + hash + 0~k19jmlIfY6-T69UZzxSgz-dohjtf-XoZrqgF06fevp05vGd92yV7we2bNn83ct1Ble8J48QfQJby9Hp2CdXL7g== + + storage + + backend + fileBacked2 + compression + standard + + version + + major + 3 + minor + 24 + + + diff --git a/Tests/xcparseTests/xcparseTests.swift b/Tests/xcparseTests/xcparseTests.swift index b3574fc..c9b9430 100644 --- a/Tests/xcparseTests/xcparseTests.swift +++ b/Tests/xcparseTests/xcparseTests.swift @@ -50,6 +50,9 @@ final class xcparseTests: XCTestCase { ("testDivideAttachmentsWithUTIFlags",testDivideAttachmentsWithUTIFlags), ("testAttachmentsHEIC",testAttachmentsHEIC), ("testAttachmentsMissingInput",testAttachmentsMissingInput), + ("testPerfomanceMetrics",testPerformanceMetricsCategorySearch), + ("testPerformanceMetricsSearchAlongTheRoad",testPerformanceMetricsSearchAlongTheRoad), + ("testPerformanceMetricsUsualSearch",testPerformanceMetricsUsualSearch), ] func runAndWaitForXCParseProcess() throws { @@ -64,6 +67,143 @@ final class xcparseTests: XCTestCase { super.tearDown() } + // MARK: - Metrics - + + func testPerformanceMetricsCategorySearch() throws { + let file = try Resource(name: "testMetrics", type: "xcresult") + let xcresultPath = file.url.path + + var xcresult = XCResult(path: xcresultPath) + guard let invocationRecord = xcresult.invocationRecord else { return } + + guard let action = invocationRecord.actions.filter({ $0.actionResult.testsRef != nil }).first else { return } + + guard let testPlanRunSummaries: ActionTestPlanRunSummaries = action.actionResult.testsRef!.modelFromReference(withXCResult: xcresult) else { return } + + let testableSummaries = testPlanRunSummaries.summaries[0].testableSummaries + + let testSummaries = testableSummaries[0].flattenedTestSummaryMap(withXCResult: xcresult).map({ $0.testSummary }) + let categorySearch = testSummaries.filter { + guard let testName = $0.name else { + return false + } + + return testName == "testCategorySearch()" + } + + for testSummary in categorySearch { + for metric in testSummary.performanceMetrics { + let perfMetricMeasurements = metric.measurements + + switch metric.metricType { + case .ClockMonotonicTime: + XCTAssertEqual(perfMetricMeasurements, [6.109e-06, 6.273000000000001e-06, 6.314e-06, 4.633e-06, 6.15e-06]) + break + case .CPUCycles: + XCTAssertEqual(perfMetricMeasurements, [1965.018, 2366.559, 2923.601, 2114.557, 3463.443]) + break + case .CPUInstructionsRetired: + XCTAssertEqual(perfMetricMeasurements, [3262.079, 3518.519, 3657.059, 3185.146, 4164.798]) + break + case .CPUTime: + XCTAssertEqual(perfMetricMeasurements, [0.001053659, 0.00140999, 0.0016860430000000001, 0.0012279090000000001, 0.002028352]) + break + case .DiskLogicalWrites: + XCTAssertEqual(perfMetricMeasurements, [0.0, 0.0, 49.152, 0.0, 0.0]) + break + case .MemoryPhysical: + XCTAssertEqual(perfMetricMeasurements, [32.768, 81.92, 98.304, 32.768, 32.768]) + break + case .MemoryPhysicalPeak: + XCTAssertEqual(perfMetricMeasurements, [0.0, 0.0, 0.0, 0.0, 0.0]) + break + default: + break + } + } + } + } + + func testPerformanceMetricsSearchAlongTheRoad() throws { + let file = try Resource(name: "testMetrics", type: "xcresult") + let xcresultPath = file.url.path + + var xcresult = XCResult(path: xcresultPath) + guard let invocationRecord = xcresult.invocationRecord else { return } + + guard let action = invocationRecord.actions.filter({ $0.actionResult.testsRef != nil }).first else { return } + + guard let testPlanRunSummaries: ActionTestPlanRunSummaries = action.actionResult.testsRef!.modelFromReference(withXCResult: xcresult) else { return } + + let testableSummaries = testPlanRunSummaries.summaries[0].testableSummaries + + let testSummaries = testableSummaries[0].flattenedTestSummaryMap(withXCResult: xcresult).map({ $0.testSummary }) + let categorySearch = testSummaries.filter { + guard let testName = $0.name else { + return false + } + + return testName == "testSearchAlongTheRoad()" + } + + for testSummary in categorySearch { + for metric in testSummary.performanceMetrics { + let perfMetricMeasurements = metric.measurements + + switch metric.metricType { + case .MemoryPhysical: + XCTAssertEqual(perfMetricMeasurements, [0.0, 16.384, 0.0, 0.0, 0.0]) + break + case .MemoryPhysicalPeak: + XCTAssertEqual(perfMetricMeasurements, [0.0, 0.0, 0.0, 0.0, 0.0]) + break + default: + break + } + } + } + } + + func testPerformanceMetricsUsualSearch() throws { + let file = try Resource(name: "testMetrics", type: "xcresult") + let xcresultPath = file.url.path + + var xcresult = XCResult(path: xcresultPath) + guard let invocationRecord = xcresult.invocationRecord else { return } + + guard let action = invocationRecord.actions.filter({ $0.actionResult.testsRef != nil }).first else { return } + + guard let testPlanRunSummaries: ActionTestPlanRunSummaries = action.actionResult.testsRef!.modelFromReference(withXCResult: xcresult) else { return } + + let testableSummaries = testPlanRunSummaries.summaries[0].testableSummaries + + let testSummaries = testableSummaries[0].flattenedTestSummaryMap(withXCResult: xcresult).map({ $0.testSummary }) + let categorySearch = testSummaries.filter { + guard let testName = $0.name else { + return false + } + + return testName == "testUsualSearch()" + } + + for testSummary in categorySearch { + for metric in testSummary.performanceMetrics { + let perfMetricMeasurements = metric.measurements + + switch metric.metricType { + case .MemoryPhysical: + XCTAssertEqual(perfMetricMeasurements, [0.0, 16.384, 147.456, 32.768, 65.536]) + break + case .MemoryPhysicalPeak: + XCTAssertEqual(perfMetricMeasurements, [0.0, 0.0, 0.0, 0.0, 0.0]) + break + default: + break + } + } + } + } + // MARK: - Command - Screenshots func testScreenshots() throws {