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:
@@ -17,18 +17,13 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 26;
|
||||
use Test::More tests => 25;
|
||||
|
||||
use Sys::Guestfs;
|
||||
|
||||
my $g = Sys::Guestfs->new ();
|
||||
ok ($g);
|
||||
open FILE, ">test.img";
|
||||
truncate FILE, 500*1024*1024;
|
||||
close FILE;
|
||||
ok (1);
|
||||
|
||||
$g->add_drive ("test.img");
|
||||
$g->add_drive_scratch (500*1024*1024);
|
||||
ok (1);
|
||||
|
||||
$g->launch ();
|
||||
@@ -76,6 +71,4 @@ $g->shutdown ();
|
||||
ok (1);
|
||||
|
||||
undef $g;
|
||||
ok (1);
|
||||
|
||||
unlink ("test.img");
|
||||
ok (1)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 15;
|
||||
use Test::More tests => 14;
|
||||
|
||||
use Errno;
|
||||
|
||||
@@ -27,13 +27,7 @@ use Sys::Guestfs;
|
||||
|
||||
my $g = Sys::Guestfs->new ();
|
||||
ok ($g);
|
||||
|
||||
open FILE, ">test.img";
|
||||
truncate FILE, 500*1024*1024;
|
||||
close FILE;
|
||||
ok (1);
|
||||
|
||||
$g->add_drive ("test.img", format => "raw");
|
||||
$g->add_drive_scratch (500*1024*1024);
|
||||
ok (1);
|
||||
|
||||
$g->launch ();
|
||||
@@ -72,5 +66,3 @@ ok ($err != Errno::EEXIST());
|
||||
|
||||
undef $g;
|
||||
ok (1);
|
||||
|
||||
unlink ("test.img");
|
||||
|
||||
Reference in New Issue
Block a user