Files
sx/examples/1616-platform-ios-device-bundle.sx
agra 4e942b5373 test: migrate examples to XXXX-category-name layout + split expected streams
Rename all example tests/companions to the XXXX-category-test-name scheme
(per-category 100-blocks: basic 0010, types 0100, ... errors 1000,
diagnostics 1100, ffi 1200, ffi-objc 1300, ffi-jni 1400, vectors 1500,
platform 1600). Companions and dir/C fixtures move in lockstep with their
parent test; #import/#source/#include paths rewritten to match.

Expected output now lives in examples/expected/ (a sibling dir of the
tests) split into three streams per the new convention:
  <name>.exit / <name>.stdout / <name>.stderr  (+ optional <name>.ir)

run_examples.sh rewritten: scans examples/ and issues/ for an
expected/<name>.exit marker, captures stdout and stderr separately (no
more 2>&1), compares each stream + exit + optional IR snapshot.

Behavior validated unchanged: every renamed test reproduces its prior
merged output + exit (diffs limited to file paths/basenames embedded in
diagnostics + traces, which correctly reflect the new names). Suite:
292 passed, 0 failed. 50-smoke.sx split + issue relocation + docs follow
in subsequent commits.
2026-06-01 19:05:15 +03:00

55 lines
2.3 KiB
Plaintext

// iOS *device* end-to-end exercise for `platform.bundle`. Distinct from
// 121-ios-sim-bundle.sx because the device path adds three steps that
// don't run on the simulator: provisioning profile embed, entitlements
// extraction (`security cms` + `plutil` pipeline resolving the
// wildcard `<TEAM>.*` → `<TEAM>.<bundle_id>`), and codesign with
// `--entitlements`.
//
// Build:
// sx build --target ios examples/122-ios-device-bundle.sx -o /tmp/SxDeviceProbe
//
// Install + launch (requires the device UDID to be on the profile):
// xcrun devicectl device install app --device <name> /tmp/SxDeviceProbe.app
// xcrun devicectl device process launch --device <name> co.swipelab.sxprobe
//
// The bundle id (`co.swipelab.sxprobe`) and codesign identity below
// match the test team's wildcard `SwipeS32DevProfile.mobileprovision`.
// Update the three set_* values to your own identity / profile / id to
// re-exercise on a different developer account.
#import "modules/std.sx";
#import "modules/std/uikit.sx";
#import "modules/compiler.sx";
#import "modules/platform/bundle.sx";
configure :: () {
opts := build_options();
opts.set_bundle_path("/tmp/SxDeviceProbe.app");
opts.set_bundle_id("co.swipelab.sxprobe");
opts.set_codesign_identity("Apple Development: Alexandru Agrapine (DC8VVHJ9W4)");
opts.set_provisioning_profile("/Users/agra/Downloads/SwipeS32DevProfile.mobileprovision");
opts.set_post_link_callback(bundle_main);
}
#run configure();
// IMP for application:didFinishLaunchingWithOptions:
// Obj-C: -(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts
// Type encoding: "c@:@@" -- BOOL (signed char), self, _cmd, id, id
did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u8 callconv(.c) {
NSLog(ns_string("[sx-device-probe] launched\n".ptr));
return 1; // YES
}
main :: () -> s32 {
UIResponder := objc_getClass("UIResponder".ptr);
SxAppDelegate := objc_allocateClassPair(UIResponder, "SxAppDelegate".ptr, 0);
sel := sel_registerName("application:didFinishLaunchingWithOptions:".ptr);
class_addMethod(SxAppDelegate, sel, xx did_finish_launching, "c@:@@".ptr);
objc_registerClassPair(SxAppDelegate);
// UIApplicationMain blocks driving iOS's run loop.
return UIApplicationMain(0, xx 0, xx 0, ns_string("SxAppDelegate".ptr));
}