Skip to content

Commit fa12e6a

Browse files
committed
Fix
1 parent 8fb6f11 commit fa12e6a

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

.pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ stages:
847847
- script: |
848848
set -e
849849
850-
SIMULATOR_DEVICE_INFO=$(python ./tools/ios/get_simulator_device_info.py)
850+
SIMULATOR_DEVICE_INFO=$(python ./tools/ios/get_simulator_device_info.py --requested-runtime-version 18.2)
851851
852852
echo "Simulator device info:"
853853
echo "${SIMULATOR_DEVICE_INFO}"

.pipelines/templates/use-xcode-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
parameters:
44
- name: xcodeVersion
55
type: string
6-
default: "16.1"
6+
default: "16.2"
77

88
steps:
99
- bash: |

test/pp_api_test/test_imgcodec.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEST(ImageDecoderTest, TestJpegEncoderDecoder) {
112112

113113
out_range = out_tensor.Data() + 438 * width * 3;
114114
ASSERT_EQ(std::vector<uint8_t>(out_range, out_range + 12),
115-
std::vector<uint8_t>({84, 68, 53, 86, 70, 55, 92, 76, 59, 101, 86, 65}));
115+
std::vector<uint8_t>({84, 68, 53, 86, 70, 55, 92, 77, 58, 101, 86, 67}));
116116

117117
out_range = out_tensor.Data() + 875 * width * 3 + 1296 * 3;
118118
ASSERT_EQ(std::vector<uint8_t>(out_range, out_range + 12),

tools/ci_build/github/azure-pipeline/templates/use-xcode-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
parameters:
44
- name: xcodeVersion
55
type: string
6-
default: "16.1"
6+
default: "16.2"
77

88
steps:
99
- bash: |

tools/ios/get_simulator_device_info.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import functools
99
import itertools
1010
import json
11+
import os
1112
import subprocess
1213

1314

@@ -37,20 +38,21 @@ def __lt__(self, other: Version) -> bool:
3738
def get_simulator_device_info(
3839
requested_runtime_platform: str = "iOS",
3940
requested_device_type_product_family: str = "iPhone",
40-
max_runtime_version_str: str | None = None,
41+
requested_runtime_version_str: str | None = None,
4142
) -> dict[str, str]:
4243
"""
4344
Retrieves simulator device information from Xcode.
4445
This simulator device should be appropriate for running tests on this machine.
4546
4647
:param requested_runtime_platform: The runtime platform to select.
4748
:param requested_device_type_product_family: The device type product family to select.
48-
:param max_runtime_version_str: The maximum runtime version to allow.
49+
:param requested_runtime_version_str: The runtime version select. If unspecified, selects the latest one.
4950
5051
:return: A dictionary containing information about the selected simulator device.
5152
"""
52-
max_runtime_version = Version(max_runtime_version_str) if max_runtime_version_str is not None else None
53-
53+
requested_runtime_version = (
54+
Version(requested_runtime_version_str) if requested_runtime_version_str is not None else None
55+
)
5456
simctl_proc = subprocess.run(
5557
["xcrun", "simctl", "list", "--json", "--no-escape-slashes"],
5658
text=True,
@@ -73,7 +75,7 @@ def runtime_filter(runtime) -> bool:
7375
if runtime["platform"] != requested_runtime_platform:
7476
return False
7577

76-
if max_runtime_version is not None and Version(runtime["version"]) > max_runtime_version:
78+
if requested_runtime_version is not None and Version(runtime["version"]) != requested_runtime_version:
7779
return False
7880

7981
return True
@@ -108,6 +110,9 @@ def device_filter(device) -> bool:
108110
):
109111
runtime_id_and_device_pairs.extend((runtime_id, device) for device in filter(device_filter, device_list))
110112

113+
if len(runtime_id_and_device_pairs) == 0:
114+
raise ValueError("Failed to find requested simulator device info.")
115+
111116
# sort key - tuple of (runtime version, device type min runtime version)
112117
# the secondary device type min runtime version value is to treat more recent device types as greater
113118
def runtime_id_and_device_pair_key(runtime_id_and_device_pair):
@@ -137,15 +142,20 @@ def runtime_id_and_device_pair_key(runtime_id_and_device_pair):
137142

138143

139144
def main():
140-
parser = argparse.ArgumentParser(description="Gets simulator info from Xcode and prints it in JSON format.")
141-
_ = parser.parse_args() # no args yet
145+
requested_runtime_version_environment_variable_name = "ORT_GET_SIMULATOR_DEVICE_INFO_REQUESTED_RUNTIME_VERSION"
142146

143-
info = get_simulator_device_info(
144-
# The macOS-15 hosted agent image has iOS 17 which is currently in beta. Limit it to 16.4 for now.
145-
# See https://github.com/actions/runner-images/issues/8023
146-
# TODO Remove max_runtime_version limit.
147-
max_runtime_version_str="16.4",
147+
parser = argparse.ArgumentParser(description="Gets simulator info from Xcode and prints it in JSON format.")
148+
parser.add_argument(
149+
"--requested-runtime-version",
150+
default=os.environ.get(requested_runtime_version_environment_variable_name, None),
151+
help="The requested runtime version. "
152+
f"This may also be specified with the {requested_runtime_version_environment_variable_name} "
153+
"environment variable. The command line option takes precedence. "
154+
"An unspecified value means the latest available runtime version.",
148155
)
156+
args = parser.parse_args() # no args yet
157+
158+
info = get_simulator_device_info(requested_runtime_version_str=args.requested_runtime_version)
149159

150160
print(json.dumps(info, indent=2))
151161

0 commit comments

Comments
 (0)