From 4c21f4722aa5aeec43a05919ab9eb128e6b84769 Mon Sep 17 00:00:00 2001 From: PJ Date: Thu, 23 Apr 2026 15:06:08 +0700 Subject: [PATCH] feat(cli): add --ios-device flag and IosDevice option --- cmd/sanderling/main.go | 20 +++++++++++--------- cmd/sanderling/test_run.go | 15 ++++++++------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/cmd/sanderling/main.go b/cmd/sanderling/main.go index 7211769..aafc828 100644 --- a/cmd/sanderling/main.go +++ b/cmd/sanderling/main.go @@ -15,13 +15,14 @@ import ( var Version = "dev" type testOptions struct { - spec string - bundleID string - platform string - avd string - duration time.Duration - seed int64 - output string + spec string + bundleID string + platform string + avd string + iosDevice string + duration time.Duration + seed int64 + output string } const topUsage = `sanderling is a property-based UI fuzzer for mobile apps. @@ -44,8 +45,9 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) { var options testOptions flagSet.StringVar(&options.spec, "spec", "", "path to the TypeScript spec (required)") flagSet.StringVar(&options.bundleID, "bundle-id", "", "target app bundle ID (required)") - flagSet.StringVar(&options.platform, "platform", "android", "target platform: android, web") + flagSet.StringVar(&options.platform, "platform", "android", "target platform: android, ios, web") flagSet.StringVar(&options.avd, "avd", "", "Android AVD name to boot if no device is connected") + flagSet.StringVar(&options.iosDevice, "ios-device", "", "iOS simulator name or UDID to boot if none is running") flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration") flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)") flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces") @@ -61,7 +63,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) { switch options.platform { case "android", "ios", "web": default: - return testOptions{}, fmt.Errorf("unsupported platform: %q (android, web)", options.platform) + return testOptions{}, fmt.Errorf("unsupported platform: %q (android, ios, web)", options.platform) } return options, nil } diff --git a/cmd/sanderling/test_run.go b/cmd/sanderling/test_run.go index 2d826d9..a3ffe1c 100644 --- a/cmd/sanderling/test_run.go +++ b/cmd/sanderling/test_run.go @@ -9,12 +9,13 @@ import ( func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) error { return testrun.Execute(ctx, testrun.Options{ - Spec: options.spec, - BundleID: options.bundleID, - Platform: options.platform, - AVD: options.avd, - Duration: options.duration, - Seed: options.seed, - Output: options.output, + Spec: options.spec, + BundleID: options.bundleID, + Platform: options.platform, + AVD: options.avd, + IosDevice: options.iosDevice, + Duration: options.duration, + Seed: options.seed, + Output: options.output, }, stdout) }