about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-08 10:21:04 +0000
committerEric Wong <normalperson@yhbt.net>2011-11-08 10:21:04 +0000
commit4403d6936f72d8676f04799c419ca7f556b47bd1 (patch)
tree8e3770e2f4b681d9495ab9d555105040fc68761e
parent5f7f02420d2df6a29115dc9dcf31587290d0658f (diff)
downloadmogilefs-client-4403d6936f72d8676f04799c419ca7f556b47bd1.tar.gz
Just borrow the code from 1.9.3
-rw-r--r--test/exec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/exec.rb b/test/exec.rb
index 3c98369..b2c2bf9 100644
--- a/test/exec.rb
+++ b/test/exec.rb
@@ -12,8 +12,10 @@ module TestExec
   def uuid
     SecureRandom.uuid
   rescue NoMethodError
-    require "uuid"
-    UUID.generate
+    ary = SecureRandom.random_bytes(16).unpack("NnnnnN")
+    ary[2] = (ary[2] & 0x0fff) | 0x4000
+    ary[3] = (ary[3] & 0x3fff) | 0x8000
+    "%08x-%04x-%04x-%04x-%04x%08x" % ary
   end
 
   def yield_for_monitor_update # mogilefsd should update every 4 seconds