sqlite-parquet-vtable/tests/test-supported

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2018-03-04 22:20:28 +00:00
#!/bin/bash
set -euo pipefail
# Verify that all the non-unsupported.*parquet files can be loaded and 'SELECT * FROM x LIMIT 1'ed
# without segfaulting.
load_supported() {
file=${1:?must provide file to load}
basename=$(basename "$file")
cat <<EOF
.echo on
.load parquet/libparquet
.testcase $basename
.bail on
CREATE VIRTUAL TABLE test USING parquet('$file');
SELECT * FROM test LIMIT 1;
SELECT 123;
EOF
}
main() {
root=$(dirname "${BASH_SOURCE[0]}")/..
root=$(readlink -f "$root")
cd "$root"
supported_files=$(find . -type f -name '*.parquet' -not -name 'unsupported*.parquet')
while read -r supported; do
echo "Testing: $supported"
2018-03-05 03:48:39 +00:00
if ! "$root"/sqlite/sqlite3 -init <(load_supported "$supported") < /dev/null > /dev/null 2> testcase-stderr.txt; then
2018-03-04 22:20:28 +00:00
echo "...FAILED; check testcase-{out,err}.txt" >&2
exit 1
fi
# We expect the 'SELECT 123' command to have been run
if ! grep -q 123 testcase-out.txt; then
echo "...FAILED; check testcase-{out,err}.txt" >&2
exit 1
fi
done < <(echo "$supported_files")
}
main "$@"