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