Skip to content

Commit 7097449

Browse files
committed
Console test on z/OS
The echo -n switch is not always available on z/OS, so 'echo -n' has been changed to 'printf' so that the same test pattern can be reliably produced across platforms. Same goes for the seq program, so changed the sh loop to a go loop. Signed-off-by: Neil Johnson <[email protected]>
1 parent c4672c3 commit 7097449

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

console_test.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build linux solaris freebsd
1+
// +build linux solaris zos freebsd
22

33
/*
44
Copyright The containerd Authors.
@@ -20,7 +20,6 @@ package console
2020

2121
import (
2222
"bytes"
23-
"fmt"
2423
"io"
2524
"os"
2625
"os/exec"
@@ -69,11 +68,6 @@ func TestConsolePty(t *testing.T) {
6968

7069
iteration := 10
7170

72-
cmd := exec.Command("sh", "-c", fmt.Sprintf("for x in `seq 1 %d`; do echo -n test; done", iteration))
73-
cmd.Stdin = slave
74-
cmd.Stdout = slave
75-
cmd.Stderr = slave
76-
7771
var (
7872
b bytes.Buffer
7973
wg sync.WaitGroup
@@ -84,8 +78,15 @@ func TestConsolePty(t *testing.T) {
8478
wg.Done()
8579
}()
8680

87-
if err := cmd.Run(); err != nil {
88-
t.Fatal(err)
81+
for i := 0; i < iteration; i++ {
82+
cmd := exec.Command("sh", "-c", "printf test")
83+
cmd.Stdin = slave
84+
cmd.Stdout = slave
85+
cmd.Stderr = slave
86+
87+
if err := cmd.Run(); err != nil {
88+
t.Fatal(err)
89+
}
8990
}
9091
slave.Close()
9192
wg.Wait()

0 commit comments

Comments
 (0)