26 lines
1.5 KiB
Bash
26 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Smoke the build-only native probe. Never installs binaries or opens project data.
|
|
set -euo pipefail
|
|
probe=${1:?Usage: sqlite-probe.sh /absolute/path/to/aie-sqlite-probe}
|
|
case "$probe" in /*) ;; *) echo 'Supply an absolute build path.' >&2; exit 2 ;; esac
|
|
[[ -x "$probe" ]] || { echo 'Native probe is missing.' >&2; exit 2; }
|
|
probe_dir=$(cd -- "$(dirname -- "$probe")" && pwd -P)
|
|
fixture=$(mktemp -d "${TMPDIR:-/tmp}/aie-sqlite-proof.XXXXXXXX")
|
|
trap 'rm -rf -- "$fixture"' EXIT
|
|
# Extraction must not be needed: the temporary directory is readable but not writable.
|
|
mkdir "$fixture/no-extraction"
|
|
chmod 500 "$fixture/no-extraction"
|
|
"$probe" "-Dorg.sqlite.lib.path=$probe_dir" "-Dorg.sqlite.tmpdir=$fixture/no-extraction" "$fixture/proof.db"
|
|
"$probe" "-Dorg.sqlite.lib.path=$probe_dir" "-Dorg.sqlite.tmpdir=$fixture/no-extraction" "$fixture/proof.db"
|
|
# Exported JNI support must really come from the distribution. The isolated copy
|
|
# has neither a sibling library nor an embedded resource from which to extract it.
|
|
mkdir "$fixture/isolated"
|
|
cp "$probe" "$fixture/isolated/aie-sqlite-probe"
|
|
if "$fixture/isolated/aie-sqlite-probe" "-Dorg.sqlite.lib.path=$fixture/isolated" \
|
|
"-Dorg.sqlite.tmpdir=$fixture/no-extraction" "$fixture/missing-library.db" \
|
|
> "$fixture/missing-library.log" 2>&1; then
|
|
echo 'Isolated executable unexpectedly worked without its SQLite library.' >&2
|
|
exit 1
|
|
fi
|
|
echo 'Native SQLite proof passed: separate processes, UTF-8, rollback and external library.'
|