linux: add texture lifecycle tests (Kitedesk B212)
Standalone C++ tests for the Linux texture, built against the engine of the
active Flutter SDK by linux/test/run_tests.sh (optionally with ASan/UBSan).
The plugin source is compiled into the test and driven through a real
FlMethodChannel on fake engine objects (binary messenger, texture registrar
with the reference rules of engine a18df97c, plugin registrar); frame
buffers copied with new[] are counted.
On 42797e0f eight of the ten tests fail: closing a texture keeps both frame
buffers, the GObject has no finalize, and closed textures are never reused,
so every session leaves a frame buffer and an engine GL texture behind.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
42797e0f03
commit
ec78a48bd9
2 changed files with 860 additions and 0 deletions
24
linux/test/run_tests.sh
Executable file
24
linux/test/run_tests.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue