From 80037a48d90d43eec0544beb6fbc154be7b7f701 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 5 Oct 2024 23:26:39 +0000 Subject: [PATCH] feat: parameters to specify kernel/distro for test --- cmd/pew.go | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/cmd/pew.go b/cmd/pew.go index a16c945..1aaa492 100644 --- a/cmd/pew.go +++ b/cmd/pew.go @@ -64,7 +64,6 @@ func successRate(state runstate) float64 { type PewCmd struct { Max int64 `help:"test no more than X kernels" default:"100500"` Runs int64 `help:"runs per each kernel" default:"1"` - Kernel string `help:"override kernel regex"` RootFS string `help:"override rootfs image" type:"existingfile"` Guess bool `help:"try all defined kernels"` Shuffle bool `help:"randomize kernels test order"` @@ -75,6 +74,10 @@ type PewCmd struct { Tag string `help:"log tagging"` Timeout time.Duration `help:"timeout after tool will not spawn new tests"` + KernelRegex string `help:"set kernel regex"` + DistroID string `help:"set distribution"` + DistroRelease string `help:"set distribution release"` + ArtifactConfig string `help:"path to artifact config" type:"path"` QemuTimeout time.Duration `help:"timeout for qemu"` @@ -220,14 +223,47 @@ func (cmd *PewCmd) Run(g *Globals) (err error) { ka.SourcePath = g.WorkDir } - if cmd.Kernel != "" { + if cmd.KernelRegex != "" { var km artifact.Target - km, err = kernelMask(cmd.Kernel) + km.Kernel.Regex = cmd.KernelRegex + + if cmd.DistroID == "" { + err = errors.New("--distro-id is required") + return + } + + var dt distro.ID + dt, err = distro.NewID(cmd.DistroID) if err != nil { return } + km.Distro.ID = dt + + if cmd.DistroRelease != "" { + km.Distro.Release = cmd.DistroRelease + } + ka.Targets = []artifact.Target{km} + } else if cmd.DistroID != "" { + var km artifact.Target + + var dt distro.ID + dt, err = distro.NewID(cmd.DistroID) + if err != nil { + return + } + + km.Distro.ID = dt + + if cmd.DistroRelease != "" { + km.Distro.Release = cmd.DistroRelease + } + + ka.Targets = []artifact.Target{km} + } else if cmd.DistroRelease != "" { + err = errors.New("--distro-release has no use on its own") + return } if ka.Qemu.Timeout.Duration == 0 {