diff --git a/checkpointctl.go b/checkpointctl.go index f9c2f33b..19a8d2b6 100644 --- a/checkpointctl.go +++ b/checkpointctl.go @@ -95,6 +95,7 @@ func show(cmd *cobra.Command, args []string) error { if showAll { stats = true mounts = true + psTree = true } if fullPaths && !mounts { return fmt.Errorf("Cannot use --full-paths without --mounts/--all option") diff --git a/test/checkpointctl.bats b/test/checkpointctl.bats index 3b6c575c..5e017b6b 100644 --- a/test/checkpointctl.bats +++ b/test/checkpointctl.bats @@ -167,7 +167,7 @@ function teardown() { @test "Run checkpointctl show with tar file and --all and valid spec.dump and valid stats-dump" { cp data/config.dump "$TEST_TMP_DIR1" cp data/spec.dump "$TEST_TMP_DIR1" - cp test-imgs/stats-dump "$TEST_TMP_DIR1" + cp test-imgs/* "$TEST_TMP_DIR1" mkdir "$TEST_TMP_DIR1"/checkpoint ( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . ) checkpointctl show "$TEST_TMP_DIR2"/test.tar --all @@ -179,6 +179,8 @@ function teardown() { [[ ${lines[13]} == *"CRIU dump statistics"* ]] [[ ${lines[15]} == *"MEMWRITE TIME"* ]] [[ ${lines[17]} =~ [1-9]+" us" ]] + [[ ${lines[19]} == *"Process tree"* ]] + [[ ${lines[21]} == *"piggie"* ]] } @test "Run checkpointctl show with tar file and missing --mounts/--all and --full-paths" { @@ -254,3 +256,14 @@ function teardown() { [[ ${lines[2]} == *"ROOT FS DIFF SIZE"* ]] } +@test "Run checkpointctl show with tar file and --ps-tree" { + cp data/config.dump \ + data/spec.dump \ + test-imgs/pstree.img \ + test-imgs/core-*.img "$TEST_TMP_DIR1" + mkdir "$TEST_TMP_DIR1"/checkpoint + ( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . ) + checkpointctl show "$TEST_TMP_DIR2"/test.tar --ps-tree + [ "$status" -eq 0 ] + [[ ${lines[8]} == *"piggie"* ]] +}