binutils-gdb/libctf/testsuite/libctf-writable
Nick Alcock 36c771b179
libctf: fix CTF dict compression
Commit 483546ce4f ("libctf: make ctf_serialize() actually serialize")
accidentally broke dict compression.  There were two bugs:

 - ctf_arc_write_one_ctf was still making its own decision about
   whether to compress the dict via direct ctf_size comparison, which is
   unfortunate because now that it no longer calls ctf_serialize itself,
   ctf_size is always zero when it does this: it should let the writing
   functions decide on the threshold, which they contain code to do which is
   simply not used for lack of one trivial wrapper to write to an fd and
   also provide a compression threshold

 - ctf_write_mem, the function underlying all writing as of the commit
   above, was calling zlib's compressBound and avoiding compression if this
   returned a value larger than the input.  Unfortunately compressBound does
   not do a trial compression and determine whether the result is
   compressible: it just adds zlib header sizes to the value passed in, so
   our test would *always* have concluded that the value was incompressible!
   Avoid by simply always compressing if the raw size is larger than the
   threshold: zlib is quite clever enough to avoid actually compressing
   if the data is incompressible.

Add a testcase for this.

libctf/
	* ctf-impl.h (ctf_write_thresholded): New...
	* ctf-serialize.c (ctf_write_thresholded): ... defined here,
        a wrapper around...
        (ctf_write_mem): ... this.  Don't check compressibility.
	(ctf_compress_write): Reimplement as a ctf_write_thresholded
        wrapper.
	(ctf_write): Likewise.
	* ctf-archive.c (arc_write_one_ctf): Just call
        ctf_write_thresholded rather than trying to work out whether
        to compress.
	* testsuite/libctf-writable/ctf-compressed.*: New test.
2024-07-31 21:02:05 +01:00
..
ctf-compressed.c libctf: fix CTF dict compression 2024-07-31 21:02:05 +01:00
ctf-compressed.lk libctf: fix CTF dict compression 2024-07-31 21:02:05 +01:00
ctf-nonroot-linking.c libctf: fix linking of non-root-visible types 2024-07-31 21:02:05 +01:00
ctf-nonroot-linking.lk libctf: fix linking of non-root-visible types 2024-07-31 21:02:05 +01:00
error-propagation.c libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
error-propagation.lk libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
libctf-bitfield-name-lookup.c libctf: fix name lookup in dicts containing base-type bitfields 2024-04-19 16:14:46 +01:00
libctf-bitfield-name-lookup.lk libctf: fix name lookup in dicts containing base-type bitfields 2024-04-19 16:14:46 +01:00
libctf-errors.c libctf: fix uninitialized variables in testsuite 2024-03-11 17:16:12 +00:00
libctf-errors.lk libctf: check for problems with error returns 2023-10-18 12:41:00 +01:00
parent-child-dtd-crash-lib.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-enum.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-enum.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-enumerator.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-enumerator.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-member-encoded.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-member-encoded.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-member-offset.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-member-offset.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-set-array.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-set-array.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-struct.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-struct.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-union.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
parent-child-dtd-union.lk libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
pptrtab-writable-page-deep-lookup.c libctf, lookup: fix bounds of pptrtab lookup 2021-09-27 20:31:26 +01:00
pptrtab-writable-page-deep-lookup.lk libctf, lookup: fix bounds of pptrtab lookup 2021-09-27 20:31:26 +01:00
pptrtab.c libctf, testsuite: fix various warnings in tests 2021-09-27 20:31:26 +01:00
pptrtab.lk
reserialize-strtab-corruption.c libctf, testsuite: fix various warnings in tests 2021-09-27 20:31:26 +01:00
reserialize-strtab-corruption.lk libctf: do not corrupt strings across ctf_serialize 2021-03-18 12:40:40 +00:00
symtypetab-nonlinker-writeout.c libctf, testsuite: fix various warnings in tests 2021-09-27 20:31:26 +01:00
symtypetab-nonlinker-writeout.lk
writable.exp Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30