From 5b7a71358cb61920d228695991aeda96d83134e1 Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 13 Jul 2026 07:07:06 +0530 Subject: [PATCH] feat(cmd): add --generator llm|seeded flag --- cmd/sanderling/main.go | 7 +++++++ cmd/sanderling/test_run.go | 1 + internal/testrun/testrun.go | 3 +++ 3 files changed, 11 insertions(+) diff --git a/cmd/sanderling/main.go b/cmd/sanderling/main.go index db63e4b..9ba778e 100644 --- a/cmd/sanderling/main.go +++ b/cmd/sanderling/main.go @@ -30,6 +30,7 @@ type testOptions struct { seed int64 output string clearData bool + generator string } const topUsage = `sanderling is a property-based UI fuzzer for mobile apps. @@ -62,6 +63,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) { flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)") flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces") flagSet.BoolVar(&options.clearData, "clear-data", true, "clear app data before launching so each run starts from a fresh install; pass --clear-data=false to resume prior state") + flagSet.StringVar(&options.generator, "generator", "seeded", "action generator: seeded (weighted random) or llm (model picks from the same candidate set; requires generator = llm() in the spec)") if err := flagSet.Parse(args); err != nil { return testOptions{}, err } @@ -76,6 +78,11 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) { default: return testOptions{}, fmt.Errorf("unsupported platform: %q (android, ios, web)", options.platform) } + switch options.generator { + case "seeded", "llm": + default: + return testOptions{}, fmt.Errorf("unsupported generator: %q (seeded, llm)", options.generator) + } return options, nil } diff --git a/cmd/sanderling/test_run.go b/cmd/sanderling/test_run.go index b1c4764..477392f 100644 --- a/cmd/sanderling/test_run.go +++ b/cmd/sanderling/test_run.go @@ -21,5 +21,6 @@ func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) Seed: options.seed, Output: options.output, ClearData: options.clearData, + Generator: options.generator, }, stdout) } diff --git a/internal/testrun/testrun.go b/internal/testrun/testrun.go index cda97a1..b214eb7 100644 --- a/internal/testrun/testrun.go +++ b/internal/testrun/testrun.go @@ -34,6 +34,8 @@ type Options struct { Seed int64 Output string ClearData bool + // Generator selects the action picker: "llm" or the default seeded picker. + Generator string // iosUDID, iosIsSimulator, and iosCoreDeviceID are filled by Execute after // resolving the iOS target, then read by buildDriver to choose the simulator @@ -166,6 +168,7 @@ func Execute(ctx context.Context, options Options, stdout io.Writer) error { Verifier: verifierInstance, TraceWriter: traceWriter, Logger: newProgressLogger(stdout), + Generator: options.Generator, }) terminateCtx, terminateCancel := context.WithTimeout(context.Background(), 5*time.Second)