diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2021-09-06 17:56:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-06 17:56:04 (GMT) |
commit | 976170316e1c79040db3b109cf0347c1c1252fdc (patch) | |
tree | 4f2f7a46f9fa751d04525af20c49d48c6f334a33 | |
parent | d2334731c3883e76813302d90c87eb93d74b40ba (diff) | |
parent | d93bc67c46c719bc57770172c292312cc643f62a (diff) | |
download | lz4-976170316e1c79040db3b109cf0347c1c1252fdc.zip lz4-976170316e1c79040db3b109cf0347c1c1252fdc.tar.gz lz4-976170316e1c79040db3b109cf0347c1c1252fdc.tar.bz2 |
Merge pull request #1027 from t-mat/examples-test-cpp
Add C++ compatibility test for `examples/`
-rw-r--r-- | .github/workflows/ci.yml | 22 | ||||
-rw-r--r-- | examples/Makefile | 5 | ||||
-rw-r--r-- | examples/dictionaryRandomAccess.c | 4 |
3 files changed, 29 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74e203d..5c0afb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,6 +265,7 @@ jobs: # - ubsan # - asan # - unicode-lint +# - build examples # lz4-cppcheck: name: make cppcheck @@ -392,6 +393,27 @@ jobs: run: bash ./tests/unicode_lint.sh + lz4-examples: + name: make examples + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 # https://github.com/actions/checkout + - name: apt-get install + run: | + sudo apt-get update + + - name: Environment info + run: | + echo && type cc && which cc && cc --version + echo && type c++ && which c++ && c++ --version + + - name: examples + run: make V=1 clean examples + + - name: examples (compile as C++ code) + run: make V=1 -C examples clean cxxtest + + ############################################################### # Platforms # diff --git a/examples/Makefile b/examples/Makefile index 24b58c9..a5af0c1 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -95,6 +95,11 @@ test : all $(LZ4) ./frameCompress$(EXT) $(TESTFILE) $(LZ4) -vt $(TESTFILE).lz4 +.PHONY: cxxtest +cxxtest: CFLAGS := -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror +cxxtest: clean + CC=$(CXX) $(MAKE) -C . all CFLAGS="$(CFLAGS)" + clean: @rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \ printVersion$(EXT) doubleBuffer$(EXT) dictionaryRandomAccess$(EXT) \ diff --git a/examples/dictionaryRandomAccess.c b/examples/dictionaryRandomAccess.c index f7d1b67..3aa4609 100644 --- a/examples/dictionaryRandomAccess.c +++ b/examples/dictionaryRandomAccess.c @@ -78,7 +78,7 @@ void test_compress(FILE* outFp, FILE* inpFp, void *dict, int dictSize) } /* Forget previously compressed data and load the dictionary */ - LZ4_loadDict(lz4Stream, dict, dictSize); + LZ4_loadDict(lz4Stream, (const char*) dict, dictSize); { char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)]; const int cmpBytes = LZ4_compress_fast_continue( @@ -153,7 +153,7 @@ void test_decompress(FILE* outFp, FILE* inpFp, void *dict, int dictSize, int off } /* Load the dictionary */ - LZ4_setStreamDecode(lz4StreamDecode, dict, dictSize); + LZ4_setStreamDecode(lz4StreamDecode, (const char*) dict, dictSize); { const int decBytes = LZ4_decompress_safe_continue( lz4StreamDecode, cmpBuf, decBuf, cmpBytes, BLOCK_BYTES); |