mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests: Use new guestfs_add_drive_scratch API where possible in tests.
Replaces code such as: fd = open "test1.img" ftruncate fd, size close fd g.add_drive "test1.img" with the shorter and simpler: g.add_drive_scratch size
This commit is contained in:
@@ -22,15 +22,7 @@ if ($g == false) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$tmp = dirname(__FILE__)."/test.img";
|
||||
$size = 100 * 1024 * 1024;
|
||||
if (! $fp = fopen ($tmp, 'w+')) {
|
||||
die ("Error: cannot create file '".$tmp."'\n");
|
||||
}
|
||||
ftruncate ($fp, $size);
|
||||
fclose ($fp);
|
||||
|
||||
if (! guestfs_add_drive ($g, $tmp) ||
|
||||
if (! guestfs_add_drive_scratch ($g, 100 * 1024 * 1024) ||
|
||||
! guestfs_launch ($g) ||
|
||||
! guestfs_part_disk ($g, "/dev/sda", "mbr") ||
|
||||
! guestfs_pvcreate ($g, "/dev/sda1") ||
|
||||
@@ -52,8 +44,6 @@ if (!is_int ($version["major"]) ||
|
||||
echo ("Error: incorrect return type from guestfs_version\n");
|
||||
}
|
||||
|
||||
unlink ($tmp);
|
||||
|
||||
echo ("OK\n");
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
Reference in New Issue
Block a user