mirror of
https://github.com/cldellow/sqlite-parquet-vtable.git
synced 2025-09-12 22:29:58 +00:00
Add explicit test for file not found
...caching the metadata moved where ParquetTable did I/O, which introduced a segfault on not found
This commit is contained in:
33
tests/test-non-existent
Executable file
33
tests/test-non-existent
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Verify that loading a non existent file is an error, not a segfault
|
||||
|
||||
load_nonexistent() {
|
||||
cat <<EOF
|
||||
.echo on
|
||||
.load parquet/libparquet
|
||||
.testcase notfound
|
||||
.bail on
|
||||
CREATE VIRTUAL TABLE test USING parquet('$root/doesnotexist.parquet');
|
||||
SELECT 123;
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
root=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
root=$(readlink -f "$root")
|
||||
cd "$root"
|
||||
|
||||
#This line will exit with non-zero in case of a segfault.
|
||||
"$root"/sqlite/sqlite3 -init <(load_nonexistent) < /dev/null > /dev/null 2> testcase-stderr.txt
|
||||
|
||||
# We expect the 'SELECT 123' command to NOT have been run
|
||||
if grep -q 123 testcase-out.txt; then
|
||||
echo "...FAILED; expected an error message. Check testcase-{out,err}.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
Reference in New Issue
Block a user