Skip to content

Commit

Permalink
[release/8.0.1xx-xcode15.1] [devops] Attempt to fix simulator runtime…
Browse files Browse the repository at this point in the history
…s disappearing. (#20573)

Attempt to fix simulator runtimes disappearing by:

* Detaching all the currently loaded runtimes.
* Killing the simdiskimaged and CoreSimulatorService services.

Hopefully this will make the simdiskimaged service restart, and reload the
simulator runtimes.

Backport of #20559.

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
  • Loading branch information
rolfbjarne and dalexsoto committed May 20, 2024
1 parent af0b7b8 commit 77b469b
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions tools/devops/automation/scripts/bash/clean-simulator-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ IFS=$'\n\t'
xcrun simctl runtime list -j > simruntime.json
cat simruntime.json

grep -e '"identifier" : ' -e '"runtimeIdentifier" : ' simruntime.json | tr '\n' ' ' | sed -e 's/,//g' -e 's/"//g' -e 's/runtimeIdentifier : //g' -e $'s/identifier : /@/g' | tr '@' '\n' | awk NF | sed 's/^[[:blank:]]*//' > simruntime-lines.txt
cat simruntime-lines.txt
if grep -e '"identifier" : ' -e '"runtimeIdentifier" : ' simruntime.json | tr '\n' ' ' | sed -e 's/,//g' -e 's/"//g' -e 's/runtimeIdentifier : //g' -e $'s/identifier : /@/g' | tr '@' '\n' | awk NF | sed 's/^[[:blank:]]*//' > simruntime-lines.txt; then
cat simruntime-lines.txt
fi

sed -e 's/.*com.apple/com.apple/g' simruntime-lines.txt > simruntime-runtimes.txt
cat simruntime-runtimes.txt
if sed -e 's/.*com.apple/com.apple/g' simruntime-lines.txt > simruntime-runtimes.txt; then
cat simruntime-runtimes.txt
fi

sort simruntime-runtimes.txt | uniq -c | sort -n | sed 's/^[[:blank:]]*//' > simruntime-runtimes-by-count.txt
cat simruntime-runtimes-by-count.txt
if sort simruntime-runtimes.txt | uniq -c | sort -n | sed 's/^[[:blank:]]*//' > simruntime-runtimes-by-count.txt; then
cat simruntime-runtimes-by-count.txt
fi

grep -v '^1 ' simruntime-runtimes-by-count.txt | sed 's/^[0-9 ]*//' > simruntime-duplicated-runtimes.txt
cat simruntime-duplicated-runtimes.txt
if grep -v '^1 ' simruntime-runtimes-by-count.txt | sed 's/^[0-9 ]*//' > simruntime-duplicated-runtimes.txt; then
cat simruntime-duplicated-runtimes.txt
fi

while IFS= read -r simruntime
do
Expand All @@ -32,6 +36,20 @@ do
echo " deleted runtime $id"
fi
done
done < simruntime-duplicated-runtimes.txt

xcrun simctl runtime list -v
done < simruntime-duplicated-runtimes.txt || true

xcrun simctl runtime list -v || true
xcrun simctl runtime match list -v || true

# try to detach all simulator runtimes
for dir in /Library/Developer/CoreSimulator/Volumes/*; do
sudo diskutil eject "$dir" || true
done
# kill the com.apple.CoreSimulator.simdiskimaged service
sudo launchctl kill 9 system/com.apple.CoreSimulator.simdiskimaged || true
# kill the com.apple.CoreSimulator.CoreSimulatorService service
# it seems this service starts the simdiskimaged service if it's not running.
sudo pkill -9 com.apple.CoreSimulator.CoreSimulatorService || true
# the disk image service should now restart when needed, and reload the re-attach all the simulator runtimes.

xcrun simctl runtime match list -v

8 comments on commit 77b469b

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

📚 [CI Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 77b469b33abae3c3fee6a44b6e2840f46876fde0 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ API diff for current PR / commit

NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

.NET (No breaking changes)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 77b469b33abae3c3fee6a44b6e2840f46876fde0 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Tests timed out

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: simulator tests

1 tests crashed, 2 tests failed, 93 tests passed.

Failures

❌ xammac tests

🔥 Failed catastrophically on VSTS: simulator tests - xammac (no summary found).

Html Report (VSDrops) Download

❌ xcframework tests

2 tests failed, 2 tests passed.
  • xcframework-test/iOS Unified 64-bits - simulator/Debug [dotnet]: TimedOut
  • xcframework-test/tvOS - simulator/Debug [dotnet]: TimedOut

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ framework: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 4 tests passed. Html Report (VSDrops) Download
⚠️ install_source: No tests selected. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
⚠️ mac_binding_project: No tests selected. Html Report (VSDrops) Download
⚠️ mmp: No tests selected. Html Report (VSDrops) Download
⚠️ mononative: No tests selected. Html Report (VSDrops) Download
✅ monotouch: All 29 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
⚠️ mtouch: No tests selected. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 77b469b33abae3c3fee6a44b6e2840f46876fde0 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 95 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ framework: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 4 tests passed. Html Report (VSDrops) Download
⚠️ install_source: No tests selected. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
⚠️ mac_binding_project: No tests selected. Html Report (VSDrops) Download
⚠️ mmp: No tests selected. Html Report (VSDrops) Download
⚠️ mononative: No tests selected. Html Report (VSDrops) Download
✅ monotouch: All 29 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
⚠️ mtouch: No tests selected. Html Report (VSDrops) Download
⚠️ xammac: No tests selected. [attempt 2] Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 77b469b33abae3c3fee6a44b6e2840f46876fde0 [CI build]

Please sign in to comment.