bdk-ffi/test.sh

62 lines
1.0 KiB
Bash
Raw Normal View History

2021-06-14 22:38:29 -07:00
#!/usr/bin/env bash
2021-09-25 21:17:40 -07:00
set -eo pipefail
# functions
## help
help()
{
# Display Help
echo "Test bdk-ffi and related libraries."
echo
echo "Syntax: build [-a|h|k|v]"
echo "options:"
echo "-a Android aar tests."
echo "-h Print this Help."
echo "-k JVM jar tests."
echo "-v Valgrind tests."
echo
}
2021-06-14 22:38:29 -07:00
# rust
2021-09-25 21:17:40 -07:00
c_headers() {
cargo test --features c-headers -- generate_headers
}
2021-06-14 22:38:29 -07:00
# cc
2021-09-25 21:17:40 -07:00
test_c() {
export LD_LIBRARY_PATH=`pwd`/target/debug
cc/bdk_ffi_test
}
test_valgrind() {
valgrind --leak-check=full --show-leak-kinds=all cc/bdk_ffi_test
}
test_kotlin() {
(cd bdk-kotlin && ./gradlew test)
}
test_android() {
(cd bdk-kotlin && ./gradlew :android:connectedDebugAndroidTest)
}
2021-06-14 22:38:29 -07:00
2021-09-25 21:17:40 -07:00
if [ $1 = "-h" ]
then
help
else
c_headers
test_c
# optional tests
while [ -n "$1" ]; do # while loop starts
case "$1" in
-a) test_android ;;
-h) help ;;
-k) test_kotlin ;;
-v) test_valgrind ;;
*) echo "Option $1 not recognized" ;;
esac
shift
done
fi