Skip to content

Commit 925ff5a

Browse files
authored
Merge pull request #5539 from alakesh/btrfs-test
Do not run btrfs tests if btrfs kernel module is not loaded
2 parents f0d2f89 + b996e49 commit 925ff5a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

snapshots/btrfs/btrfs_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package btrfs
2020

2121
import (
22+
"bytes"
2223
"context"
2324
"io/ioutil"
2425
"os"
@@ -44,7 +45,10 @@ func boltSnapshotter(t *testing.T) func(context.Context, string) (snapshots.Snap
4445
t.Skipf("could not find mkfs.btrfs: %v", err)
4546
}
4647

47-
// TODO: Check for btrfs in /proc/module and skip if not loaded
48+
procModules, err := ioutil.ReadFile("/proc/modules")
49+
if err == nil && !bytes.Contains(procModules, []byte("btrfs")) {
50+
t.Skip("check for btrfs kernel module failed, skipping test")
51+
}
4852

4953
return func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
5054

0 commit comments

Comments
 (0)