tests: Add wait_for function

This function makes it possible to wait for a specified condition in a test,
some examples:

  # Wait up to 1 mionute for a file to be created
  assert_success wait_for 'ls | wc -l | grep "[1-9]"' '1 minute'

  # Wait up to 30 seconds for 8 chunks to be created
  wait_for '(( $(mfsdirinfo dir | grep chunks: | awk "{print \$2"}) >= 8 ))' '30 seconds'
metarestore: Fix applying single line changelogs

Mfsmetarestore couldn't read the number of the last change in
changelogs with only one line and assumed it was empty.
This commit fixes it.
master: Remove sluggishness caused by dumping metadata.

Master, instead of dumping metadata itself, tells mfsmetarestore
to apply changes stored in changelogs since last metadata backup.
If the checksums of metadata generated by mfsmetarestore and master
don't match, master will try dumping metadata itself.
upgrading test