diff --git a/contrib/declib/BUCK b/contrib/declib/BUCK index e04f5e82dd14a53c87509e6e9ad7f85ac6815d96..bfbca1244a102c3e5a5abb379662b2d20e42046d 100644 --- a/contrib/declib/BUCK +++ b/contrib/declib/BUCK @@ -3,9 +3,9 @@ sh_test( visibility=['PUBLIC'], test='combine.sh', args=[ - '-r', '../../lib', - '-r', '../../lib/common', - '-r', '../../lib/decompress', - '-o', 'zstddeclib.c', - 'zstddeclib-in.c'] + '-r', 'lib', + '-r', 'lib/common', + '-r', 'lib/decompress', + '-o', 'contrib/declib/zstddeclib.c', + 'contrib/declib/zstddeclib-in.c'] ) diff --git a/contrib/declib/combine.sh b/contrib/declib/combine.sh index b95977e32f51dbc9b895ed305761c287528f48af..b798a8a3ecb745497a08b841b699735b9ecd6c30 100755 --- a/contrib/declib/combine.sh +++ b/contrib/declib/combine.sh @@ -45,11 +45,15 @@ function write_line { function add_file { # Match the path local file= - for root in $ROOTS; do - if test -f "$root/$1"; then - file="$root/$1" - fi - done + if [ -f "$1" ]; then + file="$1" + else + for root in $ROOTS; do + if test -f "$root/$1"; then + file="$root/$1" + fi + done + fi if [ -n "$file" ]; then # Read the file local line diff --git a/contrib/declib/tests/BUCK b/contrib/declib/tests/BUCK index 9e3621ae405f8e792f82fbab7457413524c13f36..4e707f10e37ea22cfb71455f39a0582c915079c3 100644 --- a/contrib/declib/tests/BUCK +++ b/contrib/declib/tests/BUCK @@ -1,5 +1,7 @@ -cxx_test( +# Note: we need to undef ZSTD_LEGACY_SUPPORT since Buck defines it elsewhere +cxx_binary( name='simple', srcs=['simple.c'], + preprocessor_flags=['-UZSTD_LEGACY_SUPPORT'], deps=['//contrib/declib:combine'] ) diff --git a/contrib/declib/tests/simple.c b/contrib/declib/tests/simple.c index 2dda4b06e60451e07f20a65a8b1c328aa998bce4..aad14666e25e78b5a35de7bdafbe1bd517d5d129 100644 --- a/contrib/declib/tests/simple.c +++ b/contrib/declib/tests/simple.c @@ -2,10 +2,11 @@ * \file simple.c * Simple standalone example of using the single-file \c zstddeclib. */ -#include "../zstddeclib.c" + +#include <stdio.h> +#include <string.h> -#include "stdio.h" -#include "string.h" +#include "../zstddeclib.c" //************************* Test Data (DXT texture) **************************/ @@ -3387,8 +3388,8 @@ size_t ZSTD_decompress(void* dst, size_t dstLen, const void* src, size_t srcLen) int main() { size_t size = ZSTD_decompress(dstDxt1, sizeof dstDxt1, srcZstd, sizeof srcZstd); int compare = memcmp(rawDxt1, dstDxt1, sizeof dstDxt1); - printf("Decompressed size: %ld (expected %ld)\n", size, sizeof dstDxt1); - printf("Byte comparison: %s\n", (compare) ? "failed" : "succeeded"); + printf("Decompressed size: %s\n", (size == sizeof dstDxt1) ? "OK" : "FAILED"); + printf("Byte comparison: %s\n", (compare == 0) ? "OK" : "FAILED"); if (size == sizeof dstDxt1 && compare == 0) { return EXIT_SUCCESS; }