diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 13:36:51 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 13:36:51 +0200 |
| commit | ef12ce837176bd21deb455eb50a6c839af02b510 (patch) | |
| tree | c262ceeda0b419236a4b0b1826df8eb5e418b852 /internal/flags | |
| parent | 10c5d48413afaef88626419d8c4bf9fbf6f1c902 (diff) | |
Add live flamegraph test modes and dynamic synthetic live feed
Diffstat (limited to 'internal/flags')
| -rw-r--r-- | internal/flags/flags.go | 4 | ||||
| -rw-r--r-- | internal/flags/flags_test.go | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go index bd21768..0df1d2d 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -58,6 +58,8 @@ type Flags struct { PlainMode bool FlamegraphEnable bool LiveFlamegraph bool + TestFlames bool + TestLiveFlames bool LiveInterval time.Duration OpenCommand string FlamegraphName string @@ -184,6 +186,8 @@ func parse() error { flag.BoolVar(&cfg.PlainMode, "plain", false, "Enable plain CSV output mode (disable TUI)") flag.BoolVar(&cfg.FlamegraphEnable, "flamegraph", false, "Enable flamegraph builder") flag.BoolVar(&cfg.LiveFlamegraph, "live", false, "Enable live flamegraph mode") + flag.BoolVar(&cfg.TestFlames, "testflames", false, "Run TUI with static synthetic flamegraph data for keyboard-navigation testing") + flag.BoolVar(&cfg.TestLiveFlames, "testliveflames", false, "Run TUI with continuously-updating synthetic flamegraph data for live keyboard-navigation testing") flag.DurationVar(&cfg.LiveInterval, "live-interval", cfg.LiveInterval, "Live flamegraph refresh interval") flag.StringVar(&cfg.OpenCommand, "open", "", "Command to open live flamegraph URL (used with -live); use {url} placeholder or URL is appended") flag.StringVar(&cfg.FlamegraphName, "name", cfg.FlamegraphName, "Name of the flamegraph, used to generate the SVG file") diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go index 3534916..63b668c 100644 --- a/internal/flags/flags_test.go +++ b/internal/flags/flags_test.go @@ -127,6 +127,26 @@ func TestParseIorWatchIntervalFlag(t *testing.T) { } } +func TestParseTestFlamesFlag(t *testing.T) { + cfg, err := parseForTest(t, "--testflames") + if err != nil { + t.Fatalf("parse returned error: %v", err) + } + if !cfg.TestFlames { + t.Fatalf("expected --testflames to enable static flamegraph test mode") + } +} + +func TestParseTestLiveFlamesFlag(t *testing.T) { + cfg, err := parseForTest(t, "--testliveflames") + if err != nil { + t.Fatalf("parse returned error: %v", err) + } + if !cfg.TestLiveFlames { + t.Fatalf("expected --testliveflames to enable synthetic live flamegraph test mode") + } +} + func TestParseDefaultCollapsedFieldsOrder(t *testing.T) { cfg, err := parseForTest(t) if err != nil { |
