42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/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 build/linux/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 ./parquet-generator/ -type f -name '*.parquet' -not -name 'unsupported*.parquet')
|
|
while read -r supported; do
|
|
echo "Testing: $supported"
|
|
if ! "$root"/sqlite/sqlite3 -init <(load_supported "$supported") < /dev/null > /dev/null 2> testcase-stderr.txt; then
|
|
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 "$@"
|