Re: [PATCH 3/3] fstests: btrfs: testcase for sysfs policy syntax verification

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]




+set_sysfs_policy_must_fail()
+{
+	local attr=$1
+	shift
+	local policy=$@
+
+	_set_fs_sysfs_attr $SCRATCH_DEV $attr ${policy} | _filter_sysfs_error \
+			| _expect_error_invalid_argument | tee -a $seqres.full

This "catch an exact error or output a different error then use
golden image match failure on secondary error to mark the test as
failed" semantic is .... overly complex.

The output on failure of _filter_sysfs_error will be "Invalid
input". If there's some other failure or it succeeds, the output
will indicate the failure that occurred (i.e. missing line means no
error, different error will output directly by the filter). The
golden image matching will still fail the test.

IOWs, _expect_error_invalid_argument and the output to seqres.full
can go away if the test.out file has a matching error for each
call to set_sysfs_policy_must_fail(). i.e it looks like:

QA output created by 329
Invalid input
Invalid input
Invalid input
Invalid input
Invalid input
Invalid input
.....
Invalid input

Thanks for the review.

This test case verifies the sysfs interface syntax in general.
Relying on golden output can cause false negatives on older
kernels lacking support for newer sysfs policies.
Creating individual test cases for each sysfs interface is
unnecessary overhead.

With this approach, when needed, we use:

if _has_fs_sysfs_attr $dev <sysfs-interface>; then
    verify_sysfs_syntax <sysfs-interface> <value>
fi

- Anand






[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux