Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS test builds #3415

Merged
merged 4 commits into from
Jan 24, 2025
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 config/Make.project.rules
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ endif

#
# We define a secondary target for component[platform-config]. This is necessary
# to allow dependencies to be used as prerequesties. For example, objects for
# to allow dependencies to be used as prerequisites. For example, objects for
# IceSSL[osx-shared] depend on Ice[osx-shared], see make-objects.
#
.PHONY: $5
Expand Down
114 changes: 112 additions & 2 deletions config/Make.rules.Darwin
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ iphoneos_configs = %static
iphoneos_targetdir = /iphoneos
# TODO: disable all install for this platform
iphoneos_installdir = /iphoneos
iphoneos_components = $(xcframeworks)
iphoneos_components = $(xcframeworks) $(iostest_components)
iphoneos_targetrule = $(iostest_targetrule)
iphoneos_excludes = $(iostest_excludes)

iphonesimulator_ar = libtool
iphonesimulator_cc = xcrun -sdk iphonesimulator clang
Expand All @@ -30,7 +32,9 @@ iphonesimulator_configs = %static
iphonesimulator_targetdir = /iphonesimulator
# TODO: disable all install for this platform
iphonesimulator_installdir = /iphonesimulator
iphonesimulator_components = $(xcframeworks)
iphonesimulator_components = $(xcframeworks) $(iostest_components)
iphonesimulator_targetrule = $(iostest_targetrule)
iphonesimulator_excludes = $(iostest_excludes)

ifneq ($(shell command -v brew 2> /dev/null),)
MCPP_HOME ?= $(shell brew --prefix mcpp)
Expand Down Expand Up @@ -113,3 +117,109 @@ icestormadmin[macosx]_system_libs := -ledit -lncurses
Glacier2CryptPermissionsVerifier[macosx]_system_libs := $(Ice[macosx]_system_libs)
Glacier2CryptPermissionsVerifier[iphoneos]_system_libs := $(Ice[iphoneos]_system_libs)
Glacier2CryptPermissionsVerifier[iphonesimulator]_system_libs := $(Ice[iphonesimulator]_system_libs)

is-iostest-program = $(and $(filter-out macosx,$2),$(filter test/%,$1))
iostest_targetrule = $(if $(is-iostest-program),iostest,)

iostest_components = TestCommon \
test/Ice/% \
test/IceSSL/% \
test/IceDiscovery/% \
test/IceLocatorDiscovery/%

iostest_excludes = $(addprefix test/Ice/,\
background \
faultTolerance \
gc \
logger \
properties \
services \
stringConverter \
threadPoolPriority)

#
# Rule to build an iOS bundle for testing (this is used for packaging client/server programs)
#
define make-iostest-program
$2/$1.bundle/Info.plist:
$(Q)if [ ! -f $2/$1.bundle/Info.plist ] ; \
then \
$(MKDIR) -p $2/$1.bundle ; \
sed "s/NAME/$1/" test/ios/bundles/BundleInfo.plist > $2/$1.bundle/Info.plist ; \
fi

$2/$1.bundle/$1.dylib: $5 $2/$1.bundle/Info.plist $(foreach d,$6,$($d_targets))
$(E) "Linking [$8-$9] $$@"
$(Q)$(RM) $2/$1.bundle/$1.dylib
$(Q)$(or $($8_cxx),$(platform_cxx)) -bundle $(LDFLAGS) -o $2/$1.bundle/$1.dylib $5 $(strip $7)
endef

get-iostest-program-targets = $2/$1.bundle/$1.dylib $2/$1.bundle/Info.plist

## Xcode projects

#
# $(call make-xcode-project-with-config,$1=project,$2=platform,$3=config)
#
define make-xcode-project-with-config

$1/.translator-$2-$3.dep: $$($$($1_slicecompiler)_path)
$(Q)if [ -f $1/.translator-$2-$3.dep ]; \
then \
xcodebuild -sdk $2 \
-project "$1/$$(call $1_project,$2,$3)" \
-configuration "$$(call $1_configuration,$2,$3)" \
-scheme "$$(call $1_scheme,$2,$3)" \
$(if $(V),,-quiet) \
clean; \
fi
touch $1/.translator-$2-$3.dep

$1[$2-$3]: $$($1_dependencies) $1/.translator-$2-$3.dep
$(E) "Running xcodebuild for $1 scheme=\"$$(call $1_scheme,$2,$3)\""
$(Q)xcodebuild -sdk $2 \
-project "$1/$$(call $1_project,$2,$3)" \
-configuration "$$(call $1_configuration,$2,$3)" \
-scheme "$$(call $1_scheme,$2,$3)" \
$(if $(ICE_BIN_DIST),HEADER_SEARCH_PATHS=../../Ice\ ../../include\ $(sdkdir)/$2.sdk/usr/include \
LIBRARY_SEARCH_PATHS=$(sdkdir)/$2.sdk/usr/lib) \
$(if $(V),,-quiet) \
$(if $(PLATFORM_NAME),iphonesimulator,-arch `uname -m`) \
build

$1[$2-$3]_clean:
$(E) "Cleaning $1"
$(Q)xcodebuild -sdk $2 \
-project "$1/$$(call $1_project,$2,$3)" \
-configuration "$$(call $1_configuration,$2,$3)" \
-scheme "$$(call $1_scheme,$2,$3)" \
$(if $(V),,-quiet) \
clean

$1:: $1[$2-$3]
$1_clean:: $1[$2-$3]_clean

endef

#
# $(call make-xcode-project,$1=project)
#
define make-xcode-project

#
# Define per-<platform-config> rules for this component.
#
$$(foreach p,$$(filter $(platforms),$$($1_platforms)),\
$$(foreach c,$$(filter $$(or $$($$p_configs),%),$$(filter $(configs),$$($1_configs))),\
$$(if $$(filter $(SKIP),$1[$$p-$$c]),,\
$$(eval $$(call make-xcode-project-with-config,$1,$$p,$$c,$1[$$p-$$c])))))

$1::
$1_clean::
$1_distclean::
$(Q)$(RM) -r $1/build

all:: $1
clean:: $1_clean
distclean:: $1_distclean
endef
109 changes: 0 additions & 109 deletions config/Make.xcodesdk.rules

This file was deleted.

5 changes: 2 additions & 3 deletions cpp/config/Make.rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ default-configs = shared

-include $(lang_srcdir)/config/Make.rules.$(os)
ifeq ($(os),Darwin)
include $(lang_srcdir)/config/Make.xcodesdk.rules
include $(lang_srcdir)/config/Make.xcframework.rules
endif

Expand Down Expand Up @@ -110,8 +109,8 @@ $1[static]_cppflags += -DICE_STATIC_LIBS $(if $(IceBT_system_libs),-DICE_HAS
$1[static]_dependencies := $(if $(IceBT_system_libs),IceBT)

# Dependencies and target dirs for Xcode SDK test projects
$1[iphoneos-xcodesdk]_targetdir := test/ios/bundles/Bundles-iphoneos/$(subst /,_,$1)
$1[iphonesimulator-xcodesdk]_targetdir := test/ios/bundles/Bundles-iphonesimulator/$(subst /,_,$1)
$1[iphoneos-static]_targetdir := test/ios/bundles/Bundles-iphoneos/$(subst /,_,$1)
$1[iphonesimulator-static]_targetdir := test/ios/bundles/Bundles-iphonesimulator/$(subst /,_,$1)

$(create-test-project)
endef
Expand Down
80 changes: 0 additions & 80 deletions cpp/config/Make.xcodesdk.rules

This file was deleted.

16 changes: 13 additions & 3 deletions cpp/test/Ice/info/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace
return nullptr;
}

#if TARGET_OS_IPHONE == 0
// IceSSL on iOS does not support getSubjectNameQ
void checkPeerCertificateSubjectName(string subjectName)
{
test(subjectName.find("CN=127.0.0.1") != string::npos);
Expand All @@ -48,6 +50,7 @@ namespace
test(subjectName.find("C=US") != string::npos);
test(subjectName.find("[email protected]") != string::npos);
}
#endif
}

void
Expand Down Expand Up @@ -248,9 +251,13 @@ allTests(Test::TestHelper* helper)

if (testIntf->ice_getConnection()->type() == "wss")
{
auto wssinfo = dynamic_pointer_cast<Ice::SSL::ConnectionInfo>(wsinfo->underlying);
test(wssinfo->peerCertificate);
checkPeerCertificateSubjectName(Ice::SSL::getSubjectName(wssinfo->peerCertificate));
auto sslinfo = dynamic_pointer_cast<Ice::SSL::ConnectionInfo>(wsinfo->underlying);
test(sslinfo);
test(sslinfo->peerCertificate);
#if TARGET_OS_IPHONE == 0
// IceSSL on iOS does not support getSubjectName
checkPeerCertificateSubjectName(Ice::SSL::getSubjectName(sslinfo->peerCertificate));
#endif
}

test(headers["Upgrade"] == "websocket");
Expand All @@ -269,7 +276,10 @@ allTests(Test::TestHelper* helper)
auto sslinfo = dynamic_pointer_cast<Ice::SSL::ConnectionInfo>(connection->getInfo());
test(sslinfo);
test(sslinfo->peerCertificate);
#if TARGET_OS_IPHONE == 0
// IceSSL on iOS does not support getSubjectName
checkPeerCertificateSubjectName(Ice::SSL::getSubjectName(sslinfo->peerCertificate));
#endif
}

connection = testIntf->ice_datagram()->ice_getConnection();
Expand Down
Loading
Loading