tests: Implement fast random on AES

Signed-off-by: Joseph Glanville <joseph.glanville@orionvm.com.au>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
shepherd: use install_crash_handler() from shepherd

The utilities related to signals provided by libsheepdog.a is also
useful for shepherd. This patch lets shepherd use it.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
md: fix move_object

Recovery thread and main thread might try to recover the same object.
Either one succeeds, the other will fail and proceed and end up trying
to move the object to where it is already in place, in this case we
simply return.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: cache sha1 digest for read-only objects

The contents of read-only objects are immutable.  We can cache their
sha1 digests as extended attributes for the next sha1 calculation.
With this patch, I can complete 'collie vdi check' of a 4 GB snapshot
volume in 0.2 seconds.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
[don't merge] tests: valgrind option for lower memory machine

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
collie: allow calling queue_work() in done()

Currently, if we call queue_work() in the second event_loop(),
work_queue_wait() cannot wait for completion of the work.

This adds a field 'nr_works' to the worker_info and makes
work_queue_empty() return true only if both worker_routine() and
worker_thread_request_done() have no outstanding works.  I think this
removes a race condition in work_queue_wait() completely.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
event: use specified timeiout

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] tests/008: wait for sheep recovery

/dev/urandom is too slow.  We don't need good random values to fill vdis.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] sheep: don't overwrite epoch log

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] sheep/group: remove unnecessary log write

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>