1 # -*- encoding: binary -*-
2 $stdout.sync = $stderr.sync = true
3 Thread.abort_on_exception = true
16 ary = SecureRandom.random_bytes(16).unpack("NnnnnN")
17 ary[2] = (ary[2] & 0x0fff) | 0x4000
18 ary[3] = (ary[3] & 0x3fff) | 0x8000
19 "%08x-%04x-%04x-%04x-%04x%08x" % ary
22 def yield_for_monitor_update # mogilefsd should update every 4 seconds
30 x("mogadm", "--trackers=#{@trackers.join(',')}", *args)
34 out, err = tmpfile("out"), tmpfile("err")
35 puts cmd.join(' ') if $VERBOSE
37 $stderr.reopen(err.path, "a")
38 $stdout.reopen(out.path, "a")
43 _, status = Process.waitpid2(pid)
50 status, out, err = mogadm(*args)
51 assert status.success?, "#{status.inspect} / #{out.read} / #{err.read}"
56 status, out, err = x(*cmd)
57 assert status.success?, "#{status.inspect} / #{out.read} / #{err.read}"
62 tmp = Tempfile.new(name)
63 defined?(@to_close) or @to_close = []