feat(cli): add --ios-device flag and IosDevice option

This commit is contained in:
pj committed 2026-04-23 15:06:08 +07:00
1 parent 0ffe9f0a25
commit 4c21f4722a
2 files changed
+19 -16

No files matched your search

+11 -9
View File
@@ -15,13 +15,14 @@ import (
var Version = "dev" var Version = "dev"
type testOptions struct { type testOptions struct {
spec string spec string
bundleID string bundleID string
platform string platform string
avd string avd string
duration time.Duration iosDevice string
seed int64 duration time.Duration
output string seed int64
output string
} }
const topUsage = `sanderling is a property-based UI fuzzer for mobile apps. 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 var options testOptions
flagSet.StringVar(&options.spec, "spec", "", "path to the TypeScript spec (required)") 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.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.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.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)") flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces") 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 { switch options.platform {
case "android", "ios", "web": case "android", "ios", "web":
default: 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 return options, nil
} }
+8 -7
View File
@@ -9,12 +9,13 @@ import (
func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) error { func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) error {
return testrun.Execute(ctx, testrun.Options{ return testrun.Execute(ctx, testrun.Options{
Spec: options.spec, Spec: options.spec,
BundleID: options.bundleID, BundleID: options.bundleID,
Platform: options.platform, Platform: options.platform,
AVD: options.avd, AVD: options.avd,
Duration: options.duration, IosDevice: options.iosDevice,
Seed: options.seed, Duration: options.duration,
Output: options.output, Seed: options.seed,
Output: options.output,
}, stdout) }, stdout)
} }