* [PATCH] libfrog: drop build host crc32 selftest
@ 2023-09-27 6:38 Krzesimir Nowak
2023-09-27 14:27 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Krzesimir Nowak @ 2023-09-27 6:38 UTC (permalink / raw)
To: linux-xfs; +Cc: Krzesimir Nowak
CRC selftests running on a build host were useful long time ago, when
CRC support was added to the on-disk support. Now it's purpose is
replaced by fstests. Also mkfs.xfs and xfs_repair have their own
selftests.
On top of that, it fails to build when crosscompiling and would be
useless anyway.
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
---
libfrog/Makefile | 14 ++------------
libfrog/crc32.c | 21 ---------------------
2 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/libfrog/Makefile b/libfrog/Makefile
index f292afe3..8cde97d4 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -57,9 +57,9 @@ ifeq ($(HAVE_GETMNTENT),yes)
LCFLAGS += -DHAVE_GETMNTENT
endif
-LDIRT = gen_crc32table crc32table.h crc32selftest
+LDIRT = gen_crc32table crc32table.h
-default: crc32selftest ltdepend $(LTLIBRARY)
+default: ltdepend $(LTLIBRARY)
crc32table.h: gen_crc32table.c crc32defs.h
@echo " [CC] gen_crc32table"
@@ -67,16 +67,6 @@ crc32table.h: gen_crc32table.c crc32defs.h
@echo " [GENERATE] $@"
$(Q) ./gen_crc32table > crc32table.h
-# The selftest binary will return an error if it fails. This is made a
-# dependency of the build process so that we refuse to build the tools on broken
-# systems/architectures. Hence we make sure that xfsprogs will never use a
-# busted CRC calculation at build time and hence avoid putting bad CRCs down on
-# disk.
-crc32selftest: gen_crc32table.c crc32table.h crc32.c crc32defs.h randbytes.c
- @echo " [TEST] CRC32"
- $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 randbytes.c crc32.c -o $@
- $(Q) ./$@
-
include $(BUILDRULES)
install install-dev: default
diff --git a/libfrog/crc32.c b/libfrog/crc32.c
index 2499615d..d07e5371 100644
--- a/libfrog/crc32.c
+++ b/libfrog/crc32.c
@@ -186,24 +186,3 @@ u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len)
(const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
}
#endif
-
-
-#ifdef CRC32_SELFTEST
-# include "crc32cselftest.h"
-
-/*
- * make sure we always return 0 for a successful test run, and non-zero for a
- * failed run. The build infrastructure is looking for this information to
- * determine whether to allow the build to proceed.
- */
-int main(int argc, char **argv)
-{
- int errors;
-
- printf("CRC_LE_BITS = %d\n", CRC_LE_BITS);
-
- errors = crc32c_test(0);
-
- return errors != 0;
-}
-#endif /* CRC32_SELFTEST */
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libfrog: drop build host crc32 selftest
2023-09-27 6:38 [PATCH] libfrog: drop build host crc32 selftest Krzesimir Nowak
@ 2023-09-27 14:27 ` Darrick J. Wong
2023-09-28 11:19 ` Krzesimir Nowak
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2023-09-27 14:27 UTC (permalink / raw)
To: Krzesimir Nowak; +Cc: linux-xfs, Krzesimir Nowak
On Wed, Sep 27, 2023 at 08:38:47AM +0200, Krzesimir Nowak wrote:
> CRC selftests running on a build host were useful long time ago, when
> CRC support was added to the on-disk support. Now it's purpose is
> replaced by fstests. Also mkfs.xfs and xfs_repair have their own
> selftests.
>
> On top of that, it fails to build when crosscompiling and would be
> useless anyway.
Nit: It doesn't fail if the crosscompile host itself has liburcu
installed.
> Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Nits aside, this is a good simplification of the build process, so:
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> libfrog/Makefile | 14 ++------------
> libfrog/crc32.c | 21 ---------------------
> 2 files changed, 2 insertions(+), 33 deletions(-)
>
> diff --git a/libfrog/Makefile b/libfrog/Makefile
> index f292afe3..8cde97d4 100644
> --- a/libfrog/Makefile
> +++ b/libfrog/Makefile
> @@ -57,9 +57,9 @@ ifeq ($(HAVE_GETMNTENT),yes)
> LCFLAGS += -DHAVE_GETMNTENT
> endif
>
> -LDIRT = gen_crc32table crc32table.h crc32selftest
> +LDIRT = gen_crc32table crc32table.h
>
> -default: crc32selftest ltdepend $(LTLIBRARY)
> +default: ltdepend $(LTLIBRARY)
>
> crc32table.h: gen_crc32table.c crc32defs.h
> @echo " [CC] gen_crc32table"
> @@ -67,16 +67,6 @@ crc32table.h: gen_crc32table.c crc32defs.h
> @echo " [GENERATE] $@"
> $(Q) ./gen_crc32table > crc32table.h
>
> -# The selftest binary will return an error if it fails. This is made a
> -# dependency of the build process so that we refuse to build the tools on broken
> -# systems/architectures. Hence we make sure that xfsprogs will never use a
> -# busted CRC calculation at build time and hence avoid putting bad CRCs down on
> -# disk.
> -crc32selftest: gen_crc32table.c crc32table.h crc32.c crc32defs.h randbytes.c
> - @echo " [TEST] CRC32"
> - $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 randbytes.c crc32.c -o $@
> - $(Q) ./$@
> -
> include $(BUILDRULES)
>
> install install-dev: default
> diff --git a/libfrog/crc32.c b/libfrog/crc32.c
> index 2499615d..d07e5371 100644
> --- a/libfrog/crc32.c
> +++ b/libfrog/crc32.c
> @@ -186,24 +186,3 @@ u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len)
> (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
> }
> #endif
> -
> -
> -#ifdef CRC32_SELFTEST
> -# include "crc32cselftest.h"
> -
> -/*
> - * make sure we always return 0 for a successful test run, and non-zero for a
> - * failed run. The build infrastructure is looking for this information to
> - * determine whether to allow the build to proceed.
> - */
> -int main(int argc, char **argv)
> -{
> - int errors;
> -
> - printf("CRC_LE_BITS = %d\n", CRC_LE_BITS);
> -
> - errors = crc32c_test(0);
> -
> - return errors != 0;
> -}
> -#endif /* CRC32_SELFTEST */
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libfrog: drop build host crc32 selftest
2023-09-27 14:27 ` Darrick J. Wong
@ 2023-09-28 11:19 ` Krzesimir Nowak
0 siblings, 0 replies; 3+ messages in thread
From: Krzesimir Nowak @ 2023-09-28 11:19 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, Krzesimir Nowak
śr., 27 wrz 2023 o 16:27 Darrick J. Wong <djwong@kernel.org> napisał(a):
>
> On Wed, Sep 27, 2023 at 08:38:47AM +0200, Krzesimir Nowak wrote:
> > CRC selftests running on a build host were useful long time ago, when
> > CRC support was added to the on-disk support. Now it's purpose is
> > replaced by fstests. Also mkfs.xfs and xfs_repair have their own
> > selftests.
> >
> > On top of that, it fails to build when crosscompiling and would be
> > useless anyway.
>
> Nit: It doesn't fail if the crosscompile host itself has liburcu
> installed.
Right, our (Flatcar SDK) host didn't. I'll amend the commit message and resend.
>
> > Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
>
> Nits aside, this is a good simplification of the build process, so:
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
>
Thanks!
> --D
>
> > ---
> > libfrog/Makefile | 14 ++------------
> > libfrog/crc32.c | 21 ---------------------
> > 2 files changed, 2 insertions(+), 33 deletions(-)
> >
> > diff --git a/libfrog/Makefile b/libfrog/Makefile
> > index f292afe3..8cde97d4 100644
> > --- a/libfrog/Makefile
> > +++ b/libfrog/Makefile
> > @@ -57,9 +57,9 @@ ifeq ($(HAVE_GETMNTENT),yes)
> > LCFLAGS += -DHAVE_GETMNTENT
> > endif
> >
> > -LDIRT = gen_crc32table crc32table.h crc32selftest
> > +LDIRT = gen_crc32table crc32table.h
> >
> > -default: crc32selftest ltdepend $(LTLIBRARY)
> > +default: ltdepend $(LTLIBRARY)
> >
> > crc32table.h: gen_crc32table.c crc32defs.h
> > @echo " [CC] gen_crc32table"
> > @@ -67,16 +67,6 @@ crc32table.h: gen_crc32table.c crc32defs.h
> > @echo " [GENERATE] $@"
> > $(Q) ./gen_crc32table > crc32table.h
> >
> > -# The selftest binary will return an error if it fails. This is made a
> > -# dependency of the build process so that we refuse to build the tools on broken
> > -# systems/architectures. Hence we make sure that xfsprogs will never use a
> > -# busted CRC calculation at build time and hence avoid putting bad CRCs down on
> > -# disk.
> > -crc32selftest: gen_crc32table.c crc32table.h crc32.c crc32defs.h randbytes.c
> > - @echo " [TEST] CRC32"
> > - $(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 randbytes.c crc32.c -o $@
> > - $(Q) ./$@
> > -
> > include $(BUILDRULES)
> >
> > install install-dev: default
> > diff --git a/libfrog/crc32.c b/libfrog/crc32.c
> > index 2499615d..d07e5371 100644
> > --- a/libfrog/crc32.c
> > +++ b/libfrog/crc32.c
> > @@ -186,24 +186,3 @@ u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len)
> > (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
> > }
> > #endif
> > -
> > -
> > -#ifdef CRC32_SELFTEST
> > -# include "crc32cselftest.h"
> > -
> > -/*
> > - * make sure we always return 0 for a successful test run, and non-zero for a
> > - * failed run. The build infrastructure is looking for this information to
> > - * determine whether to allow the build to proceed.
> > - */
> > -int main(int argc, char **argv)
> > -{
> > - int errors;
> > -
> > - printf("CRC_LE_BITS = %d\n", CRC_LE_BITS);
> > -
> > - errors = crc32c_test(0);
> > -
> > - return errors != 0;
> > -}
> > -#endif /* CRC32_SELFTEST */
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-28 11:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27 6:38 [PATCH] libfrog: drop build host crc32 selftest Krzesimir Nowak
2023-09-27 14:27 ` Darrick J. Wong
2023-09-28 11:19 ` Krzesimir Nowak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).