libs/vulkan-compute/test-ffi.sh
1#!/bin/bash
2# test-ffi.sh - Runner script for Lua FFI tests
3#
4# This script tests the Lua FFI bindings for the Vulkan compute library.
5# It can be run from any directory and will handle paths correctly.
6#
7# Usage: ./test-ffi.sh [DIR]
8# DIR - Path to vulkan-compute root directory (optional)
9
10# {{{ Set DIR variable
11DIR="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
12# }}}
13
14# {{{ Verify directory structure
15if [ ! -d "$DIR/lua" ] || [ ! -d "$DIR/build" ]; then
16 echo "ERROR: Invalid vulkan-compute directory: $DIR"
17 echo "Expected directories: lua/, build/"
18 exit 1
19fi
20
21if [ ! -f "$DIR/build/libvkcompute.so" ]; then
22 echo "ERROR: Shared library not found: $DIR/build/libvkcompute.so"
23 echo "Run 'make' in $DIR first"
24 exit 1
25fi
26# }}}
27
28# {{{ Change to DIR and run test
29cd "$DIR" || exit 1
30echo "Running FFI test from: $(pwd)"
31luajit lua/test_ffi.lua "$DIR"
32# }}}
33