Merge pull request #2190 from facebook/playTest_improvement

Check environmental variables in playTests.sh and add default values
This commit is contained in:
Yann Collet 2020-06-03 13:26:52 -07:00 committed by GitHub
commit 4b201f98eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -176,6 +176,12 @@ Going into `build` directory, you will find additional possibilities:
You can build the zstd binary via buck by executing: `buck build programs:zstd` from the root of the repo. You can build the zstd binary via buck by executing: `buck build programs:zstd` from the root of the repo.
The output binary will be in `buck-out/gen/programs/`. The output binary will be in `buck-out/gen/programs/`.
## Testing
You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory.
Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the zstd and datagen binary.
For information on CI testing, please refer to TESTING.md
## Status ## Status
Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases.

View File

@ -128,10 +128,25 @@ case "$UNAME" in
SunOS) DIFF="gdiff" ;; SunOS) DIFF="gdiff" ;;
esac esac
println "\nStarting playTests.sh isWindows=$isWindows EXE_PREFIX='$EXE_PREFIX' ZSTD_BIN='$ZSTD_BIN' DATAGEN_BIN='$DATAGEN_BIN'"
[ -n "$ZSTD_BIN" ] || die "\$ZSTD_BIN variable must be defined!" # check if ZSTD_BIN is defined. if not, use the default value
[ -n "$DATAGEN_BIN" ] || die "\$DATAGEN_BIN variable must be defined!" if [ -z "${ZSTD_BIN}" ]; then
println "\nZSTD_BIN is not set. Using the default value..."
ZSTD_BIN="$PRGDIR/zstd"
fi
# check if DATAGEN_BIN is defined. if not, use the default value
if [ -z "${DATAGEN_BIN}" ]; then
println "\nDATAGEN_BIN is not set. Using the default value..."
DATAGEN_BIN="$TESTDIR/datagen"
fi
ZSTD_BIN="$EXE_PREFIX$ZSTD_BIN"
# assertions
[ -n "$ZSTD_BIN" ] || die "zstd not found at $ZSTD_BIN! \n Please define ZSTD_BIN pointing to the zstd binary. You might also consider rebuilding zstd follwing the instructions in README.md"
[ -n "$DATAGEN_BIN" ] || die "datagen not found at $DATAGEN_BIN! \n Please define DATAGEN_BIN pointing to the datagen binary. You might also consider rebuilding zstd tests following the instructions in README.md. "
println "\nStarting playTests.sh isWindows=$isWindows EXE_PREFIX='$EXE_PREFIX' ZSTD_BIN='$ZSTD_BIN' DATAGEN_BIN='$DATAGEN_BIN'"
if echo hello | zstd -v -T2 2>&1 > $INTOVOID | grep -q 'multi-threading is disabled' if echo hello | zstd -v -T2 2>&1 > $INTOVOID | grep -q 'multi-threading is disabled'
then then