|
1 | 1 | #!/bin/bash -ex
|
2 | 2 | #
|
3 |
| -# Copyright (C) 2021 HERE Europe B.V. |
| 3 | +# Copyright (C) 2021-2024 HERE Europe B.V. |
4 | 4 | #
|
5 | 5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 6 | # you may not use this file except in compliance with the License.
|
@@ -97,37 +97,45 @@ xcrun simctl list
|
97 | 97 | xcrun simctl list devices
|
98 | 98 | xcrun simctl list runtimes
|
99 | 99 |
|
100 |
| -export CurrentDeviceUDID=$(xcrun simctl list devices | grep "iPhone 11 (" | grep -v "unavailable" | grep -v "com.apple.CoreSimulator.SimDeviceType" | cut -d'(' -f2 | cut -d')' -f1 | head -1) |
| 100 | +export CurrentDeviceUDID=$(xcrun simctl list devices | grep "iPhone 14 (" | grep -v "unavailable" | grep -v "com.apple.CoreSimulator.SimDeviceType" | cut -d'(' -f2 | cut -d')' -f1 | head -1) |
101 | 101 |
|
102 | 102 | # Create new Simulator device
|
103 | 103 |
|
104 |
| -xcrun simctl list devices | grep "iPhone 11" |
105 |
| -xcrun simctl boot "iPhone 11" || true |
106 |
| -xcrun simctl list devices | grep "iPhone 11" |
107 |
| -xcrun simctl create ${GITHUB_RUN_ID}_iphone11 "com.apple.CoreSimulator.SimDeviceType.iPhone-11" |
108 |
| -xcrun simctl list devices | grep "iPhone 11" |
| 104 | +xcrun simctl list devices | grep ${CurrentDeviceUDID} |
| 105 | +xcrun simctl boot ${CurrentDeviceUDID} || true |
| 106 | +xcrun simctl list devices | grep ${CurrentDeviceUDID} |
| 107 | +xcrun simctl create ${GITHUB_RUN_ID}_iphone14 "com.apple.CoreSimulator.SimDeviceType.iPhone-14" |
| 108 | +xcrun simctl list devices | grep ${CurrentDeviceUDID} |
109 | 109 | echo "Simulator created"
|
110 | 110 |
|
111 |
| -#/Applications/Xcode_11.2.1.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$! || /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$! |
112 |
| -#echo "Simulator started device" |
| 111 | +/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$! || /Applications/Xcode_15.0.1.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$! |
| 112 | +echo "Simulator started device" |
113 | 113 | #
|
114 |
| -#xcrun simctl logverbose enable |
115 |
| -#xcrun simctl install ${CurrentDeviceUDID} ./build/tests/functional/network/ios/olp-cpp-sdk-functional-network-tests-tester/Debug-iphonesimulator/olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester.app |
116 |
| -#echo "App installed" |
117 |
| -#xcrun simctl launch ${CurrentDeviceUDID} com.here.olp.olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester |
118 |
| -# Need to find out how to parse `xcrun simctl spawn booted log stream` and catch finish of test-run. Otherwise it goes to infinite loop. |
119 |
| -# xcrun simctl spawn booted log stream | grep "olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester:" | tee app.log |
120 |
| -#result=$? |
121 |
| -#echo "App launched" |
122 |
| -#xcrun simctl shutdown ${CurrentDeviceUDID} |
123 |
| -#echo "Simulator shutdown done" |
124 |
| - |
125 |
| -#echo ">>> Finished network tests >>>" |
| 114 | +xcrun simctl logverbose enable |
| 115 | +xcrun simctl install ${CurrentDeviceUDID} ./build/tests/functional/network/ios/olp-cpp-sdk-functional-network-tests-tester/Debug-iphonesimulator/olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester.app |
| 116 | +echo "App installed" |
| 117 | +xcrun simctl launch ${CurrentDeviceUDID} com.here.olp.olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester |
| 118 | +# TODO: Need to find out how to parse `xcrun simctl spawn booted log stream` and catch finish of test-run. Otherwise it goes to infinite loop. |
| 119 | +#xcrun simctl spawn booted log stream | grep "olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester:" |
| 120 | +# TODO: Need to find out how to fix issue with Mock Server: OLPEDGE-2543 |
| 121 | +xcrun simctl spawn booted log stream | grep "error" & |
| 122 | +# collect log data |
| 123 | +xcrun simctl spawn booted log collect |
| 124 | +# open location |
| 125 | +cd `xcrun simctl getenv booted SIMULATOR_SHARED_RESOURCES_DIRECTORY` |
| 126 | +ls -la /Users/runner/Library/Logs/CoreSimulator/AC3F6347-30F3-40CA-948A-58390550C1D1/system_logs.logarchive || true |
| 127 | +tail /Users/runner/Library/Logs/CoreSimulator/AC3F6347-30F3-40CA-948A-58390550C1D1/system_logs.logarchive || true |
| 128 | +result=$? |
| 129 | +echo "App launched" |
| 130 | +xcrun simctl shutdown ${CurrentDeviceUDID} |
| 131 | +echo "Simulator shutdown done" |
| 132 | + |
| 133 | +echo ">>> Finished network tests >>>" |
126 | 134 |
|
127 | 135 | # Terminate the mock server
|
128 |
| -#kill -TERM $SERVER_PID || true |
129 |
| -#kill -TERM $SIMULATOR_PID || true |
| 136 | +kill -TERM $SERVER_PID || true |
| 137 | +kill -TERM $SIMULATOR_PID || true |
130 | 138 |
|
131 | 139 | #wait
|
132 | 140 |
|
133 |
| -#exit ${result} |
| 141 | +exit ${result} |
0 commit comments