From 317b979e29774a77fb933c4f42514ff007669b39 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 26 Jul 2013 06:32:49 +0000 Subject: test/mgmt: warn about slow mount points on test failure Unfortunately, slow mount points still cause minor reliability issues with the test suite. --- test/mgmt.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/mgmt.rb b/test/mgmt.rb index 7c650b8..c3c6a66 100644 --- a/test/mgmt.rb +++ b/test/mgmt.rb @@ -328,7 +328,7 @@ class TestMgmt < Test::Unit::TestCase end until line == ".\n" end - assert lines.grep(/\b#{max}\b/)[0], lines.inspect + assert lines.grep(/\b#{max}\b/)[0], swarn(lines.inspect) assert_nil lines.grep(/\b#{max + 1}\b/)[0] assert File.exist?("#@tmpdir/dev#{max}/usage") assert ! File.exist?("#@tmpdir/dev#{max + 1}/usage") @@ -346,7 +346,7 @@ class TestMgmt < Test::Unit::TestCase break if str =~ /^666\t/ end util = RUBY_PLATFORM =~ /linux/ ? %r{\d+\.\d\d} : %r{\d+(?:\.\d+)?} - assert_match(/^666\t#{util}\n/, str) + assert_match(/^666\t#{util}\n/, str, swarn(str.inspect)) assert_equal ".\n", @client.gets end if `which iostat 2>/dev/null`.chomp.size != 0 && RUBY_PLATFORM !~ /kfreebsd-gnu/ @@ -362,14 +362,18 @@ class TestMgmt < Test::Unit::TestCase lines = [] lines << @client.gets lines << @client.gets - assert_match(/^(666|999)\t#{util}\n/, lines[0]) - assert_match(/^(666|999)\t#{util}\n/, lines[1]) + assert_match(/^(666|999)\t#{util}\n/, lines[0], swarn(lines.inspect)) + assert_match(/^(666|999)\t#{util}\n/, lines[1], swarn(lines.inspect)) assert_not_equal(lines[0], lines[1]) assert_equal ".\n", @client.gets end if `which iostat 2>/dev/null`.chomp.size != 0 && RUBY_PLATFORM !~ /kfreebsd-gnu/ + def swarn(str) + "#{str} slow mountpoints increases the chance of this test failing" + end + def sparse_file_prepare(big = nil) Dir.mkdir("#@tmpdir/dev666") if nil == big -- cgit v1.2.3-24-ge0c7