| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/bin/sh
- # Minimal SQLite binding smoke tests.
- set -e
- cd "$(dirname "$0")"
- ROOT="$(cd ../.. && pwd)"
- M2MAKE="$ROOT/tools/m2make/b_v3/M2make"
- if [ ! -x "$M2MAKE" ]; then
- echo "missing $M2MAKE; run tools/m2make/build_m2.sh" >&2
- exit 1
- fi
- SQLITE_LIBS="$(pkg-config --libs sqlite3 2>/dev/null || true)"
- if [ -z "$SQLITE_LIBS" ]; then
- # Runtime-only installations often have no .pc/header; use the
- # versioned shared object directly.
- SQLITE_LIBS="/usr/lib/x86_64-linux-gnu/libsqlite3.so.0"
- fi
- build_and_run() {
- name="$1"
- src="${2:-tests/$name.mod}"
- out="${TMPDIR:-/tmp}/m2-sqlite-$name"
- "$M2MAKE" -c m2 \
- --m2bin "$ROOT/compiler/M2" \
- --shim "$ROOT/runtime/syslib/shim.c" \
- --lib "$SQLITE_LIBS" \
- -I "$ROOT/bindings/sqlite3" \
- -I "$ROOT/runtime/syslib" \
- -I "$ROOT/lib/common" \
- -o "$out" \
- "$src"
- set +e
- "$out"
- rc=$?
- set -e
- if [ "$rc" = 42 ]; then return 0; fi
- return 1
- }
- build_and_run SQLiteSmoke
- build_and_run SQLitePrepared
- build_and_run SQLiteShowcase showcase/SQLiteShowcase.mod
|