testing: cleanup loopback devices on test skip
Fixes a case where loopback devices wouldn't get cleaned up when a test was being skipped Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
This commit is contained in:
		| @@ -61,10 +61,12 @@ func testLookup(t *testing.T, fsType string) { | ||||
| 	} | ||||
| 	if out, err := exec.Command("mkfs", "-t", fsType, deviceName).CombinedOutput(); err != nil { | ||||
| 		// not fatal | ||||
| 		cleanupDevice() | ||||
| 		t.Skipf("could not mkfs (%s) %s: %v (out: %q)", fsType, deviceName, err, string(out)) | ||||
| 	} | ||||
| 	if out, err := exec.Command("mount", deviceName, mnt).CombinedOutput(); err != nil { | ||||
| 		// not fatal | ||||
| 		cleanupDevice() | ||||
| 		t.Skipf("could not mount %s: %v (out: %q)", deviceName, err, string(out)) | ||||
| 	} | ||||
| 	defer func() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Christopher Jones
					Christopher Jones