summaryrefslogtreecommitdiff
path: root/tests/btrfs/195
blob: 96cc41343925927405b542c17e3792c7ccbed06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2019 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test btrfs/195
#
# Test raid profile conversion. It's sufficient to test all dest profiles as
# source profiles just rely on being able to read the data and metadata.
#
. ./common/preamble
_begin_fstest auto volume balance scrub

# Import common functions.
. ./common/filter

# real QA test starts here

# Modify as appropriate.
_supported_fs btrfs
_require_scratch_dev_pool 4
# Zoned btrfs only supports SINGLE profile
_require_non_zoned_device "${SCRATCH_DEV}"

declare -a TEST_VECTORS=(
# $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
"4:single:raid1"
"4:single:raid0"
"4:single:raid10"
"4:single:dup"
"4:single:raid5"
"4:single:raid6"
"2:raid1:single"
)

run_testcase() {
	IFS=':' read -ra args <<< $1
	num_disks=${args[0]}
	src_type=${args[1]}
	dst_type=${args[2]}

	_scratch_dev_pool_get $num_disks

	echo "=== Running test: $1 ===" >> $seqres.full

	_scratch_pool_mkfs -d$src_type >> $seqres.full 2>&1
	_scratch_mount

	# Create random filesystem with 20k write ops
	$FSSTRESS_PROG -d $SCRATCH_MNT -w -n 10000 $FSSTRESS_AVOID >>$seqres.full 2>&1

	_run_btrfs_balance_start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full
	[ $? -eq 0 ] || echo "$1: Failed convert"

	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
	[ $? -eq 0 ] || echo "$1: Scrub failed"

	_scratch_unmount
	_check_btrfs_filesystem $SCRATCH_DEV
	_scratch_dev_pool_put
}

for i in "${TEST_VECTORS[@]}"; do
	run_testcase $i
done

echo "Silence is golden"
status=0
exit