* [PATCH] check: force hostname to be unique
@ 2019-01-11 21:54 Luis Chamberlain
2019-01-16 8:12 ` Eryu Guan
0 siblings, 1 reply; 3+ messages in thread
From: Luis Chamberlain @ 2019-01-11 21:54 UTC (permalink / raw)
To: fstests; +Cc: Luis Chamberlain
If you use a hostname which is part of the output of
standard tools you end up with failures with fstests
due to differences in output against the golden output.
The failures are false positives due to the hostname.
For instance if you hostname is 'xfs' _dump_filter_main()
will substitute the initiial 'xfs' with HOSTNAME as part
of your logs, and will fail the output will fail against
the golden output on say all xfsdump / xfsrestores tests.
The hostname must be a unique string, not used as part
of the output from any tool used when capturing output.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
We could be more pedantic about uniqueness, but this should suffice at
last of most issues.
README | 2 ++
check | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/README b/README
index 73f057f3..7128da67 100644
--- a/README
+++ b/README
@@ -22,6 +22,8 @@ _______________________
- create fsgqa test user ("sudo useradd fsgqa")
- create fsgqa group ("sudo groupadd fsgqa")
- create 123456-fsgqa test user ("sudo useradd 123456-fsgqa")
+- assign a unique hostname to the test system. It must not clash with
+ any word used on output by standard tools or tools for your filesystem.
______________________
USING THE FSQA SUITE
diff --git a/check b/check
index 77a06b00..3a0bb026 100755
--- a/check
+++ b/check
@@ -251,6 +251,40 @@ _prepare_test_list()
fi
}
+_invalid_hostname()
+{
+ host_check=`hostname`
+
+ case $host_check in
+ xfs)
+ return 1;
+ ;;
+ btrfs)
+ return 1;
+ ;;
+ ext4)
+ return 1;
+ ;;
+ ext3)
+ return 1;
+ ;;
+ ext2)
+ return 1;
+ ;;
+ esac
+
+ return 0
+}
+
+_check_unique_hostname()
+{
+ _invalid_hostname
+ if [ $? -ne -0 ]; then
+ echo "Hostname `hostname` is not unique, make a unique hostname to avoid output log clashes with tools"
+ exit 1
+ fi
+}
+
# Process command arguments first.
while [ $# -gt 0 ]; do
case "$1" in
@@ -371,6 +405,8 @@ then
exit 1
fi
+_check_unique_hostname
+
_wipe_counters()
{
n_try="0"
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] check: force hostname to be unique
2019-01-11 21:54 [PATCH] check: force hostname to be unique Luis Chamberlain
@ 2019-01-16 8:12 ` Eryu Guan
2019-01-24 16:45 ` Luis Chamberlain
0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2019-01-16 8:12 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: fstests
On Fri, Jan 11, 2019 at 01:54:20PM -0800, Luis Chamberlain wrote:
> If you use a hostname which is part of the output of
> standard tools you end up with failures with fstests
> due to differences in output against the golden output.
>
> The failures are false positives due to the hostname.
> For instance if you hostname is 'xfs' _dump_filter_main()
> will substitute the initiial 'xfs' with HOSTNAME as part
> of your logs, and will fail the output will fail against
> the golden output on say all xfsdump / xfsrestores tests.
>
> The hostname must be a unique string, not used as part
> of the output from any tool used when capturing output.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
IMHO, a better fix would be improving the regexp in _dump_filter_main to
match hostname more precisely. I did the following update and it seemed
to work fine, I tested with '-g dump' and all tests passed (some tests
_notrun due to missing tape device).
--- a/common/dump
+++ b/common/dump
@@ -826,7 +826,8 @@ _dump_filter_main()
-e "s#$__XFSDUMP_PROG#xfsdump#" \
-e "s#$XFSRESTORE_PROG#xfsrestore#" \
-e "s#$XFSINVUTIL_PROG#xfsinvutil#" \
- -e "s/`hostname`/HOSTNAME/" \
+ -e "s/`hostname`:/HOSTNAME:/" \
+ -e "s/: `hostname`/: HOSTNAME/" \
-e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
-e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
-e "s#$dumptape#TAPE_DEV#" \
It's based on the fact that there're basically two patterns that contain
'HOSTNAME':
xfsrestore: hostname: HOSTNAME
xfsdump: level 0 dump of HOSTNAME:SCRATCH_MNT
Thanks,
Eryu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] check: force hostname to be unique
2019-01-16 8:12 ` Eryu Guan
@ 2019-01-24 16:45 ` Luis Chamberlain
0 siblings, 0 replies; 3+ messages in thread
From: Luis Chamberlain @ 2019-01-24 16:45 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
On Wed, Jan 16, 2019 at 04:12:12PM +0800, Eryu Guan wrote:
> On Fri, Jan 11, 2019 at 01:54:20PM -0800, Luis Chamberlain wrote:
> > If you use a hostname which is part of the output of
> > standard tools you end up with failures with fstests
> > due to differences in output against the golden output.
> >
> > The failures are false positives due to the hostname.
> > For instance if you hostname is 'xfs' _dump_filter_main()
> > will substitute the initiial 'xfs' with HOSTNAME as part
> > of your logs, and will fail the output will fail against
> > the golden output on say all xfsdump / xfsrestores tests.
> >
> > The hostname must be a unique string, not used as part
> > of the output from any tool used when capturing output.
> >
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>
> IMHO, a better fix would be improving the regexp in _dump_filter_main to
> match hostname more precisely. I did the following update and it seemed
> to work fine, I tested with '-g dump' and all tests passed (some tests
> _notrun due to missing tape device).
>
> --- a/common/dump
> +++ b/common/dump
> @@ -826,7 +826,8 @@ _dump_filter_main()
> -e "s#$__XFSDUMP_PROG#xfsdump#" \
> -e "s#$XFSRESTORE_PROG#xfsrestore#" \
> -e "s#$XFSINVUTIL_PROG#xfsinvutil#" \
> - -e "s/`hostname`/HOSTNAME/" \
> + -e "s/`hostname`:/HOSTNAME:/" \
> + -e "s/: `hostname`/: HOSTNAME/" \
> -e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
> -e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
> -e "s#$dumptape#TAPE_DEV#" \
>
> It's based on the fact that there're basically two patterns that contain
> 'HOSTNAME':
>
> xfsrestore: hostname: HOSTNAME
> xfsdump: level 0 dump of HOSTNAME:SCRATCH_MNT
Works for me but this is still pretty fragile, and it does not cover
the what other filesystems use as best-practices for issuign a hostname
either. Even if we consider xfs: are we *certain* that the above regexp
covers all output issued by xfs utils when hostname is used? We're
talking about a generic rule of thumb here.
So I'd say we do both for now. Just my 0.01 CRC.
Luis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-24 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-11 21:54 [PATCH] check: force hostname to be unique Luis Chamberlain
2019-01-16 8:12 ` Eryu Guan
2019-01-24 16:45 ` Luis Chamberlain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox