Skip to content

Commit a9060cd

Browse files
committed
Support inject delay running with the old version (4.x) of strace for test case.
Only the newer version of strace can support `--detach-on` options and set time duration with human readable string. In the 4.x version of strace, using `-b` to replace `--detach-on`, and injecting a delay with int usecs. Signed-off-by: Zoe <[email protected]>
1 parent f5e7fe0 commit a9060cd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

integration/issue7496_linux_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ func injectDelayToUmount2(ctx context.Context, t *testing.T, shimCli apitask.TTR
116116

117117
doneCh := make(chan struct{})
118118

119+
// use strace command to mock the delay of umount2
120+
// this require strace version >= 4.22
119121
cmd := exec.CommandContext(ctx, "strace",
120122
"-p", strconv.Itoa(int(pid)), "-f", // attach to all the threads
121-
"--detach-on=execve", // stop to attach runc child-processes
122-
"--trace=umount2", // only trace umount2 syscall
123-
"-e", "inject=umount2:delay_enter="+strconv.Itoa(delayInSec)+"s",
123+
"-b", "execve", // stop to attach runc child-processes
124+
"-e", "trace=umount2", // only trace umount2 syscall
125+
"-e", "inject=umount2:delay_enter="+strconv.Itoa(delayInSec)+"000000",
124126
)
125127
cmd.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGKILL}
126128

0 commit comments

Comments
 (0)