Implements the parameter to specify an endless stress script
This commit is contained in:
parent
ca95155ce0
commit
3677adece9
11
pew.go
11
pew.go
@ -50,6 +50,7 @@ type PewCmd struct {
|
|||||||
|
|
||||||
Endless bool `help:"endless tests"`
|
Endless bool `help:"endless tests"`
|
||||||
EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"`
|
EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"`
|
||||||
|
EndlessStress string `help:"endless stress script" type:"existingfile"`
|
||||||
|
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
kcfg config.KernelConfig
|
kcfg config.KernelConfig
|
||||||
@ -740,6 +741,16 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup,
|
|||||||
|
|
||||||
slog.Info().Msg("start endless tests")
|
slog.Info().Msg("start endless tests")
|
||||||
|
|
||||||
|
if cmd.EndlessStress != "" {
|
||||||
|
slog.Debug().Msg("copy and run endless stress script")
|
||||||
|
err = q.CopyAndRunAsync("root", cmd.EndlessStress)
|
||||||
|
if err != nil {
|
||||||
|
q.Stop()
|
||||||
|
slog.Fatal().Err(err).Msg("cannot copy/run stress")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
output, err := q.Command("root", remoteTest)
|
output, err := q.Command("root", remoteTest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -550,6 +550,17 @@ func (q *System) CopyAndRun(user, path string) (output string, err error) {
|
|||||||
return q.Command(user, "chmod +x "+remotePath+" && "+remotePath)
|
return q.Command(user, "chmod +x "+remotePath+" && "+remotePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CopyAndRunAsync is copy local file to qemu vm then run it w/o wait for exit
|
||||||
|
func (q *System) CopyAndRunAsync(user, path string) (err error) {
|
||||||
|
remotePath := fmt.Sprintf("/tmp/executable_%d", rand.Int())
|
||||||
|
err = q.CopyFile(user, path, remotePath)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return q.AsyncCommand(user, "chmod +x "+remotePath+" && "+remotePath)
|
||||||
|
}
|
||||||
|
|
||||||
// Debug is for enable qemu debug and set hostname and port for listen
|
// Debug is for enable qemu debug and set hostname and port for listen
|
||||||
func (q *System) Debug(conn string) {
|
func (q *System) Debug(conn string) {
|
||||||
q.debug = true
|
q.debug = true
|
||||||
|
Loading…
Reference in New Issue
Block a user