Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into armcknight/ci/wrap-xc…
Browse files Browse the repository at this point in the history
…odebuild
  • Loading branch information
armcknight committed Feb 13, 2025
2 parents fe4c0d8 + 53b29ac commit 0fdaa81
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.0
2 changes: 1 addition & 1 deletion SentryTestUtils/SentryLogExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension SentryLog {

/// SentryLog uses NSLog internally, which can significantly slow down code because it requires
/// synchronization. Tests that need code to run fast should can turn off logs to avoid flakiness.
public static func withOutLogs<T>(_ closure: () throws -> T) rethrows -> T {
public static func withoutLogs<T>(_ closure: () throws -> T) rethrows -> T {
defer { setTestDefaultLogLevel() }
disable()
return try closure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class SentryANRTrackerV2Tests: XCTestCase {

// This would print thousands of logs so we execute it without
// to avoid spamming the test logs.
SentryLog.withOutLogs {
SentryLog.withoutLogs {
wait(for: [firstListener.anrDetectedExpectation, firstListener.anrStoppedExpectation, thirdListener.anrStoppedExpectation, thirdListener.anrDetectedExpectation], timeout: waitTimeout)
}

Expand Down Expand Up @@ -366,7 +366,7 @@ class SentryANRTrackerV2Tests: XCTestCase {

// This would print thousands of logs so we execute it without
// to avoid spamming the test logs.
SentryLog.withOutLogs {
SentryLog.withoutLogs {
wait(for: [listener.anrDetectedExpectation, listener.anrStoppedExpectation], timeout: waitTimeout)
}
}
Expand All @@ -391,7 +391,7 @@ class SentryANRTrackerV2Tests: XCTestCase {

// This would print thousands of logs so we execute it without
// to avoid spamming the test logs.
SentryLog.withOutLogs {
SentryLog.withoutLogs {
wait(for: [listener.anrDetectedExpectation, listener.anrStoppedExpectation], timeout: waitTimeout)
}
}
Expand Down Expand Up @@ -515,7 +515,7 @@ class SentryANRTrackerV2Tests: XCTestCase {

// This would print thousands of logs so we execute it without
// to avoid spamming the test logs.
SentryLog.withOutLogs {
SentryLog.withoutLogs {
wait(for: [listener.anrDetectedExpectation, listener.anrStoppedExpectation], timeout: waitTimeout)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class SentryFeedbackTests: XCTestCase {
func testCaseDescription() -> String {
"(config: (requiresName: \(input.config.requiresName), requiresEmail: \(input.config.requiresEmail), nameInput: \(input.config.nameInput == nil ? "nil" : "\"\(input.config.nameInput!)\""), emailInput: \(input.config.emailInput == nil ? "nil" : "\"\(input.config.emailInput!)\""), messageInput: \(input.config.messageInput == nil ? "nil" : "\"\(input.config.messageInput!)\""), includeScreenshot: \(input.config.includeScreenshot)), expectedSubmitButtonAccessibilityHint: \(input.expectedSubmitButtonAccessibilityHint)"
}
SentryLog.withOutLogs {
SentryLog.withoutLogs {
switch viewModel.validate() {
case .success(let hint):
XCTAssert(input.shouldValidate)
Expand Down
14 changes: 7 additions & 7 deletions Tests/SentryTests/Networking/SentryHttpTransportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ class SentryHttpTransportTests: XCTestCase {
givenCachedEvents(amount: 30)
fixture.requestManager.responseDelay = fixture.flushTimeout + 0.2

SentryLog.withOutLogs {
SentryLog.withoutLogs {
let beforeFlush = getAbsoluteTime()
let result = sut.flush(fixture.flushTimeout)
let blockingDuration = getDurationNs(beforeFlush, getAbsoluteTime()).toTimeInterval()
Expand All @@ -814,7 +814,7 @@ class SentryHttpTransportTests: XCTestCase {
func testFlush_BlocksCallingThread_FinishesFlushingWhenSent() {
givenCachedEvents(amount: 1)

SentryLog.withOutLogs {
SentryLog.withoutLogs {

let beforeFlush = getAbsoluteTime()
XCTAssertEqual(.success, sut.flush(fixture.flushTimeout), "Flush should not time out.")
Expand All @@ -827,7 +827,7 @@ class SentryHttpTransportTests: XCTestCase {
func testFlush_CalledSequentially_BlocksTwice() {
givenCachedEvents()

SentryLog.withOutLogs {
SentryLog.withoutLogs {

let beforeFlush = getAbsoluteTime()
XCTAssertEqual(.success, sut.flush(fixture.flushTimeout), "Flush should not time out.")
Expand All @@ -845,7 +845,7 @@ class SentryHttpTransportTests: XCTestCase {
var blockingDurationSum: TimeInterval = 0.0
let flushInvocations = 100

SentryLog.withOutLogs {
SentryLog.withoutLogs {

for _ in 0..<flushInvocations {
let beforeFlush = getAbsoluteTime()
Expand All @@ -872,7 +872,7 @@ class SentryHttpTransportTests: XCTestCase {
var blockingDurationSum: TimeInterval = 0.0
let flushInvocations = 100

SentryLog.withOutLogs {
SentryLog.withoutLogs {

for _ in 0..<flushInvocations {
let beforeFlush = getAbsoluteTime()
Expand All @@ -890,7 +890,7 @@ class SentryHttpTransportTests: XCTestCase {
func testFlush_CallingFlushDirectlyAfterCapture_Flushes() {
let sut = fixture.getSut(dispatchQueueWrapper: SentryDispatchQueueWrapper())

SentryLog.withOutLogs {
SentryLog.withoutLogs {

for _ in 0..<10 {
sut.send(envelope: fixture.eventEnvelope)
Expand All @@ -903,7 +903,7 @@ class SentryHttpTransportTests: XCTestCase {
}

func testFlush_CalledMultipleTimes_ImmediatelyReturnsFalse() {
SentryLog.withOutLogs {
SentryLog.withoutLogs {

givenCachedEvents(amount: 30)

Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryTests/SentrySDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ class SentrySDKTests: XCTestCase {
class SentrySDKWithSetupTests: XCTestCase {

func testAccessingHubAndOptions_NoDeadlock() {
SentryLog.withOutLogs {
SentryLog.withoutLogs {

let concurrentQueue = DispatchQueue(label: "concurrent", attributes: .concurrent)

Expand Down
6 changes: 3 additions & 3 deletions Tests/SentryTests/Transaction/SentryTracerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class SentryTracerTests: XCTestCase {
/// to a crash when spans keep finishing while finishInternal is executed because
/// shouldIgnoreWaitForChildrenCallback could be then nil in hasUnfinishedChildSpansToWaitFor.
func testFinish_ShouldIgnoreWaitForChildrenCallback_DoesNotCrash() throws {
SentryLog.withOutLogs {
SentryLog.withoutLogs {
for _ in 0..<5 {
let sut = fixture.getSut()

Expand Down Expand Up @@ -1108,7 +1108,7 @@ class SentryTracerTests: XCTestCase {
}

func testFinishAsync() throws {
try SentryLog.withOutLogs {
try SentryLog.withoutLogs {
let sut = fixture.getSut()
let child = sut.startChild(operation: fixture.transactionOperation)
sut.finish()
Expand Down Expand Up @@ -1179,7 +1179,7 @@ class SentryTracerTests: XCTestCase {
#endif // os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

func testAddingSpansOnDifferentThread_WhileFinishing_DoesNotCrash() throws {
try SentryLog.withOutLogs {
try SentryLog.withoutLogs {

let sut = fixture.getSut(waitForChildren: false)

Expand Down
24 changes: 19 additions & 5 deletions scripts/check-tooling-versions.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/usr/bin/env bash

REMOTE_CLANG_FORMAT_VERSION=$(cat scripts/.clang-format-version)
REMOTE_SWIFTLINT_VERSION=$(cat scripts/.swiftlint-version)
LOCAL_CLANG_FORMAT_VERSION=$(clang-format --version | awk '{print $3}')

REMOTE_SWIFTLINT_VERSION=$(cat scripts/.swiftlint-version)
LOCAL_SWIFTLINT_VERSION=$(swiftlint version)
RESOLUTION_MESSAGE="Please run \`make init\` to update your local dev tools. This may actually upgrade to a newer version than what is currently recorded in the lockfile; if that happens, please commit the update to the lockfile as well."

RESOLUTION_MESSAGE="Please run \`make init\` to update your local dev tools. This may actually upgrade to a newer version than what is currently recorded in repo; if that happens, please commit the update to the any lockfiles etc as well."

SENTRY_TOOLING_UP_TO_DATE=true

if [ "${LOCAL_CLANG_FORMAT_VERSION}" != "${REMOTE_CLANG_FORMAT_VERSION}" ]; then
echo "clang-format version mismatch, expected: ${REMOTE_CLANG_FORMAT_VERSION}, but found: ${LOCAL_CLANG_FORMAT_VERSION}. ${RESOLUTION_MESSAGE}"
exit 1
echo "clang-format version mismatch, expected: ${REMOTE_CLANG_FORMAT_VERSION}, but found: ${LOCAL_CLANG_FORMAT_VERSION}"
SENTRY_TOOLING_UP_TO_DATE=false
fi

if [ "${LOCAL_SWIFTLINT_VERSION}" != "${REMOTE_SWIFTLINT_VERSION}" ]; then
echo "swiftlint version mismatch, expected: ${REMOTE_SWIFTLINT_VERSION}, but found: ${LOCAL_SWIFTLINT_VERSION}. ${RESOLUTION_MESSAGE}"
echo "swiftlint version mismatch, expected: ${REMOTE_SWIFTLINT_VERSION}, but found: ${LOCAL_SWIFTLINT_VERSION}"
SENTRY_TOOLING_UP_TO_DATE=false
fi

if ! rbenv version 2>/dev/null; then
rbenv versions
SENTRY_TOOLING_UP_TO_DATE=false
fi

if [ $SENTRY_TOOLING_UP_TO_DATE == false ]; then
echo "${RESOLUTION_MESSAGE}"
exit 1
fi

0 comments on commit 0fdaa81

Please sign in to comment.