diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/zstd/contrib/single_file_libs/build_decoder_test.sh | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/zstd/contrib/single_file_libs/build_decoder_test.sh')
-rwxr-xr-x | src/zstd/contrib/single_file_libs/build_decoder_test.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/zstd/contrib/single_file_libs/build_decoder_test.sh b/src/zstd/contrib/single_file_libs/build_decoder_test.sh new file mode 100755 index 000000000..74e3f1c57 --- /dev/null +++ b/src/zstd/contrib/single_file_libs/build_decoder_test.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +# Temporary compiled binary +OUT_FILE="tempbin" + +# Optional temporary compiled WebAssembly +OUT_WASM="temp.wasm" + +# Amalgamate the sources +./create_single_file_decoder.sh +# Did combining work? +if [ $? -ne 0 ]; then + echo "Single file decoder creation script: FAILED" + exit 1 +fi +echo "Single file decoder creation script: PASSED" + +# Compile the generated output +cc -Wall -Wextra -Werror -Os -g0 -o $OUT_FILE examples/simple.c +# Did compilation work? +if [ $? -ne 0 ]; then + echo "Compiling simple.c: FAILED" + exit 1 +fi +echo "Compiling simple.c: PASSED" + +# Run then delete the compiled output +./$OUT_FILE +retVal=$? +rm -f $OUT_FILE +# Did the test work? +if [ $retVal -ne 0 ]; then + echo "Running simple.c: FAILED" + exit 1 +fi +echo "Running simple.c: PASSED" + +# Is Emscripten available? +which emcc > /dev/null +if [ $? -ne 0 ]; then + echo "(Skipping Emscripten test)" +else + # Compile the Emscripten example + CC_FLAGS="-Wall -Wextra -Werror -Os -g0 -flto --llvm-lto 3 -lGL -DNDEBUG=1" + emcc $CC_FLAGS -s WASM=1 -o $OUT_WASM examples/emscripten.c + # Did compilation work? + if [ $? -ne 0 ]; then + echo "Compiling emscripten.c: FAILED" + exit 1 + fi + echo "Compiling emscripten.c: PASSED" + rm -f $OUT_WASM +fi + +exit 0 |