File: Skip-TestAttachLoopbackDeviceRace.patch

package info (click to toggle)
golang-github-containers-storage 1.59.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,184 kB
  • sloc: sh: 630; ansic: 389; makefile: 143; awk: 12
file content (29 lines) | stat: -rw-r--r-- 928 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Reinhard Tartler <siretart@tauware.de>
Date: Sun, 4 Aug 2024 15:48:24 -0400
Subject: Skip TestAttachLoopbackDeviceRace if /dev/loop-control is absent

---
 pkg/loopback/attach_test.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pkg/loopback/attach_test.go b/pkg/loopback/attach_test.go
index 8170294..417f1b0 100644
--- a/pkg/loopback/attach_test.go
+++ b/pkg/loopback/attach_test.go
@@ -17,6 +17,16 @@ const (
 )
 
 func TestAttachLoopbackDeviceRace(t *testing.T) {
+	_, err := os.Stat("/dev/loop-control")
+	if err != nil {
+		t.Skip("Cannot execute test with '/dev/loop-control' absent")
+	}
+	f, err := os.OpenFile("/dev/loop-control", os.O_RDONLY, 0o644)
+	if err != nil {
+		t.Skip("Cannot execute test with '/dev/loop-control' unreadable")
+	}
+	f.Close()
+
 	createLoopbackDevice := func() {
 		// Create a file to use as a backing file
 		f, err := os.CreateTemp(t.TempDir(), "loopback-test")