mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-13 03:03:56 +08:00
TestCheckpoint: skip on ErrCriuMissingFeatures
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
@@ -28,6 +28,8 @@ import (
|
||||
|
||||
var criuFeatures *criurpc.CriuFeatures
|
||||
|
||||
var ErrCriuMissingFeatures = errors.New("criu is missing features")
|
||||
|
||||
func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.CriuOpts, criuFeat *criurpc.CriuFeatures) error {
|
||||
t := criurpc.CriuReqType_FEATURE_CHECK
|
||||
|
||||
@@ -50,14 +52,14 @@ func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.CriuO
|
||||
return errors.New("CRIU feature check failed")
|
||||
}
|
||||
|
||||
missingFeatures := false
|
||||
var missingFeatures []string
|
||||
|
||||
// The outer if checks if the fields actually exist
|
||||
if (criuFeat.MemTrack != nil) &&
|
||||
(criuFeatures.MemTrack != nil) {
|
||||
// The inner if checks if they are set to true
|
||||
if *criuFeat.MemTrack && !*criuFeatures.MemTrack {
|
||||
missingFeatures = true
|
||||
missingFeatures = append(missingFeatures, "MemTrack")
|
||||
logrus.Debugf("CRIU does not support MemTrack")
|
||||
}
|
||||
}
|
||||
@@ -67,13 +69,13 @@ func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.CriuO
|
||||
if (criuFeat.LazyPages != nil) &&
|
||||
(criuFeatures.LazyPages != nil) {
|
||||
if *criuFeat.LazyPages && !*criuFeatures.LazyPages {
|
||||
missingFeatures = true
|
||||
missingFeatures = append(missingFeatures, "LazyPages")
|
||||
logrus.Debugf("CRIU does not support LazyPages")
|
||||
}
|
||||
}
|
||||
|
||||
if missingFeatures {
|
||||
return errors.New("CRIU is missing features")
|
||||
if len(missingFeatures) != 0 {
|
||||
return fmt.Errorf("%w: %v", ErrCriuMissingFeatures, missingFeatures)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@@ -3,6 +3,7 @@ package integration
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -112,6 +113,9 @@ func testCheckpoint(t *testing.T, userns bool) {
|
||||
|
||||
if err := container.Checkpoint(preDumpOpts); err != nil {
|
||||
showFile(t, preDumpLog)
|
||||
if errors.Is(err, libcontainer.ErrCriuMissingFeatures) {
|
||||
t.Skip(err)
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user