summaryrefslogtreecommitdiff
path: root/tests/xfs/044
blob: e66c0cb3f35d34fce0c01055e317a4ef7810efa7 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
#
# FS QA Test No. 044
#
# external log uuid/format tests (TODO - version 2 log format)
#
. ./common/preamble
_begin_fstest other auto

# Import common functions.
. ./common/filter

# real QA test starts here
_supported_fs xfs

_require_logdev

_check_mount()
{
    echo "    *** mount (expect success)"
    if ! _try_scratch_mount
    then
        echo "        !!! mount failed (expecting success)"
        status=1
        exit
    fi

    echo "    *** umount"
    if ! _scratch_unmount
    then
        echo "        !!! umount failed (expecting success)"
        status=1
        exit
    fi
}

_check_no_mount()
{
    echo "    *** mount (expect failure)"
    if _try_scratch_mount >$tmp.err 2>&1
    then
        cat $tmp.err
        echo "        !!! mount succeeded (expecting failure)"
        status=1
        exit
    fi
}

_check_require_logdev()
{
    echo "    *** mount without logdev (expect failure)"
    if mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >$tmp.err 2>&1
    then
        cat $tmp.err
        echo "        !!! mount succeeded (expecting failure)"
        status=1
        exit
    fi
}

_unexpected()
{
    echo "        !!! unexpected XFS command failure"
    status=1
    exit
}

# real QA test starts here
# 
_require_scratch

echo "*** mkfs"

# this test only works for version 1 logs currently
lversion=1
lsize=16777216
_scratch_mkfs_xfs -lsize=$lsize,version=$lversion >$tmp.mkfs0 2>&1
[ $? -ne 0 ] && \
    _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
_filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
. $tmp.mkfs1
[ $lversion -ne 1 ] && \
    _notrun "Cannot run this test yet using MKFS_OPTIONS specified"

_require_test_program "loggen"

_check_mount
_check_require_logdev

echo "*** set uuid"
_scratch_xfs_db -x  -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
[ $? -ne 0 ] && _unexpected
_check_mount

echo "*** zero log"
$here/src/loggen -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log"
$here/src/loggen -u 2 -f 1 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log (different format)"
$here/src/loggen -u 2 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log (different uuid)"
$here/src/loggen -u 7 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write clean log (different uuid & format)"
$here/src/loggen -u 7 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write dirty log"
$here/src/loggen -u 2 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write dirty log (different format)"
$here/src/loggen -u 2 -f 99 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write dirty log (irix style)"
$here/src/loggen -u 0 -f 0 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write large dirty log"
$here/src/loggen -u 2 -e 16000 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo -e -n "\n\r*** XFS QA 044 - done\n\r\n\r" >/dev/console

status=0
# if error
exit