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

iOS test builds #3415

merged 4 commits into from
Jan 24, 2025

Conversation

pepone
Copy link
Member

@pepone pepone commented Jan 23, 2025

Managed to get C++ iOS back to build with this PR, but all tests hang, not clear why.

-- EDIT 1 --

Tests are running with the simulator, didn't check a device.

We don't directly test the XCFramework but we build against the static libraries used to created it.

I think it is good enough for Fix #3119

@pepone pepone requested a review from externl January 23, 2025 18:09
Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

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

Looks good!

@pepone pepone marked this pull request as ready for review January 24, 2025 11:50
@@ -308,7 +308,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#\n# We don't use a CopyFile build phase here to copy the test bundles because the test\n# bundles are located in different location depending on the platform. This script\n# copies the bundles if updated and sign them.\n#\n\nset -e\n\nFRAMEWORKS_PATH=\"${TARGET_BUILD_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncd \"../bundles/Bundles-${PLATFORM_NAME}\"\nif [ ! -d \"$FRAMEWORKS_PATH\" ]; then\nmkdir -p \"$FRAMEWORKS_PATH\"\nfi;\nfor i in `ls -d */*.bundle`;\n do\n if [ ! -d \"$FRAMEWORKS_PATH/$i\" -o \"$i\" -nt \"$FRAMEWORKS_PATH/$i\" ]; then\n echo \"Copying $i\"\n mkdir -p \"$FRAMEWORKS_PATH/$(dirname $i)\"\n cp -rf $i \"$FRAMEWORKS_PATH/$(dirname $i)\"\n if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY_NAME}\" ]; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY}\" --preserve-metadata=identifier,entitlements \"${FRAMEWORKS_PATH}/$i\"\n fi;\n fi;\n done\n \n";
shellScript = "# We don't use a CopyFile build phase here to copy the test bundles because the test bundles are located in different\n# location depending on the platform. This script copies the bundles if updated and sign them.\n\nset -e\n\nFRAMEWORKS_PATH=\"${TARGET_BUILD_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncd \"../bundles/Bundles-${PLATFORM_NAME}\"\n\nif [ ! -d \"$FRAMEWORKS_PATH\" ]; then\n mkdir -p \"$FRAMEWORKS_PATH\"\nfi;\n\nfor i in `find . -name \"*.bundle\"`;\ndo\n # ./test_Ice_defaultValue/iphonesimulator/client.bundle -> test_Ice_defaultValue\n testsuite=$(basename $(dirname $(dirname $i)))\n # ./test_Ice_defaultValue/iphonesimulator/client.bundle -> client.bundle\n bundle=$(basename $i)\n\n bundle_target_path=\"${FRAMEWORKS_PATH}/${testsuite}/${bundle}\"\n\n if [ ! -d \"$bundle_target_path\" -o \"$i\" -nt \"$bundle_target_path\" ]; then\n echo \"Copying $i -> $bundle_target_path\"\n mkdir -p \"$bundle_target_path\"\n cp -rf $i/* \"${bundle_target_path}\"\n if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY_NAME}\" ]; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY}\" --preserve-metadata=identifier,entitlements \"${bundle_target_path}\"\n fi;\n fi;\ndone\n";
Copy link
Member Author

Choose a reason for hiding this comment

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

We have this script to copy and sign the bundles, the old version was not working...

Inlined the new version here for easy review.

# We don't use a CopyFile build phase here to copy the test bundles because the test bundles are located in different
# location depending on the platform. This script copies the bundles if updated and sign them.

set -e

FRAMEWORKS_PATH="${TARGET_BUILD_DIR}"/"${FRAMEWORKS_FOLDER_PATH}"
cd "../bundles/Bundles-${PLATFORM_NAME}"

if [ ! -d "$FRAMEWORKS_PATH" ]; then
    mkdir -p "$FRAMEWORKS_PATH"
fi;

for i in `find . -name "*.bundle"`;
do
    # ./test_Ice_defaultValue/iphonesimulator/client.bundle -> test_Ice_defaultValue
    testsuite=$(basename $(dirname $(dirname $i)))
    # ./test_Ice_defaultValue/iphonesimulator/client.bundle -> client.bundle
    bundle=$(basename $i)

    bundle_target_path="${FRAMEWORKS_PATH}/${testsuite}/${bundle}"

    if [ ! -d "$bundle_target_path" -o "$i" -nt "$bundle_target_path" ]; then
        echo "Copying $i -> $bundle_target_path"
        mkdir -p "$bundle_target_path"
        cp -rf $i/* "${bundle_target_path}"
        if [ -n "${EXPANDED_CODE_SIGN_IDENTITY_NAME}" ]; then
            codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements "${bundle_target_path}"
        fi;
    fi;
done

);
INFOPLIST_FILE = Bundle/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
LIBRARY_SEARCH_PATHS = "../../../../sdk/$(PLATFORM_NAME).sdk/usr/lib";
LIBRARY_SEARCH_PATHS = "../../../lib/$(PLATFORM_NAME)";
Copy link
Member Author

Choose a reason for hiding this comment

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

we link directly with the static libraries from lib/iphoneos or lib/iphonesimulator.

MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_LDFLAGS = (
"-L../../Common/build/$(PLATFORM_NAME)/xcodesdk",
"-L../../Common/build/$(PLATFORM_NAME)/static",
Copy link
Member Author

Choose a reason for hiding this comment

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

for the test helper static library.

@@ -86,7 +86,7 @@ def getFilters(self, mapping, config):
"Ice/plugin",
"Ice/stringConverter",
"Ice/threadPoolPriority",
"Ice/udp",
Copy link
Member Author

Choose a reason for hiding this comment

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

Not clear why we excluded udp test, seems to work fine. We no longer build service libraries for iOS.

)
return os.path.join(
path, "{0}-{1}".format(build, current.config.buildPlatform), appName
cmd = "xcodebuild -project 'test/ios/controller/C++ Test Controller.xcodeproj' \
Copy link
Member Author

Choose a reason for hiding this comment

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

This is similar to what we do in Swift, the previous version relied on build dir being within the project dir.

-arch arm64 \
-showBuildSettings \
".format(
"Release" if os.environ.get("OPTIMIZE", "yes") != "no" else "Debug",
Copy link
Member Author

Choose a reason for hiding this comment

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

This means you have to use the same OPTIMIZE env value for build and run allTests.py, I don't see a better way to do it. For C++ builds there is no separate release/debug configurations.

@pepone pepone requested a review from externl January 24, 2025 12:02
@pepone pepone merged commit 16febee into zeroc-ice:main Jan 24, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix C++ xcframework testing
2 participants