From a9060cda4a76628e13fb85614c5c5690a50b6dba Mon Sep 17 00:00:00 2001 From: Zoe Date: Mon, 5 Feb 2024 20:43:57 +0800 Subject: [PATCH] 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 --- integration/issue7496_linux_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/integration/issue7496_linux_test.go b/integration/issue7496_linux_test.go index 605a7c560..b7a8b3225 100644 --- a/integration/issue7496_linux_test.go +++ b/integration/issue7496_linux_test.go @@ -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}