322 Commits

Author SHA1 Message Date
Eric Biggers
cdd71f52f0 scripts/run_tests.sh: stop auto-logging to run_tests.log
This isn't useful for CI testing, which collects stdout instead.
Just remove the automatic log file for now.
2020-10-18 15:14:15 -07:00
Eric Biggers
c583b0a70c scripts, Makefile: move static_analysis_tests to a Makefile target
To further trim down run_tests.sh, move the code that runs the clang
static analyzer into a 'make' target.
2020-10-18 15:14:15 -07:00
Eric Biggers
14a5617b70 scripts: move android_tests into a new script
android_tests is only useful for local testing, and it wasn't being run
in Travis CI.  Move it into a separate script to avoid complicating
run_tests.sh.
2020-10-18 15:14:15 -07:00
Eric Biggers
6bc4596108 scripts: rename SMOKEDATA to TESTDATA
Use a more obvious name.
2020-10-18 15:14:15 -07:00
Eric Biggers
a89aba54b7 scripts: move litrunlen overflow test into a C test program
This removes the ad-hoc "edge_case" group of tests, and it removes the
dependency on Python.
2020-10-18 15:14:15 -07:00
Eric Biggers
f7138d6172 scripts: remove mips_tests
This was only useful for me to do local testing, I don't have the needed
MIPS router available anymore, and its main purpose was test a big
endian system but that's now covered by testing s390x with Travis CI.
2020-10-18 15:14:15 -07:00
Eric Biggers
50fa75455b scripts: remove windows_build.sh
This script only worked for me to do local testing and wasn't otherwise
used.  In particular, the Windows build tests in Travis CI don't use
this script, nor does the make-windows-releases script use it.
2020-10-18 15:14:15 -07:00
Eric Biggers
ca42459cd7 scripts/run_tests.sh: be compatible with old bash versions
Prior to bash 4.4, using an empty array with 'set -u' produced an error.
Work around it.
2020-10-18 15:14:15 -07:00
Eric Biggers
68a5b89a1b scripts/produce_gzip_benchmark_table.sh: clean up
Address all shellcheck warnings, avoid hardcoded path, and add
'-u -o pipefail'.
2020-10-18 15:14:15 -07:00
Eric Biggers
61583588cd scripts/make-window-releases.sh: address all shellcheck warnings
Also add '-o pipefail'.
2020-10-18 15:14:15 -07:00
Eric Biggers
44980854d3 scripts/gzip_tests.sh: address all shellcheck warnings 2020-10-18 15:14:15 -07:00
Eric Biggers
ea4d0c9919 scripts/gzip_tests.sh: remove test for decreasing size as level increases
Compression is based on heuristics, so we can't guarantee in every
circumstance that the compression ratio will improve as the compression
level increases.  The tests need to be 100% reliable though, so drop
this part of the test.
2020-10-18 15:14:15 -07:00
Eric Biggers
ddb3db2050 scripts/gzip_tests.sh: skip if GNU gzip/gunzip is too old 2020-10-18 15:14:15 -07:00
Eric Biggers
455e9c2c3e scripts/gzip_tests.sh: work around broken timestamps in Travis CI 2020-10-18 15:14:15 -07:00
Eric Biggers
b6f9462708 scripts/gzip_tests.sh: be compatible with old coreutils versions
Very old versions of coreutils don't have 'realpath'.
Use the more portable 'readlink -f' instead.
2020-10-18 15:14:15 -07:00
Eric Biggers
57ddb0571c scripts/exec_tests.sh: address shellcheck warnings 2020-10-18 15:14:15 -07:00
Eric Biggers
c509497a54 scripts/detect.sh: clean up
Remove the need to use a temporary file, fix all the shellcheck
warnings, and add 'set -eu'.
2020-10-18 15:14:15 -07:00
Eric Biggers
b87bd659fd scripts/checksum_benchmarks.sh: address all shellcheck warnings 2020-10-18 15:14:15 -07:00
Eric Biggers
fe04c9e60f scripts/android_build.sh: address shellcheck warnings 2020-10-18 15:14:15 -07:00
Eric Biggers
2c0223afc8 scripts: add .sh suffix to make-windows-releases
All the other shell scripts have it.
2020-10-18 15:14:15 -07:00
Eric Biggers
2cb8c2142d scripts: move detect.sh into scripts directory
This is a shell script, so move it into the scripts directory.
2020-10-18 15:14:15 -07:00
Eric Biggers
bf50c64e86 scripts: rename tools/ directory to scripts/
"scripts" is a more descriptive name than "tools", which sounds too
similar to "programs".
2020-10-18 15:14:15 -07:00
Eric Biggers
eb54d9e257 programs/test_util.c: don't be noisy about skipping perf tests 2020-10-18 15:14:15 -07:00
Eric Biggers
cda4447098 programs/test_*: remove unnecessary 'tests passed' messages 2020-10-18 15:14:15 -07:00
Eric Biggers
303bb42c52 Makefile: allow disabling compiler warnings
Move the user-specified CFLAGS to the end of the CFLAGS definition, so
that warnings the Makefile enables can be disabled using -Wno-$foo.
This is useful when old compilers give false positive warnings.
2020-10-18 15:14:15 -07:00
Eric Biggers
ef936b6521 lib/x86/adler32: use unsigned vector types
This is needed to avoid the following error when using
-fsanitize=undefined with gcc:

    lib/x86/adler32_impl.h:214:2: runtime error: signed integer overflow:
    1951294680 + 1956941400 cannot be represented in type 'int'

Note that this isn't seen when using -fsanitize=undefined with clang.

Old compilers don't have unsigned vector types, so work around that.
2020-10-18 15:14:15 -07:00
Even Rouault
40ab2ded18 .travis.yml: add s390x target to test big-endian 64bit arch 2020-10-17 09:44:59 -07:00
Kyle Barron
fba986bf48 Add Python to bindings list 2020-10-15 18:25:20 -07:00
Eric Biggers
ea88fa822f lib/arm/crc32: add support for ARM CRC32 instructions
Add a CRC32 implementation that uses the ARM CRC32 instructions.

This is simpler and faster than the PMULL implementation.  On AWS
Graviton2, the performance improvement is about 70%.  On Hikey960, the
performance improvement is about 30% for the Cortex-A53 cores or about
5% for the Cortex-A73 cores.

Based on work by Greg V <greg@unrelenting.technology>
(https://github.com/ebiggers/libdeflate/pull/45)
and Andrew Steinborn <git@steinborn.me>
(https://github.com/ebiggers/libdeflate/pull/76).
2020-10-10 23:03:50 -07:00
Eric Biggers
2eeaa9282e lib/arm/cpu_features: recognize the crc32 feature
If support for CRC32 instructions is detected, set
ARM_CPU_FEATURE_CRC32.  Also define
COMPILER_SUPPORTS_CRC32_TARGET_INTRINSICS when appropriate, and update
run_tests.sh to toggle the crc32 feature for testing.
2020-10-10 23:03:50 -07:00
Eric Biggers
7373bdc9ff lib/arm/cpu_features: reorganize arm feature macros
Reorganize up some confusing logic.
2020-10-10 23:03:50 -07:00
Eric Biggers
3b9775d4aa tools/android_build.sh: update for latest NDK
android_build.sh no longer works with recent NDKs, and it has a lot of
logic to use old NDKs directly that wasn't really necessary because it
could have just required standalone toolchains instead.

Recent NDKs (r19 and later) come with standalone toolchains by default.
Also, they now only include clang, not gcc.

Modify the script to just support these recent NDKs.  Also, default to
arm64 and add support for enabling CRC instructions.
2020-10-10 23:03:50 -07:00
Eric Biggers
4c92394eaa Support level 0, "no compression"
Some users may require a valid DEFLATE, zlib, or gzip stream but know
ahead of time that particular inputs are not compressible.  zlib
supports "level 0" for this use case.  Support this in libdeflate too.

Resolves https://github.com/ebiggers/libdeflate/issues/86
2020-10-10 22:31:15 -07:00
Eric Biggers
e98ddd6612 libdeflate.h: document invalid compression level error
Somehow this was missing from the documentation.
2020-10-10 14:48:57 -07:00
Eric Biggers
ec60cb48d1 tools/run_tests.sh: test different combinations of CPU features
Using LIBDEFLATE_DISABLE_CPU_FEATURES, try to ensure that all variants
of dynamically-dispatched code get tested.
2020-10-05 00:35:19 -07:00
Eric Biggers
79cf77a42e tools/checksum_benchmarks.sh: use LIBDEFLATE_DISABLE_CPU_FEATURES
To test the different CRC-32 and Adler-32 implementations, use
LIBDEFLATE_DISABLE_CPU_FEATURES instead of running some hack-ish
'sed' commands to edit the source code.
2020-10-05 00:35:19 -07:00
Eric Biggers
c5e7c3f1ff tools/checksum_benchmarks.sh: add cflag to disable pmull support
Currently this doesn't matter because the compilers don't enable pmull
support by default, but technically this should be there.
2020-10-05 00:35:19 -07:00
Eric Biggers
5729095d2d lib/cpu_features: support disabling CPU features for testing
Make test-only builds of libdeflate support an environmental variable
LIBDEFLATE_DISABLE_CPU_FEATURES that contains a list of CPU features to
disable like "avx512bw,avx2,sse2".

This makes it possible to test all the variants of dynamically
dispatched code without editing the source code.

Note, this environmental variable is not a stable interface, so put the
support for it behind a scary-looking option TEST_SUPPORT__DO_NOT_USE.
2020-10-05 00:35:19 -07:00
Eric Biggers
f23fd6ca7f lib/x86/cpu_features: rename PCLMULQDQ feature bit to PCLMUL
This is less unwieldy and is consistent with "DISPATCH_PCLMUL" and with
the "-mno-pclmul" compiler flag.
2020-10-05 00:35:19 -07:00
Eric Biggers
82037908c7 lib/x86/cpu_features: add missing earlyclobber constraint for cpuid on i386
In cpuid() in the '__i386__ && __PIC__' case, the second output operand
is written to before the input operands are used.  So the second output
operand needs the earlyclobber constraint.
2020-10-04 23:17:56 -07:00
Eric Biggers
9702f9fa86 README.md: add links to third-party bindings
Resolves https://github.com/ebiggers/libdeflate/issues/70
2020-10-04 15:18:43 -07:00
Eric Biggers
d225042a51 Makefile: support 'install' and 'uninstall' with Windows builds
Resolves https://github.com/ebiggers/libdeflate/pull/72
2020-10-04 11:31:30 -07:00
Andrew Steinborn
4e1f1a2d7f Add arm64 jobs to Travis build matrix. 2020-10-04 09:43:23 -07:00
Eric Biggers
303aecb074 lib/utils.c: improve header include order
Don't assume that lib_common.h and libdeflate.h don't include
<stdlib.h>.  Currently this change doesn't matter unless someone uses
-DFREESTANDING for a Windows build, which isn't supported anyway, but we
might as well clean this up.

Update https://github.com/ebiggers/libdeflate/pull/68
2020-10-04 09:42:05 -07:00
Seeker
5f732c1524 Install shared lib symlink as dylib on macOS 2020-08-24 21:13:38 -07:00
SeekingMeaning
675be1ccf8 README.md: add macOS subsection (#66) 2020-07-03 11:24:20 -07:00
Eric Biggers
753d4a1a62 v1.6 v1.6 2020-05-12 19:42:04 -07:00
Eric Biggers
0f5238f0ad lib: remove the "packed struct" approach to unaligned memory access
gcc 10 is miscompiling libdeflate on x86_64 at -O3 due to a regression
in how packed structs are handled
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94994).

Work around this by just always using memcpy() for unaligned accesses.
It's unclear that the "packed struct" approach is worthwhile to maintain
anymore.  Currently I'm only aware that it's useful with old gcc's on
arm32.  Hopefully, compilers are good enough now that we can simply use
memcpy() everywhere.

Update https://github.com/ebiggers/libdeflate/issues/64
2020-05-08 23:03:58 -07:00
Eric Biggers
14be043724 lib: fix memcpy() performance with freestanding library builds
With -ffreestanding, for memcpy() to be optimized properly when used for
unaligned accesses, we need to use __builtin_memcpy().
2020-05-08 23:03:58 -07:00
Eric Biggers
3dfd93e365 lib, programs: include common_defs.h by relative path
It's better to use a relative path, so that people not using the
Makefile don't have to put -Icommon on their compiler command line.
2020-05-08 23:03:58 -07:00