diff options
-rw-r--r-- | .github/workflows/ci.yml | 4 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/lz4file.c | 4 | ||||
-rw-r--r-- | lib/lz4file.h | 2 | ||||
-rw-r--r-- | tests/Makefile | 61 | ||||
-rw-r--r-- | tests/freestanding.c | 1 |
6 files changed, 53 insertions, 21 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf8f94c..e3da024 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,8 +60,8 @@ jobs: { pkgs: 'lib32gcc-11-dev libx32gcc-11-dev', cc: clang, cxx: clang++, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-latest, }, { pkgs: 'clang-14 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-14, cxx: clang++-14, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, { pkgs: 'clang-13 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-13, cxx: clang++-13, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, - { pkgs: 'clang-12 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-12, cxx: clang++-12, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, - { pkgs: 'clang-11 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-11, cxx: clang++-11, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-12 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-12, cxx: clang++-12, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, + { pkgs: 'clang-11 lib32gcc-12-dev libx32gcc-12-dev', cc: clang-11, cxx: clang++-11, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-22.04, }, { pkgs: 'clang-10 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-10, cxx: clang++-10, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, { pkgs: 'clang-9 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-9, cxx: clang++-9, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, { pkgs: 'clang-8 lib32gcc-11-dev libx32gcc-11-dev', cc: clang-8, cxx: clang++-8, x32: 'true', x86: 'true', cxxtest: 'true', freestanding: 'false', os: ubuntu-20.04, }, diff --git a/lib/Makefile b/lib/Makefile index ee262c0..a7dbea2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -189,6 +189,7 @@ install: lib liblz4.pc ifeq ($(BUILD_STATIC),yes) $(INSTALL_DATA) liblz4.a $(DESTDIR)$(libdir)/liblz4.a $(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(includedir)/lz4frame_static.h + $(INSTALL_DATA) lz4file.h $(DESTDIR)$(includedir)/lz4file.h endif ifeq ($(BUILD_SHARED),yes) # Traditionally, one installs the DLLs in the bin directory as programs @@ -224,6 +225,7 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/lz4hc.h $(RM) $(DESTDIR)$(includedir)/lz4frame.h $(RM) $(DESTDIR)$(includedir)/lz4frame_static.h + $(RM) $(DESTDIR)$(includedir)/lz4file.h @echo lz4 libraries successfully uninstalled endif diff --git a/lib/lz4file.c b/lib/lz4file.c index eaf9b17..982afe4 100644 --- a/lib/lz4file.c +++ b/lib/lz4file.c @@ -247,9 +247,9 @@ LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4 return LZ4F_OK_NoError; } -size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size) +size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, const void* buf, size_t size) { - LZ4_byte* p = (LZ4_byte*)buf; + const LZ4_byte* p = (const LZ4_byte*)buf; size_t remain = size; size_t chunk; size_t ret; diff --git a/lib/lz4file.h b/lib/lz4file.h index 5527130..723552c 100644 --- a/lib/lz4file.h +++ b/lib/lz4file.h @@ -78,7 +78,7 @@ LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, * `buf` write data buffer. * `size` write data buffer size. */ -LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size); +LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, const void* buf, size_t size); /*! LZ4F_writeClose() : * Close lz4file handle. diff --git a/tests/Makefile b/tests/Makefile index b446e4e..a24185c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -115,9 +115,6 @@ decompress-partial: lz4.o decompress-partial.c decompress-partial-usingDict: lz4.o decompress-partial-usingDict.c $(CC) $(FLAGS) $^ -o $@$(EXT) -freestanding: freestanding.c - $(CC) -ffreestanding -nostdlib $^ -o $@$(EXT) - .PHONY: clean clean: @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) @@ -214,53 +211,53 @@ test-compile-with-lz4-memory-usage: # and only their test files : do not employ sweeping statements such `rm tmp*` or `rm *.lz4` test-lz4-sparse: lz4 datagen @echo "\n ---- test sparse file support ----" - PATH=$(PATH) ./test-lz4-sparse.sh + ./test-lz4-sparse.sh test-lz4-contentSize: lz4 datagen @echo "\n ---- test original size support ----" - PATH=$(PATH) ./test-lz4-contentSize.sh + ./test-lz4-contentSize.sh test-lz4-frame-concatenation: lz4 datagen @echo "\n ---- test frame concatenation ----" - PATH=$(PATH) ./test-lz4-frame-concatenation.sh + ./test-lz4-frame-concatenation.sh test-lz4-multiple: lz4 datagen @echo "\n ---- test multiple files ----" - PATH=$(PATH) ./test-lz4-multiple.sh + ./test-lz4-multiple.sh test-lz4-multiple-legacy: lz4 datagen @echo "\n ---- test multiple files (Legacy format) ----" - PATH=$(PATH) ./test-lz4-multiple-legacy.sh + ./test-lz4-multiple-legacy.sh test-lz4-skippable: lz4 @echo "\n ---- test lz4 with skippable frames ----" - PATH=$(PATH) ./test-lz4-skippable.sh + ./test-lz4-skippable.sh test-lz4-basic: lz4 datagen unlz4 lz4cat @echo "\n ---- test lz4 basic compression/decompression ----" - PATH=$(PATH) ./test-lz4-basic.sh + ./test-lz4-basic.sh test-lz4-dict: lz4 datagen @echo "\n ---- test lz4 compression/decompression with dictionary ----" - PATH=$(PATH) ./test-lz4-dict.sh + ./test-lz4-dict.sh test-lz4hc-hugefile: lz4 datagen @echo "\n ---- test HC compression/decompression of huge files ----" - PATH=$(PATH) ./test-lz4hc-hugefile.sh + ./test-lz4hc-hugefile.sh test-lz4-fast-hugefile: lz4 datagen @echo "\n ---- test huge files compression/decompression ----" - PATH=$(PATH) ./test-lz4-fast-hugefile.sh + ./test-lz4-fast-hugefile.sh test-lz4-hugefile: test-lz4-fast-hugefile test-lz4hc-hugefile test-lz4-testmode: lz4 datagen @echo "\n ---- bench mode ----" - PATH=$(PATH) ./test-lz4-testmode.sh + ./test-lz4-testmode.sh test-lz4-opt-parser: lz4 datagen @echo "\n ---- test opt-parser ----" - PATH=$(PATH) ./test-lz4-opt-parser.sh + ./test-lz4-opt-parser.sh test-lz4-essentials : lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-multiple-legacy \ test-lz4-frame-concatenation test-lz4-testmode \ @@ -353,10 +350,44 @@ test-decompress-partial : decompress-partial decompress-partial-usingDict @echo "\n ---- test decompress-partial-usingDict ----" ./decompress-partial-usingDict$(EXT) + +#----------------------------------------------------------------------------- +# freestanding test only for Linux x86_64 +#----------------------------------------------------------------------------- +ifeq ($(OS),Windows_NT) + UNAME_S := Windows +else + UNAME_S := $(shell uname -s) +endif + +ifeq ($(OS),Windows_NT) + UNAME_P := Unknown +else + UNAME_P := $(shell uname -p) +endif + +FREESTANDING_CFLAGS := -ffreestanding -nostdlib + +ifneq ($(UNAME_S), Linux) + FREESTANDING_CFLAGS := +endif + +ifneq ($(UNAME_P), x86_64) + FREESTANDING_CFLAGS := +endif + +freestanding: freestanding.c + $(CC) $(FREESTANDING_CFLAGS) $^ -o $@$(EXT) + test-freestanding: freestanding @echo "\n ---- test freestanding ----" +ifeq ($(FREESTANDING_CFLAGS),) + @echo "\n (skip)" +else ./freestanding$(EXT) -strace ./freestanding$(EXT) -ltrace ./freestanding$(EXT) +endif + endif diff --git a/tests/freestanding.c b/tests/freestanding.c index ceff4c5..6109aa7 100644 --- a/tests/freestanding.c +++ b/tests/freestanding.c @@ -30,7 +30,6 @@ #if !defined(__x86_64__) || !defined(__linux__) -EXTERN_C void _start(void) { } int main(int argc, char** argv) { return 0; } #else |