Merge pull request #9750 from jiusanzhou/bugfix/integration-fix-strace-inject

Support inject delay running with the old version (4.x) of strace for test case
This commit is contained in:
Fu Wei 2024-02-06 05:30:42 +00:00 committed by GitHub
commit 2f807b606a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,11 +116,13 @@ func injectDelayToUmount2(ctx context.Context, t *testing.T, shimCli apitask.TTR
doneCh := make(chan struct{})
// use strace command to mock the delay of umount2
// this require strace version >= 4.22
cmd := exec.CommandContext(ctx, "strace",
"-p", strconv.Itoa(int(pid)), "-f", // attach to all the threads
"--detach-on=execve", // stop to attach runc child-processes
"--trace=umount2", // only trace umount2 syscall
"-e", "inject=umount2:delay_enter="+strconv.Itoa(delayInSec)+"s",
"-b", "execve", // stop to attach runc child-processes
"-e", "trace=umount2", // only trace umount2 syscall
"-e", "inject=umount2:delay_enter="+strconv.Itoa(delayInSec)+"000000",
)
cmd.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGKILL}