aboutsummaryrefslogtreecommitdiffstats
path: root/tests/stress_test.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2014-05-10 12:41:35 +0100
committerMartin Pärtel <martin.partel@gmail.com>2014-05-10 12:41:35 +0100
commita93dd798d88277489374c45439384781a936cf78 (patch)
tree0ff592159762d0a889d6db0c7cbb3b52002b7e42 /tests/stress_test.rb
parentdc0cf937e50ea1abb7ce439a011531ddb3bbda02 (diff)
downloadbindfs-a93dd798d88277489374c45439384781a936cf78.tar.gz
(rm more trailing spaces)
Diffstat (limited to 'tests/stress_test.rb')
-rwxr-xr-xtests/stress_test.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/stress_test.rb b/tests/stress_test.rb
index 6c0e41c..88804ba 100755
--- a/tests/stress_test.rb
+++ b/tests/stress_test.rb
@@ -27,25 +27,25 @@ class ChildProcess
run
end
end
-
+
attr_reader :pid
-
+
def run
raise "undefined"
end
-
+
def interrupt
ensure_started
Process.kill("INT", @pid)
end
-
+
def wait
ensure_started
Process.waitpid @pid
@pid = nil
$?
end
-
+
def ensure_started
raise "Not started" if !@pid
end
@@ -55,7 +55,7 @@ class BindfsRunner < ChildProcess
def initialize(options = {})
@valgrind = options[:valgrind]
@valgrind_tool = options[:valgrind_tool] || 'memcheck'
-
+
if @valgrind && Process.uid != 0
raise "This must be run as root due to valgrind's limitations"
end
@@ -68,7 +68,7 @@ class BindfsRunner < ChildProcess
SRC_DIR,
MNT_DIR
]
-
+
if @valgrind
cmd = [
'valgrind',
@@ -78,7 +78,7 @@ class BindfsRunner < ChildProcess
'--'
] + cmd
end
-
+
cmd_str = Shellwords.join(cmd) + ' > stress_test.log 2>&1'
puts "Starting #{cmd_str}"
Process.exec(cmd_str)
@@ -93,21 +93,21 @@ class FileCopier < ChildProcess
:size => "100M",
:iterations => 10
}.merge(options)
-
+
puts "Creating template file, size = #{@options[:size]}"
src_dir_src_file = "#{SRC_DIR}/#{@options[:prefix]}_src"
output = `dd if=/dev/urandom of='#{src_dir_src_file}' bs=#{@options[:size]} count=1 2>&1`
raise "#{$?.inspect} with output:\n#{output}" unless $?.success?
end
-
+
def mnt_prefix
"#{MNT_DIR}/#{@options[:prefix]}"
end
-
+
def src_file
"#{mnt_prefix}_src"
end
-
+
def run
task_desc = "#{@options[:num_copies]} copies of #{@options[:size]} in #{@options[:iterations]} iterations"
puts "Making #{task_desc}"