Skip to content

Commit e42d981

Browse files
committed
libct/int: rm double logging in checkpoint_test
Since commit c77aaa3 the tail of criu log is printed by runc, so there's no need to do the same thing in tests. This also fixes a test failure on ARM where showLog fails (because there's no log file) and thus the conditional t.Skip is not called. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 62a3146 commit e42d981

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

libcontainer/integration/checkpoint_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package integration
22

33
import (
4-
"bufio"
54
"bytes"
65
"errors"
76
"os"
@@ -15,30 +14,6 @@ import (
1514
"golang.org/x/sys/unix"
1615
)
1716

18-
func showFile(t *testing.T, fname string) {
19-
t.Helper()
20-
t.Logf("=== %s ===\n", fname)
21-
22-
f, err := os.Open(fname)
23-
if err != nil {
24-
t.Log(err)
25-
return
26-
}
27-
defer f.Close() //nolint: errcheck
28-
29-
scanner := bufio.NewScanner(f)
30-
for scanner.Scan() {
31-
t.Log(scanner.Text())
32-
}
33-
34-
if err := scanner.Err(); err != nil {
35-
t.Log(err)
36-
return
37-
}
38-
39-
t.Logf("=== END ===\n")
40-
}
41-
4217
func TestUsernsCheckpoint(t *testing.T) {
4318
cmd := exec.Command("criu", "check", "--feature", "userns")
4419
if err := cmd.Run(); err != nil {
@@ -106,10 +81,8 @@ func testCheckpoint(t *testing.T, userns bool) {
10681
WorkDirectory: parentDir,
10782
PreDump: true,
10883
}
109-
preDumpLog := filepath.Join(preDumpOpts.WorkDirectory, "dump.log")
11084

11185
if err := container.Checkpoint(preDumpOpts); err != nil {
112-
showFile(t, preDumpLog)
11386
if errors.Is(err, libcontainer.ErrCriuMissingFeatures) {
11487
t.Skip(err)
11588
}
@@ -130,11 +103,8 @@ func testCheckpoint(t *testing.T, userns bool) {
130103
WorkDirectory: imagesDir,
131104
ParentImage: "../criu-parent",
132105
}
133-
dumpLog := filepath.Join(checkpointOpts.WorkDirectory, "dump.log")
134-
restoreLog := filepath.Join(checkpointOpts.WorkDirectory, "restore.log")
135106

136107
if err := container.Checkpoint(checkpointOpts); err != nil {
137-
showFile(t, dumpLog)
138108
t.Fatal(err)
139109
}
140110

@@ -168,7 +138,6 @@ func testCheckpoint(t *testing.T, userns bool) {
168138
_ = restoreStdinR.Close()
169139
defer restoreStdinW.Close() //nolint: errcheck
170140
if err != nil {
171-
showFile(t, restoreLog)
172141
t.Fatal(err)
173142
}
174143

0 commit comments

Comments
 (0)