btrfs-progs: tests: Introduce init_env to initialize common env variant
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 31 Aug 2015 05:04:36 +0000 (13:04 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 1 Sep 2015 12:02:48 +0000 (14:02 +0200)
commitd4d500d341a352c882169a67b1a0c8119ed4257e
tree47c4fb57894d8f12bc473558752d3ced29bea477
parent665dc49ef6eee19cc5d31270d13531e9b248424a
btrfs-progs: tests: Introduce init_env to initialize common env variant

For example, $TEST_DIR is common used in severial tests, and have
duplicated code for initialize.

These duplicated code not only benifits harddisk vendor, but have
inconsistent details, as:
  convert-tests.sh: lack of mkdir
  fsck-tests/012-leaf-corruption/test.sh: unnecessary mkdir
  fsck-tests/013-extent-tree-rebuild/test.sh: unnecessary init
  misc-tests/XXX ...
And severial error message:
  _fail "unable to create mount point on $TEST_MNT"
  _fail "failed to create mount point"
  ...

This patch move initizlizaton of $TEST_DIR to common init_env(),
to avoid above problem, and init_env() can be used to add more
things in future.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
tests/common
tests/convert-tests.sh
tests/fsck-tests.sh
tests/fsck-tests/012-leaf-corruption/test.sh
tests/fsck-tests/013-extent-tree-rebuild/test.sh
tests/misc-tests.sh
tests/misc-tests/001-btrfstune-features/test.sh
tests/misc-tests/002-uuid-rewrite/test.sh
tests/misc-tests/003-zero-log/test.sh