#!/usr/bin/env bash # Kitedesk fork, 2026: builds and runs linux/test/texture_rgba_renderer_plugin_test.cc # against the Linux engine of the Flutter SDK on PATH (or FLUTTER_ROOT). # The test does not open a display or a GL context. # run_tests.sh -Wall -Werror build, like the plugin in an app build # run_tests.sh --asan the same with AddressSanitizer and UBSan # OUT_DIR (default: a new temporary directory) receives the test binary. set -euo pipefail here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) root=${FLUTTER_ROOT:-$(dirname "$(dirname "$(readlink -f "$(command -v flutter)")")")} engine=$root/bin/cache/artifacts/engine/linux-x64 [ -f "$engine/libflutter_linux_gtk.so" ] || { echo "no Linux engine in $engine (run flutter precache --linux)" >&2; exit 2; } out=${OUT_DIR:-$(mktemp -d)} mkdir -p "$out" flags=(-std=gnu++14 -Wall -Werror -O1 -g -DFLUTTER_PLUGIN_IMPL) if [ "${1:-}" = --asan ]; then flags+=(-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=undefined) export ASAN_OPTIONS=${ASAN_OPTIONS:-detect_leaks=0} fi # shellcheck disable=SC2046 "${CXX:-clang++}" "${flags[@]}" -I"$engine" -I"$here/../include" $(pkg-config --cflags gtk+-3.0) \ "$here/texture_rgba_renderer_plugin_test.cc" -o "$out/texture_rgba_renderer_plugin_test" \ -L"$engine" -Wl,-rpath,"$engine" -lflutter_linux_gtk $(pkg-config --libs gtk+-3.0) -pthread "$out/texture_rgba_renderer_plugin_test"