diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-11-12 23:29:52 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-11-12 23:29:52 +0000 |
commit | 921dc96e9a6cd4a40939354674a4f8408f0eeed7 (patch) | |
tree | 10afefce4cd53bfdaf4dfe2978cd38f88aa49be2 /test/mgmt.rb | |
parent | b43bcca20aa5c18d5dee8f9bb125a88e6dba3e04 (diff) | |
download | cmogstored-921dc96e9a6cd4a40939354674a4f8408f0eeed7.tar.gz |
Some systems do not have /proc/$PID/task, but we know Linux does.
Diffstat (limited to 'test/mgmt.rb')
-rw-r--r-- | test/mgmt.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/mgmt.rb b/test/mgmt.rb index 2bd967c..5c0807c 100644 --- a/test/mgmt.rb +++ b/test/mgmt.rb @@ -274,14 +274,20 @@ class TestMgmt < Test::Unit::TestCase tries = 1000 @client.write "WTF\r\n" assert_match(%r{ERROR: unknown command}, @client.gets) - glob = "/proc/#@pid/task/*" - nr_threads = Dir[glob].size + taskdir = "/proc/#@pid/task" + glob = "#{taskdir}/*" @client.write "server aio_threads = 1\r\n" assert_equal "\r\n", @client.gets - while nr_threads == Dir[glob].size && (tries -= 1) > 0 - sleep(0.1) + if RUBY_PLATFORM =~ /linux/ + assert File.directory?(taskdir), "/proc not mounted on Linux?" + end + if File.directory?(taskdir) + nr_threads = Dir[glob].size + while nr_threads == Dir[glob].size && (tries -= 1) > 0 + sleep(0.1) + end + assert nr_threads != Dir[glob].size end - assert nr_threads != Dir[glob].size @client.write "server aio_threads=6\r\n" assert_equal "\r\n", @client.gets @client.write "WTF\r\n" |