Merge pull request #1754 from facebook/decTest

Tests for single-file decompressor
This commit is contained in:
Yann Collet 2019-08-29 12:09:09 -07:00 committed by GitHub
commit d944197e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 23 additions and 5 deletions

View File

@ -100,6 +100,7 @@ contrib: lib
$(MAKE) -C contrib/pzstd all $(MAKE) -C contrib/pzstd all
$(MAKE) -C contrib/seekable_format/examples all $(MAKE) -C contrib/seekable_format/examples all
$(MAKE) -C contrib/largeNbDicts all $(MAKE) -C contrib/largeNbDicts all
cd contrib/single_file_decoder/ ; ./build_test.sh
.PHONY: cleanTabs .PHONY: cleanTabs
cleanTabs: cleanTabs:

View File

@ -7,7 +7,10 @@ Create `zstddeclib.c` from the Zstd source using:
cd zstd/contrib/declib cd zstd/contrib/declib
./combine.sh -r ../../lib -r ../../lib/common -r ../../lib/decompress -o zstddeclib.c zstddeclib-in.c ./combine.sh -r ../../lib -r ../../lib/common -r ../../lib/decompress -o zstddeclib.c zstddeclib-in.c
``` ```
Then add the resulting file to your project (see the [example files](examples)). `build.sh` will run the above script then compile and test the library. Then add the resulting file to your project (see the [example files](examples)).
`create_single_file_decoder.sh` will run the above script, creating file `zstddeclib.c`.
`build_test.sh` will create the decoder, then compile and test the library.
Why Why
--- ---

View File

@ -10,14 +10,13 @@ OUT_FILE="tempbin"
OUT_WASM="temp.wasm" OUT_WASM="temp.wasm"
# Amalgamate the sources # Amalgamate the sources
echo "Amalgamating files... this may take a few minutes" ./create_single_file_decoder.sh
./combine.sh -r "$ZSTD_SRC_ROOT" -r "$ZSTD_SRC_ROOT/common" -r "$ZSTD_SRC_ROOT/decompress" -o zstddeclib.c zstddeclib-in.c
# Did combining work? # Did combining work?
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Combine script: FAILED" echo "Single file decoder creation script: FAILED"
exit 1 exit 1
fi fi
echo "Combine script: PASSED" echo "Single file decoder creation script: PASSED"
# Compile the generated output # Compile the generated output
cc -Os -g0 -o $OUT_FILE examples/simple.c cc -Os -g0 -o $OUT_FILE examples/simple.c

View File

@ -0,0 +1,15 @@
#!/bin/sh
# Where to find the sources
ZSTD_SRC_ROOT="../../lib"
# Amalgamate the sources
echo "Amalgamating files... this can take a while"
./combine.sh -r "$ZSTD_SRC_ROOT" -r "$ZSTD_SRC_ROOT/common" -r "$ZSTD_SRC_ROOT/decompress" -o zstddeclib.c zstddeclib-in.c
# Did combining work?
if [ $? -ne 0 ]; then
echo "Combine script: FAILED"
exit 1
fi
echo "Combine script: PASSED"