Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: 'Install dependencies'
run: ./ci/mac_ci_setup.sh
- name: Run iOS tests (tsan)
run: env -u ANDROID_NDK_HOME ./bazelw test $(./bazelw query 'kind(ios_unit_test, //test/platform/swift/unit_integration:test_tsan)') --test_tag_filters=macos_only --test_output=errors --config ci --config ios-tsan
run: env -u ANDROID_NDK_HOME ./bazelw test $(./bazelw query 'kind(ios_unit_test, //test/platform/swift/unit_integration/core/...)') --test_tag_filters=macos_only --test_output=errors --config ci --config ios-tsan
verify_ios:
runs-on: ubuntu-latest
needs: ["macos_tsan", "macos_asan", "swift_hello_world"]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Bazel
/bazel-*
**/Bazel Generated/

compile_commands.json
.DS_Store
Expand Down
13 changes: 11 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ xcodeproj(
],
),
# Tests
"//test/platform/swift/unit_integration:test",
"//test/platform/swift/unit_integration/core:test",
"//test/platform/swift/unit_integration/integrations:test",
],
xcode_configurations = {
"Debug": {
Expand Down Expand Up @@ -233,7 +234,15 @@ xcodeproj(
name = "iOS Capture Unit Integration Tests",
test = xcschemes.test(
test_targets = [
"//test/platform/swift/unit_integration:test",
"//test/platform/swift/unit_integration/core:test",
],
),
),
xcschemes.scheme(
name = "iOS Capture URLSession Integration Tests",
test = xcschemes.test(
test_targets = [
"//test/platform/swift/unit_integration/integrations:test",
],
),
),
Expand Down
3 changes: 2 additions & 1 deletion examples/swift/benchmark/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("//bazel:config.bzl", "MINIMUM_IOS_VERSION_TESTS")

# App that directly imports Bitdrift as a `swift_library` for compatibility with `rules_xcodeproj`
# and allowing building the app and all its deps in a single step.
Expand All @@ -23,7 +24,7 @@ ios_application(
bundle_id = "io.bitdrift.example.benchmarkapp",
families = ["iphone"],
infoplists = ["Info.plist"],
minimum_os_version = "13.0",
minimum_os_version = MINIMUM_IOS_VERSION_TESTS,
provisioning_profile = select({
"//bazel:ios_device_build": "//bazel/ios:ios_provisioning_profile",
"//conditions:default": None,
Expand Down
12 changes: 5 additions & 7 deletions examples/swift/benchmark/ResourceProfiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ final class ResourceProfiler {
self.startNetworkProfiling(
isRunning: isRunning,
name: "Simple",
configuration: .init(
sessionReplayConfiguration: nil,
resourceReportingConfiguration: nil
),
configuration: .init(sessionReplayConfiguration: nil),
streamHandler: { streamID in
configure_benchmarking_configuration(streamID)
await_configuration_ack(streamID)
Expand Down Expand Up @@ -86,16 +83,17 @@ final class ResourceProfiler {
let url = self.makeDirectoryURL()
self.logger = Logger(
withAPIKey: "foo",
appInstallID: "device-id",
bufferDirectory: url,
// swiftlint:disable:next force_unwrapping
apiURL: URL(string: "https://localhost:\(port)")!,
remoteErrorReporter: nil,
configuration: configuration,
sessionProvider: InMemorySessionProvider(sessionIDGenerator: { UUID().uuidString }),
sessionStrategy: .fixed(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that benchmark app was broken so fixed it in here

dateProvider: nil,
fieldProviders: [],
enableNetwork: true
enableNetwork: true,
storageProvider: Storage.shared,
timeProvider: SystemTimeProvider()
)
self.loggerURL = url

Expand Down
16 changes: 0 additions & 16 deletions test/platform/swift/ResourceReporterUtilizationTest.swift

This file was deleted.

38 changes: 0 additions & 38 deletions test/platform/swift/unit_integration/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import XCTest

final class AppUpdateEventListenerTests: XCTestCase {
Expand Down
18 changes: 18 additions & 0 deletions test/platform/swift/unit_integration/core/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("//bazel:bitdrift_swift_test.bzl", "bitdrift_mobile_swift_test")

bitdrift_mobile_swift_test(
name = "test",
srcs = glob(["**/*.swift"]),
repository = "@capture",
tags = ["macos_only"],
visibility = ["//visibility:public"],
deps = [
"//platform/swift/source:ios_lib",
"//platform/swift/source:rust_bridge",
"//test/platform/swift/benchmark:benchmarks",
"//test/platform/swift/bridging:rust_bridge",
"//test/platform/swift/unit_integration/mocks",
"@Difference//:difference",
"@SwiftBenchmark//:swift_benchmark",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import CapturePassable
import Foundation
import XCTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import CaptureTestBridge
import Foundation
import XCTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import XCTest

final class LoggerSharedTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import CapturePassable
import Foundation
import XCTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

@testable import Capture
@testable import CaptureLoggerBridge
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// capture-sdk - bitdrift's client SDK
// Copyright Bitdrift, Inc. All rights reserved.
//
// Use of this source code is governed by a source available license that can be found in the
// LICENSE file or at:
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import XCTest

final class ResourceUtilizationTargetTest: XCTestCase {
func testTargetDoesNotCrash() {
let target = ResourceUtilizationTarget(
storageProvider: MockStorageProvider(),
timeProvider: MockTimeProvider()
)

let logger = MockCoreLogging()
target.logger = logger

let expectation = self.expectation(description: "resource utilization log is emitted")
logger.logResourceUtilizationExpectation = expectation

target.tick()

XCTAssertEqual(.completed, XCTWaiter().wait(for: [expectation], timeout: 0.5))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
@testable import CaptureTestBridge
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
@testable import CaptureTestBridge
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import CapturePassable
import CaptureTestBridge
import Foundation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

@testable import Capture
import CaptureLoggerBridge
import CaptureMocks
import CaptureTestBridge
import Foundation
import XCTest
Expand Down
13 changes: 13 additions & 0 deletions test/platform/swift/unit_integration/integrations/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("//bazel:bitdrift_swift_test.bzl", "bitdrift_mobile_swift_test")

bitdrift_mobile_swift_test(
name = "test",
srcs = glob(["**/*.swift"]),
repository = "@capture",
tags = ["macos_only"],
visibility = ["//visibility:public"],
deps = [
"//platform/swift/source:ios_lib",
"//test/platform/swift/unit_integration/mocks",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt

@testable import Capture
import CaptureMocks
import Foundation
import XCTest

Expand Down
17 changes: 17 additions & 0 deletions test/platform/swift/unit_integration/mocks/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

swift_library(
name = "mocks",
testonly = True,
srcs = glob(["**/*.swift"]),
features = [
"swift.enable_library_evolution",
],
module_name = "CaptureMocks",
tags = ["macos_only"],
visibility = ["//visibility:public"],
deps = [
"//platform/swift/source:ios_lib",
"//platform/swift/source:rust_bridge",
],
)
Loading