diff --git a/pkg/testutil/helpers.go b/pkg/testutil/helpers.go index ec7246c33..6d2523fec 100644 --- a/pkg/testutil/helpers.go +++ b/pkg/testutil/helpers.go @@ -33,7 +33,17 @@ const umountflags int = 0 var rootEnabled bool func init() { - flag.BoolVar(&rootEnabled, "test.root", false, "enable tests that require root") + if flag.Lookup("test.root") == nil { + flag.BoolVar(&rootEnabled, "test.root", false, "enable tests that require root") + } else { + // The flag is already registered by continuity/testutil + for _, f := range os.Args { + if f == "-test.root" || f == "-test.root=true" { + rootEnabled = true + break + } + } + } } // DumpDir prints the contents of the directory to the testing logger.