mirror of
				https://github.com/cldellow/sqlite-parquet-vtable.git
				synced 2025-11-04 02:39:56 +00:00 
			
		
		
		
	test: bad create table
This commit is contained in:
		@@ -5,6 +5,7 @@ here=$(dirname "${BASH_SOURCE[0]}")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
set -x
 | 
					set -x
 | 
				
			||||||
"$here"/test-non-existent
 | 
					"$here"/test-non-existent
 | 
				
			||||||
 | 
					"$here"/test-bad-create-table
 | 
				
			||||||
"$here"/test-unsupported
 | 
					"$here"/test-unsupported
 | 
				
			||||||
"$here"/test-supported
 | 
					"$here"/test-supported
 | 
				
			||||||
"$here"/test-queries
 | 
					"$here"/test-queries
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								tests/test-bad-create-table
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								tests/test-bad-create-table
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					set -euo pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Verify that all the unsupported.*parquet files result in an error when creating the virtual table,
 | 
				
			||||||
 | 
					# but don't segfault.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					load_bad_table() {
 | 
				
			||||||
 | 
					  cat <<EOF
 | 
				
			||||||
 | 
					.echo on
 | 
				
			||||||
 | 
					.load build/linux/libparquet
 | 
				
			||||||
 | 
					.testcase bad-create-table
 | 
				
			||||||
 | 
					.bail on
 | 
				
			||||||
 | 
					CREATE VIRTUAL TABLE test USING parquet;
 | 
				
			||||||
 | 
					SELECT 123;
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					main() {
 | 
				
			||||||
 | 
					  root=$(dirname "${BASH_SOURCE[0]}")/..
 | 
				
			||||||
 | 
					  root=$(readlink -f "$root")
 | 
				
			||||||
 | 
					  cd "$root"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  "$root"/sqlite/sqlite3 -init <(load_bad_table) < /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