[v3,09/14] btrfs-progs: tests/common: Introduce optional parameter to specify destination directory for generate_dataset
diff mbox

Message ID 20170918072139.6300-10-quwenruo.btrfs@gmx.com
State New
Headers show

Commit Message

Qu Wenruo Sept. 18, 2017, 7:21 a.m. UTC
Normally generate_dataset() will create data into

This is OK since most tests are doing their operation in $TEST_MNT.
However this is not the case for "mkfs --rootdir" test.

This patch will adds an optional parameter for generate_dataset() to
specify the destination directory, for later "mkfs --rootdir" test

Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
 tests/common | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff mbox

diff --git a/tests/common b/tests/common
index 9aebe3e7..242ded1d 100644
--- a/tests/common
+++ b/tests/common
@@ -440,7 +440,11 @@  DATASET_SIZE=50
 generate_dataset() {
-	dirpath=$TEST_MNT/$dataset_type
+	if [ -z "$2" ]; then
+		dirpath="$TEST_MNT/$dataset_type"
+	else
+		dirpath="$2/$dataset_type"
+	fi
 	run_check $SUDO_HELPER mkdir -p "$dirpath"
 	case "$dataset_type" in