Message ID | 162194964249.4011860.17729034205311880257.stgit@warthog.procyon.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for using xfstests to test AFS | expand |
On Tue, May 25, 2021 at 02:34:02PM +0100, David Howells wrote: > If mknod is not supported, some of generic/294 will fail due to that rather > than what's actually being tested - but the other subtests will still work > as before. > > Add a "_has_mknod" function that can be used to find out if the mknod tests > should be skipped. This is then used to allow the rest of generic/294 to > be employed on AFS. > > Signed-off-by: David Howells <dhowells@redhat.com> > cc: linux-afs@lists.infradead.org > --- > > common/rc | 10 ++++++++++ > doc/requirement-checking.txt | 9 +++++++++ > tests/generic/294 | 8 ++++++++ > tests/generic/294.cfg | 1 + > tests/generic/294.out | 5 ----- > tests/generic/294.out.mknod | 6 ++++++ > tests/generic/294.out.nomknod | 7 +++++++ > 7 files changed, 41 insertions(+), 5 deletions(-) > create mode 100644 tests/generic/294.cfg > delete mode 100644 tests/generic/294.out > create mode 100644 tests/generic/294.out.mknod > create mode 100644 tests/generic/294.out.nomknod > > diff --git a/common/rc b/common/rc > index f24d0e87..4ffec9a2 100644 > --- a/common/rc > +++ b/common/rc > @@ -4603,6 +4603,16 @@ _getcap() > return ${PIPESTATUS[0]} > } > > +_has_mknod() > +{ > + case $FSTYP in > + afs) > + return 1;; > + *) > + return 0;; > + esac > +} > + > init_rc > > ################################################################################ > diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt > index 45d2756b..d31ba3fb 100644 > --- a/doc/requirement-checking.txt > +++ b/doc/requirement-checking.txt > @@ -16,6 +16,8 @@ they have. This is done with _require_<xxx> macros, which may take parameters. > > _require_chattr <letters> > _require_exportfs > + _require_mknod I don't see a _require_mknod being added to common/rc? Otherwise looks ok to me. --D > + _has_mknod > > (3) System call requirements. > > @@ -97,6 +99,13 @@ _require_exportfs > The test also requires the use of the open_by_handle_at() system call and > will be skipped if it isn't available in the kernel. > > +_require_mknod > +_has_mknod > + > + The test requires that the $TEST_DEV filesystem supports mknod(2). > + _require_mknod will cause the test to be skipped; _has_mknod returns 0 if > + mknod is supported and 1 otherwise. > + > > ======================== > SYSTEM CALL REQUIREMENTS > diff --git a/tests/generic/294 b/tests/generic/294 > index 55b24e12..4fc05082 100755 > --- a/tests/generic/294 > +++ b/tests/generic/294 > @@ -8,6 +8,7 @@ > # we ask to create an already-existing entity on an RO filesystem > # > seq=`basename $0` > +seqfull=$0 > seqres=$RESULT_DIR/$seq > echo "QA output created by $seq" > > @@ -34,6 +35,13 @@ _require_scratch > _require_symlinks > _require_mknod > > +features="" > +if ! _has_mknod; then > + echo HAS NO MKNOD $? > + features="nomknod" > +fi > +_link_out_file "$features" > + > rm -f $seqres.full > _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device" > > diff --git a/tests/generic/294.cfg b/tests/generic/294.cfg > new file mode 100644 > index 00000000..c0466cde > --- /dev/null > +++ b/tests/generic/294.cfg > @@ -0,0 +1 @@ > +nomknod: nomknod > diff --git a/tests/generic/294.out b/tests/generic/294.out > deleted file mode 100644 > index 78024728..00000000 > --- a/tests/generic/294.out > +++ /dev/null > @@ -1,5 +0,0 @@ > -QA output created by 294 > -mknod: SCRATCH_MNT/294.test/testnode: File exists > -mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > -touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > -ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists > diff --git a/tests/generic/294.out.mknod b/tests/generic/294.out.mknod > new file mode 100644 > index 00000000..4aea9d82 > --- /dev/null > +++ b/tests/generic/294.out.mknod > @@ -0,0 +1,6 @@ > +QA output created by 294 > +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted > +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system > +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists > diff --git a/tests/generic/294.out.nomknod b/tests/generic/294.out.nomknod > new file mode 100644 > index 00000000..43658aa8 > --- /dev/null > +++ b/tests/generic/294.out.nomknod > @@ -0,0 +1,7 @@ > +QA output created by 294 > +HAS NO MKNOD > +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted > +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system > +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists > >
Darrick J. Wong <djwong@kernel.org> wrote: > > + _require_mknod > > I don't see a _require_mknod being added to common/rc? It preexists: warthog>git grep _require_mknod common/rc:_require_mknod() but it seems that _has_mknod should be documented in conjunction with it so that the difference is more obvious. David
On Tue, May 25, 2021 at 05:19:41PM +0100, David Howells wrote: > Darrick J. Wong <djwong@kernel.org> wrote: > > > > + _require_mknod > > > > I don't see a _require_mknod being added to common/rc? > > It preexists: > > warthog>git grep _require_mknod > common/rc:_require_mknod() > > but it seems that _has_mknod should be documented in conjunction with it so > that the difference is more obvious. Ah, ok then. Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > > David >
On Tue, May 25, 2021 at 02:34:02PM +0100, David Howells wrote: > If mknod is not supported, some of generic/294 will fail due to that rather > than what's actually being tested - but the other subtests will still work > as before. > > Add a "_has_mknod" function that can be used to find out if the mknod tests > should be skipped. This is then used to allow the rest of generic/294 to > be employed on AFS. > > Signed-off-by: David Howells <dhowells@redhat.com> > cc: linux-afs@lists.infradead.org > --- > > common/rc | 10 ++++++++++ > doc/requirement-checking.txt | 9 +++++++++ > tests/generic/294 | 8 ++++++++ > tests/generic/294.cfg | 1 + > tests/generic/294.out | 5 ----- > tests/generic/294.out.mknod | 6 ++++++ > tests/generic/294.out.nomknod | 7 +++++++ > 7 files changed, 41 insertions(+), 5 deletions(-) > create mode 100644 tests/generic/294.cfg > delete mode 100644 tests/generic/294.out > create mode 100644 tests/generic/294.out.mknod > create mode 100644 tests/generic/294.out.nomknod > > diff --git a/common/rc b/common/rc > index f24d0e87..4ffec9a2 100644 > --- a/common/rc > +++ b/common/rc > @@ -4603,6 +4603,16 @@ _getcap() > return ${PIPESTATUS[0]} > } > > +_has_mknod() > +{ > + case $FSTYP in > + afs) > + return 1;; > + *) > + return 0;; > + esac > +} _require_mknod checks for mknod support by trying to mknod and _notrun the test if mknod fails. So does afs return any failure like EOPNOTSUPP? If so I think we could refactor _require_mknod into something like _has_mknod || _notrun "xxxx" and do the mknod check in _has_mknod, isntead of whitelist fs names. Thanks, Eryu > + > init_rc > > ################################################################################ > diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt > index 45d2756b..d31ba3fb 100644 > --- a/doc/requirement-checking.txt > +++ b/doc/requirement-checking.txt > @@ -16,6 +16,8 @@ they have. This is done with _require_<xxx> macros, which may take parameters. > > _require_chattr <letters> > _require_exportfs > + _require_mknod > + _has_mknod > > (3) System call requirements. > > @@ -97,6 +99,13 @@ _require_exportfs > The test also requires the use of the open_by_handle_at() system call and > will be skipped if it isn't available in the kernel. > > +_require_mknod > +_has_mknod > + > + The test requires that the $TEST_DEV filesystem supports mknod(2). > + _require_mknod will cause the test to be skipped; _has_mknod returns 0 if > + mknod is supported and 1 otherwise. > + > > ======================== > SYSTEM CALL REQUIREMENTS > diff --git a/tests/generic/294 b/tests/generic/294 > index 55b24e12..4fc05082 100755 > --- a/tests/generic/294 > +++ b/tests/generic/294 > @@ -8,6 +8,7 @@ > # we ask to create an already-existing entity on an RO filesystem > # > seq=`basename $0` > +seqfull=$0 > seqres=$RESULT_DIR/$seq > echo "QA output created by $seq" > > @@ -34,6 +35,13 @@ _require_scratch > _require_symlinks > _require_mknod > > +features="" > +if ! _has_mknod; then > + echo HAS NO MKNOD $? > + features="nomknod" > +fi > +_link_out_file "$features" > + > rm -f $seqres.full > _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device" > > diff --git a/tests/generic/294.cfg b/tests/generic/294.cfg > new file mode 100644 > index 00000000..c0466cde > --- /dev/null > +++ b/tests/generic/294.cfg > @@ -0,0 +1 @@ > +nomknod: nomknod > diff --git a/tests/generic/294.out b/tests/generic/294.out > deleted file mode 100644 > index 78024728..00000000 > --- a/tests/generic/294.out > +++ /dev/null > @@ -1,5 +0,0 @@ > -QA output created by 294 > -mknod: SCRATCH_MNT/294.test/testnode: File exists > -mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > -touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > -ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists > diff --git a/tests/generic/294.out.mknod b/tests/generic/294.out.mknod > new file mode 100644 > index 00000000..4aea9d82 > --- /dev/null > +++ b/tests/generic/294.out.mknod > @@ -0,0 +1,6 @@ > +QA output created by 294 > +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted > +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system > +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists > diff --git a/tests/generic/294.out.nomknod b/tests/generic/294.out.nomknod > new file mode 100644 > index 00000000..43658aa8 > --- /dev/null > +++ b/tests/generic/294.out.nomknod > @@ -0,0 +1,7 @@ > +QA output created by 294 > +HAS NO MKNOD > +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted > +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system > +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists > +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system > +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists >
Eryu Guan <guan@eryu.me> wrote: > _require_mknod checks for mknod support by trying to mknod and _notrun > the test if mknod fails. > > So does afs return any failure like EOPNOTSUPP? If so I think we could > refactor _require_mknod into something like afs doesn't provide a ->mknod implementation as it doesn't support anything you'd create with it, so you get the VFS default in such an instance - which would be EPERM. David
On Tue, Jun 01, 2021 at 03:31:52PM +0100, David Howells wrote: > Eryu Guan <guan@eryu.me> wrote: > > > _require_mknod checks for mknod support by trying to mknod and _notrun > > the test if mknod fails. > > > > So does afs return any failure like EOPNOTSUPP? If so I think we could > > refactor _require_mknod into something like > > afs doesn't provide a ->mknod implementation as it doesn't support anything > you'd create with it, so you get the VFS default in such an instance - which > would be EPERM. I think that works too. Currently _require_mknod() doesn't depend on the errno but just check if mknod succeeds or not. Thanks, Eryu
diff --git a/common/rc b/common/rc index f24d0e87..4ffec9a2 100644 --- a/common/rc +++ b/common/rc @@ -4603,6 +4603,16 @@ _getcap() return ${PIPESTATUS[0]} } +_has_mknod() +{ + case $FSTYP in + afs) + return 1;; + *) + return 0;; + esac +} + init_rc ################################################################################ diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt index 45d2756b..d31ba3fb 100644 --- a/doc/requirement-checking.txt +++ b/doc/requirement-checking.txt @@ -16,6 +16,8 @@ they have. This is done with _require_<xxx> macros, which may take parameters. _require_chattr <letters> _require_exportfs + _require_mknod + _has_mknod (3) System call requirements. @@ -97,6 +99,13 @@ _require_exportfs The test also requires the use of the open_by_handle_at() system call and will be skipped if it isn't available in the kernel. +_require_mknod +_has_mknod + + The test requires that the $TEST_DEV filesystem supports mknod(2). + _require_mknod will cause the test to be skipped; _has_mknod returns 0 if + mknod is supported and 1 otherwise. + ======================== SYSTEM CALL REQUIREMENTS diff --git a/tests/generic/294 b/tests/generic/294 index 55b24e12..4fc05082 100755 --- a/tests/generic/294 +++ b/tests/generic/294 @@ -8,6 +8,7 @@ # we ask to create an already-existing entity on an RO filesystem # seq=`basename $0` +seqfull=$0 seqres=$RESULT_DIR/$seq echo "QA output created by $seq" @@ -34,6 +35,13 @@ _require_scratch _require_symlinks _require_mknod +features="" +if ! _has_mknod; then + echo HAS NO MKNOD $? + features="nomknod" +fi +_link_out_file "$features" + rm -f $seqres.full _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device" diff --git a/tests/generic/294.cfg b/tests/generic/294.cfg new file mode 100644 index 00000000..c0466cde --- /dev/null +++ b/tests/generic/294.cfg @@ -0,0 +1 @@ +nomknod: nomknod diff --git a/tests/generic/294.out b/tests/generic/294.out deleted file mode 100644 index 78024728..00000000 --- a/tests/generic/294.out +++ /dev/null @@ -1,5 +0,0 @@ -QA output created by 294 -mknod: SCRATCH_MNT/294.test/testnode: File exists -mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists -touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system -ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists diff --git a/tests/generic/294.out.mknod b/tests/generic/294.out.mknod new file mode 100644 index 00000000..4aea9d82 --- /dev/null +++ b/tests/generic/294.out.mknod @@ -0,0 +1,6 @@ +QA output created by 294 +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists diff --git a/tests/generic/294.out.nomknod b/tests/generic/294.out.nomknod new file mode 100644 index 00000000..43658aa8 --- /dev/null +++ b/tests/generic/294.out.nomknod @@ -0,0 +1,7 @@ +QA output created by 294 +HAS NO MKNOD +mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted +mknod: SCRATCH_MNT/294.test/testnode: Read-only file system +mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists +touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system +ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists
If mknod is not supported, some of generic/294 will fail due to that rather than what's actually being tested - but the other subtests will still work as before. Add a "_has_mknod" function that can be used to find out if the mknod tests should be skipped. This is then used to allow the rest of generic/294 to be employed on AFS. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-afs@lists.infradead.org --- common/rc | 10 ++++++++++ doc/requirement-checking.txt | 9 +++++++++ tests/generic/294 | 8 ++++++++ tests/generic/294.cfg | 1 + tests/generic/294.out | 5 ----- tests/generic/294.out.mknod | 6 ++++++ tests/generic/294.out.nomknod | 7 +++++++ 7 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 tests/generic/294.cfg delete mode 100644 tests/generic/294.out create mode 100644 tests/generic/294.out.mknod create mode 100644 tests/generic/294.out.nomknod