Run the nbd_scenario tests under valgrind

This commit is contained in:
Alex Young
2012-05-31 13:23:12 +01:00
parent c6dd4fbd89
commit 268bebd408

View File

@@ -16,11 +16,12 @@ class FlexNBD
def serve(ip, port, file, *acl)
File.unlink(ctrl) if File.exists?(ctrl)
@pid = fork do
cmd ="#{@bin} serve "\
cmd ="valgrind #{@bin} serve "\
"--addr #{ip} "\
"--port #{port} "\
"--file #{file} "\
"--sock #{ctrl} "\
"--debug "\
"#{acl.join(' ')}"
exec(cmd)
end
@@ -33,10 +34,11 @@ class FlexNBD
end
def read(offset, length)
IO.popen("#{@bin} read "\
IO.popen("valgrind #{@bin} read "\
"--addr #{ip} "\
"--port #{port} "\
"--from #{offset} "\
"--debug "\
"--size #{length}","r") do |fh|
return fh.read
end
@@ -44,10 +46,11 @@ class FlexNBD
end
def write(offset, data)
IO.popen("#{@bin} write "\
IO.popen("valgrind #{@bin} write "\
"--addr #{ip} "\
"--port #{port} "\
"--from #{offset} "\
"--debug "\
"--size #{data.length}","w") do |fh|
fh.write(data)
end