2013-04-11 18:10:47 +05:30
|
|
|
Given(/^valid metadata$/) do
|
|
|
|
in_current_dir do
|
2013-06-19 16:04:01 +05:30
|
|
|
system("thinp_xml create --nr-thins uniform[4..9] --nr-mappings uniform[1000..10000] > #{xml_file}")
|
2013-04-11 18:10:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
run_simple("dd if=/dev/zero of=#{dev_file} bs=4k count=1024")
|
|
|
|
run_simple("thin_restore -i #{xml_file} -o #{dev_file}")
|
|
|
|
end
|
|
|
|
|
2013-04-23 19:51:44 +05:30
|
|
|
Given(/^a corrupt superblock$/) do
|
|
|
|
in_current_dir do
|
|
|
|
write_valid_xml(xml_file)
|
|
|
|
end
|
|
|
|
|
|
|
|
run_simple("dd if=/dev/zero of=#{dev_file} bs=4k count=1024")
|
|
|
|
run_simple("thin_restore -i #{xml_file} -o #{dev_file}")
|
|
|
|
|
|
|
|
in_current_dir do
|
|
|
|
corrupt_block(0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-04-11 18:10:47 +05:30
|
|
|
When(/^I run thin_check with (.*?)$/) do |opts|
|
2013-04-23 19:51:44 +05:30
|
|
|
run_simple("thin_check #{opts} #{dev_file}", false)
|
2013-04-11 18:10:47 +05:30
|
|
|
end
|
|
|
|
|
2013-05-23 18:27:57 +05:30
|
|
|
When(/^I run thin_rmap with (.*?)$/) do |opts|
|
|
|
|
run_simple("thin_rmap #{opts} #{dev_file}", false)
|
|
|
|
end
|
|
|
|
|
2013-06-27 14:10:43 +05:30
|
|
|
When(/^I run thin_restore with (.*?)$/) do |opts|
|
|
|
|
run_simple("thin_restore #{opts}", false)
|
|
|
|
end
|
|
|
|
|
2013-06-19 19:06:09 +05:30
|
|
|
Then /^it should give no output$/ do
|
|
|
|
ps = only_processes.last
|
|
|
|
output = ps.stdout + ps.stderr
|
|
|
|
output.should == ""
|
|
|
|
end
|
2013-06-25 15:41:50 +05:30
|
|
|
|
|
|
|
Then(/^it should pass with version$/) do
|
|
|
|
only_processes.last.stdout.chomp.should == tools_version
|
|
|
|
end
|