Skip to contentSkip to conversation

Question: Why tests/generic/482 and tests/generic/487 can't pass both at the same time.

DISCUSSION 蔡晓斌 2 participants 3 messages Mar 25, 2024 – Apr 2, 2024

lore
Share & tools
lore

蔡晓斌

author
#0 lore raw

Hi, I have a question when I ran the xfstests, please help me to solve this question, tks.

In my environment, I ues the machine with architecture of aarch64, and then setting the env in local.config file like below:

# Ideally define at least these 4 to match your environment # The first 2 are required.
# See README for other variables which can be set. #
# Note: SCRATCH_DEV >will< get overwritten!

export TEST_DEV=/dev/mmcblk0p12
export TEST_DIR=/mnt/xfstests/dir
export FSTYP=ext4
export SCRATCH_DEV=/dev/mmcblk0p13
export SCRATCH_MNT=/mnt/xfstests/dir-mnt
export SCRATCH_LOGDEV=/dev/mmcblk0p14
export USE_EXTERNAL=yes
export DUMP_CORRUPT_FS=1
export KEEP_DMESG=yes
export USE_KMEMLEK=yes
export LOGWRITES_DEV=/dev/mmcblk0p15
export MIN_FSSIZE=10485760 # 10MB
export DIFF_LENGTH=0

And execute the command "./check -l -T tests/generic/[0-9][0-9][0-9]" to run the xfstests. When it ran out, I find that "tests/generic/482" was failed, and "tests/generic/487" was successed.

So I check the source code for those two tests, and I found that used different function in them, like below :

tests/generic/482 :

# real QA test starts here

# Modify as appropriate.
_supported_fs generic

_require_no_logdev
_require_command "$KILLALL_PROG" killall

--------------------------------------------------------------

tests/generic/487 :

# real QA test starts here
_require_scratch_nocheck

sflag='-s'
case $FSTYP in
        btrfs)
                _notrun "btrfs has a specialized test for this" ;;
        *)
                ;;
esac

_require_logdev
_require_dm_target error

Then continue to check the source code :

common/rc :

# this test needs a logdev
#
_require_logdev()
{
    [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
        _notrun "This test requires a valid \$SCRATCH_LOGDEV"
    [ "$USE_EXTERNAL" != yes ] && \
        _notrun "This test requires USE_EXTERNAL to be enabled"
    # ensure its not mounted
    $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
}

# This test requires that an external log device is not in use #
_require_no_logdev()
{
[ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ] && \
_notrun "Test not compatible with external logs, skipped this test" }

I find that these two functions behave as mutually exclusive in use, so I don't understand why xfstests can't pass both tests at the same time. Please help me to solve this question, thank you again.

Looking forward to your reply.

#1 lore raw
Quoted 106 lines · 蔡晓斌

Hi, I have a question when I ran the xfstests, please help me to solve this question, tks.

In my environment, I ues the machine with architecture of aarch64, and then setting the env in local.config file like below:

# Ideally define at least these 4 to match your environment # The first 2 are required.
# See README for other variables which can be set. #
# Note: SCRATCH_DEV >will< get overwritten!

export TEST_DEV=/dev/mmcblk0p12
export TEST_DIR=/mnt/xfstests/dir
export FSTYP=ext4
export SCRATCH_DEV=/dev/mmcblk0p13
export SCRATCH_MNT=/mnt/xfstests/dir-mnt
export SCRATCH_LOGDEV=/dev/mmcblk0p14
export USE_EXTERNAL=yes
export DUMP_CORRUPT_FS=1
export KEEP_DMESG=yes
export USE_KMEMLEK=yes
export LOGWRITES_DEV=/dev/mmcblk0p15
export MIN_FSSIZE=10485760 # 10MB
export DIFF_LENGTH=0

And execute the command "./check -l -T tests/generic/[0-9][0-9][0-9]" to run the xfstests. When it ran out, I find that "tests/generic/482" was failed, and "tests/generic/487" was successed.

So I check the source code for those two tests, and I found that used different function in them, like below :

tests/generic/482 :

# real QA test starts here

# Modify as appropriate.
_supported_fs generic

_require_no_logdev
_require_command "$KILLALL_PROG" killall

--------------------------------------------------------------

tests/generic/487 :

# real QA test starts here
_require_scratch_nocheck

sflag='-s'
case $FSTYP in
        btrfs)
                _notrun "btrfs has a specialized test for this" ;;
        *)
                ;;
esac

_require_logdev
_require_dm_target error

Then continue to check the source code :

common/rc :

# this test needs a logdev
#
_require_logdev()
{
    [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
        _notrun "This test requires a valid \$SCRATCH_LOGDEV"
    [ "$USE_EXTERNAL" != yes ] && \
        _notrun "This test requires USE_EXTERNAL to be enabled"
    # ensure its not mounted
    $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
}

# This test requires that an external log device is not in use #
_require_no_logdev()
{
[ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ] && \
_notrun "Test not compatible with external logs, skipped this test" }

Quoted 1 line

I find that these two functions behave as mutually exclusive in use, so I don't understand why xfstests can't pass both tests at the same time. Please help me to solve this question, thank you again.

Not sure what's the problem you hit. g/482 and g/487 are totally different two test cases.

The g/482 calls _require_no_logdev due to it needs dmlogwrites device, and:

commit 50f6d46410367586ab151b357e67393599eebd1c
Author: Darrick J. Wong <[email protected]>
Date: Tue Jul 26 12:48:51 2022 -0700

dmlogwrites: skip generic tests when external logdev in use

but the g/487 calls _require_logdev due to it needs an external log device, to avoid the effection from the dm-error of data device.

The g/482 shouldn't fail if there's a SCRATCH_LOGDEV, it should _notrun. If it failed you'd better to check that failure.

About how to run g/482 and g/487, as one requires logdev, the other one requires no_log, so you should have two config sections at least, one have SCRATCH_LOGDEV, the other one unset it. Then run two kinds of tests (with or without log device).

Thanks,
Zorro

Quoted 4 lines

Looking forward to your reply.

author
#2 lore raw
Quoted 126 lines · Zorro Lang
Quoted 106 lines · 蔡晓斌

Hi, I have a question when I ran the xfstests, please help me to solve this question, tks.

In my environment, I ues the machine with architecture of aarch64, and then setting the env in local.config file like below:

# Ideally define at least these 4 to match your environment # The first 2 are required.
# See README for other variables which can be set. #
# Note: SCRATCH_DEV >will< get overwritten!

export TEST_DEV=/dev/mmcblk0p12
export TEST_DIR=/mnt/xfstests/dir
export FSTYP=ext4
export SCRATCH_DEV=/dev/mmcblk0p13
export SCRATCH_MNT=/mnt/xfstests/dir-mnt
export SCRATCH_LOGDEV=/dev/mmcblk0p14
export USE_EXTERNAL=yes
export DUMP_CORRUPT_FS=1
export KEEP_DMESG=yes
export USE_KMEMLEK=yes
export LOGWRITES_DEV=/dev/mmcblk0p15
export MIN_FSSIZE=10485760 # 10MB
export DIFF_LENGTH=0

And execute the command "./check -l -T tests/generic/[0-9][0-9][0-9]" to run the xfstests. When it ran out, I find that "tests/generic/482" was failed, and "tests/generic/487" was successed.

So I check the source code for those two tests, and I found that used different function in them, like below :

tests/generic/482 :

# real QA test starts here

# Modify as appropriate.
_supported_fs generic

_require_no_logdev
_require_command "$KILLALL_PROG" killall

--------------------------------------------------------------

tests/generic/487 :

# real QA test starts here
_require_scratch_nocheck

sflag='-s'
case $FSTYP in
        btrfs)
                _notrun "btrfs has a specialized test for this" ;;
        *)
                ;;
esac

_require_logdev
_require_dm_target error

Then continue to check the source code :

common/rc :

# this test needs a logdev
#
_require_logdev()
{
    [ -z "$SCRATCH_LOGDEV" -o ! -b "$SCRATCH_LOGDEV" ] && \
        _notrun "This test requires a valid \$SCRATCH_LOGDEV"
    [ "$USE_EXTERNAL" != yes ] && \
        _notrun "This test requires USE_EXTERNAL to be enabled"
    # ensure its not mounted
    $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
}

# This test requires that an external log device is not in use #
_require_no_logdev()
{
[ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_LOGDEV" ] && \
_notrun "Test not compatible with external logs, skipped this test" }

Quoted 1 line

I find that these two functions behave as mutually exclusive in use, so I don't understand why xfstests can't pass both tests at the same time. Please help me to solve this question, thank you again.

Not sure what's the problem you hit. g/482 and g/487 are totally different two test cases.

The g/482 calls _require_no_logdev due to it needs dmlogwrites device, and:

commit 50f6d46410367586ab151b357e67393599eebd1c
Author: Darrick J. Wong <[email protected]>
Date: Tue Jul 26 12:48:51 2022 -0700

dmlogwrites: skip generic tests when external logdev in use

but the g/487 calls _require_logdev due to it needs an external log device, to avoid the effection from the dm-error of data device.

The g/482 shouldn't fail if there's a SCRATCH_LOGDEV, it should _notrun. If it failed you'd better to check that failure.

Quoted 8 lines

About how to run g/482 and g/487, as one requires logdev, the other one requires no_log, so you should have two config sections at least, one have SCRATCH_LOGDEV, the other one unset it. Then run two kinds of tests (with or without log device).

Thanks,
Zorro

Hi Zorro, thank you for resolving my question, I know what to do next.

Quoted 4 lines
Quoted 4 lines

Looking forward to your reply.