summaryrefslogtreecommitdiff
path: root/tests/20raid5journal
blob: f751aceb4f99dccbc644f9ba4c34bf2fef58c74c (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
# check write journal of raid456

# test --detail
test_detail_shows_journal() {
    mdadm -D $1 | grep journal || {
        echo >&2 "ERROR --detail does show journal device!"; mdadm -D $1 ; exit 1; }
}

# test --examine
test_examine_shows_journal() {
    mdadm -E $1 | grep Journal || {
        echo >&2 "ERROR --examine does show Journal device!"; mdadm -E $1 ; exit 1; }
}

# test --create
create_with_journal_and_stop() {
    mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3 --write-journal $dev4
    check wait
    tar cf - /etc > $md0
    ./raid6check $md0 0 0 | grep 'Error detected' && exit 1
    test_detail_shows_journal $md0
    test_examine_shows_journal $dev4
    mdadm -S $md0
}

# test --assemble
test_assemble() {
    create_with_journal_and_stop
    if mdadm -A $md0 $dev0 $dev1 $dev2 $dev3
    then
        echo >&2 "ERROR should return 1 when journal is missing!"; cat /proc/mdstat ; exit 1;
    fi
    mdadm -S $md0

    mdadm -A $md0 $dev0 $dev1 $dev2 $dev3 --force
    check readonly
    mdadm -S $md0
}

# test --incremental
test_incremental() {
    create_with_journal_and_stop
    for d in $dev0 $dev1 $dev2 $dev3
    do
        mdadm -I $d
    done
    check inactive
    mdadm -I $dev4
    check raid5
    mdadm -S $md0

    # test --incremental with journal missing
    for d in $dev0 $dev1 $dev2 $dev3
    do
        mdadm -I $d
    done
    mdadm -R $md0
    check readonly
    mdadm -S $md0
}

create_with_journal_and_stop
test_assemble
test_incremental