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:
@@ -23,12 +23,7 @@ local G = require "guestfs"
|
||||
|
||||
local g = G.create ()
|
||||
|
||||
file = io.open ("test.img", "w")
|
||||
file:seek ("set", 500 * 1024 * 1024)
|
||||
file:write (' ')
|
||||
file:close ()
|
||||
|
||||
g:add_drive ("test.img")
|
||||
g:add_drive_scratch (500 * 1024 * 1024)
|
||||
|
||||
g:launch ()
|
||||
|
||||
@@ -45,5 +40,3 @@ assert (table.getn (lvs) == 2 and
|
||||
g:shutdown ()
|
||||
|
||||
g:close ()
|
||||
|
||||
os.remove ("test.img")
|
||||
|
||||
@@ -23,12 +23,7 @@ local G = require "guestfs"
|
||||
|
||||
local g = G.create ()
|
||||
|
||||
file = io.open ("test.img", "w")
|
||||
file:seek ("set", 10 * 1024 * 1024)
|
||||
file:write (' ')
|
||||
file:close ()
|
||||
|
||||
g:add_drive ("test.img")
|
||||
g:add_drive_scratch (10 * 1024 * 1024)
|
||||
|
||||
g:launch ()
|
||||
|
||||
@@ -60,5 +55,3 @@ assert (dirs[5]["name"] == "q", "incorrect name in slot 5")
|
||||
g:shutdown ()
|
||||
|
||||
g:close ()
|
||||
|
||||
os.remove ("test.img")
|
||||
|
||||
Reference in New Issue
Block a user