Point every harness's default toolchain at build/packages/ziran/build, drop the removed `zi2zx bundle` form, link the generated C each harness actually gets (whole generated folders where the test has no stubs, and Kryon's package-prefixed frame pacing module), and stop listing the header-only type module in the modal rules test. Twenty-two more test targets pass from a clean export; plans/2026-11-17-test-harnesses.md lists the 54 that still fail and why.
88 lines
4.6 KiB
Bash
Executable File
88 lines
4.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
ziran=${1:-"$root/build/packages/ziran/build/bin/ziran"}
|
|
liboqs=${2:-"$root/vendor-builds/linux/x86_64/inbe-liboqs/lib/liboqs.a"}
|
|
work=${APPS_TEST_DIR:-$root/build/apps-test}
|
|
bundles=${APPS_TEST_BUNDLES:-$root/build}
|
|
# Apps the node offers reach the shared-list service, which links curl; the
|
|
# system library is linked by name where there is no development symlink.
|
|
curl=${CURL_LIBRARY:-$(ls /usr/lib/x86_64-linux-gnu/libcurl.so.4 2>/dev/null || echo -lcurl)}
|
|
webp=$(pkg-config --libs libwebp libwebpdemux)
|
|
mkdir -p "$work/generated" "$work/wrong-record" "$work/wrong-scalar"
|
|
if [ -z "${APPS_TEST_BUNDLES:-}" ]; then
|
|
sh "$root/scripts/build-apps.sh" "$ziran"
|
|
fi
|
|
# These are valid portable bundles with an identity handshake and all three
|
|
# named capabilities. Their mismatched values must never reach a decoder.
|
|
for shape in wrong-record wrong-scalar; do
|
|
if [ "$shape" = wrong-record ]; then
|
|
declaration='Bad :: struct { unexpected: s32; }'
|
|
argument='Bad.{.unexpected = 1}'
|
|
type='Bad'
|
|
else
|
|
declaration=''
|
|
argument='"wrong"'
|
|
type='string'
|
|
fi
|
|
cat > "$work/$shape/lists.zi" <<ZIRAN
|
|
#import, file "../../../src/apps/lists_types.zi";
|
|
#import, file "../../../apps/lists/lists_view.zi";
|
|
host_api :: #system_library "host_api";
|
|
ReadListsHost :: () -> ListsMessage #foreign host_api;
|
|
WriteListsHost :: (value: $type) #foreign host_api;
|
|
PersistListsHost :: (value: $type) -> s32 #foreign host_api;
|
|
$declaration
|
|
#program_export
|
|
Main :: () -> s32 {
|
|
message := ReadListsHost()
|
|
if message.action == 0 { return 1 }
|
|
if message.action == LISTS_FRAME { unused ListsView(message) }
|
|
WriteListsHost($argument)
|
|
return PersistListsHost($argument)
|
|
}
|
|
ZIRAN
|
|
"$ziran" bundle --project --offline --root "$root" --module-path "$work/$shape" \
|
|
--define KRYON_HOSTED_UI --entry lists:Main -o "$work/$shape.zx" "$work/$shape/lists.zi"
|
|
done
|
|
"$ziran" bundle --project --offline --root "$root" --module-path "$root/apps/inbe" \
|
|
--define KRYON_HOSTED_UI --entry inbe:Main -o "$work/missing-assets.zx" \
|
|
"$root/apps/inbe/inbe.zi"
|
|
mkdir -p "$work/invalid-nested"
|
|
printf 'ZX' > "$work/invalid-nested/lists.zx"
|
|
cp "$bundles/apps/habits.zx" "$bundles/apps/practices.zx" "$work/invalid-nested/"
|
|
"$ziran" bundle --project --offline --root "$root" --module-path "$root/apps/inbe" \
|
|
--define KRYON_HOSTED_UI --entry inbe:Main \
|
|
--asset-dir "cells=$work/invalid-nested" -o "$work/invalid-nested.zx" \
|
|
"$root/apps/inbe/inbe.zi"
|
|
"$ziran" build --target=c --no-main --project --offline --define PLATFORM_DESKTOP --root "$root/tests" \
|
|
-o "$work/generated" "$root/tests/apps_behavior.zi" "$root/tests/sync_test_host.zi"
|
|
# The --wrap fakes below must see every call, not header inline copies.
|
|
"${CC:-cc}" -D_GNU_SOURCE -DZIRAN_NO_HEADER_INLINE -std=c11 -O0 -ffunction-sections -fdata-sections \
|
|
-I"$root/build/packages/ziran/include" -iquote "$work/generated" -iquote "$work/generated/apps" \
|
|
-I"$root/build/packages/monocypher/src" -I"$root/build/packages/monocypher/src/optional" \
|
|
-I"$root/vendor-builds/sqlite" -I"$root/vendor-builds/linux/x86_64/inbe-liboqs/include" \
|
|
-I"$root/build/packages/raylib/src" \
|
|
"$root/tests/apps_host_test.c" "$root/tests/diary_lock_host.c" \
|
|
"$root/tests/node_app_audio_host.c" "$work/generated"/*.c \
|
|
"$root/build/packages/monocypher/src/monocypher.c" \
|
|
"$root/build/packages/monocypher/src/optional/monocypher-ed25519.c" \
|
|
"$root/vendor-builds/sqlite/sqlite3.c" "$liboqs" "${ZIRAN_LIB:-$(dirname "$(dirname "$ziran")")/libziran.a}" \
|
|
-Wl,--wrap=tmpfile -Wl,--wrap=BundleInstanceRun -Wl,--wrap=BundleInstantiate -Wl,--wrap=BundleOpenBytes \
|
|
-Wl,--wrap=package_manager_PackageInstalledBytes -Wl,--wrap=package_manager_PackageRevisionFor \
|
|
-Wl,--wrap=package_files_PackageRead \
|
|
-Wl,--wrap=package_manager_PackageTrustedRelease \
|
|
-Wl,--gc-sections -ldl -lpthread -lz -lm "$curl" $webp -o "$work/test"
|
|
# All data and fixture upgrade paths are disposable. No owner profile is used.
|
|
data=$(mktemp -d "$work/profile.XXXXXX")
|
|
trap 'rm -rf "$data"' EXIT HUP INT TERM
|
|
mkdir -p "$data/module-data"
|
|
cp "$root/tests/fixtures/schema-1.8.9.sql" "$data/"
|
|
cd "$data"
|
|
env -u INBE_DIARY_IMPORT -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
|
APP_DATA_ROOT="$data/module-data" "$work/test" "$bundles/apps/lists.zx" \
|
|
"$bundles/apps/habits.zx" "$bundles/apps/practices.zx" \
|
|
"$work/wrong-record.zx" "$work/wrong-scalar.zx" "$bundles/inbe-full.zx" \
|
|
"$work/missing-assets.zx" "$work/invalid-nested.zx" "$bundles/apps/diary.zx" "$bundles/apps/lumi.zx" \
|
|
"$bundles/apps/leaderboard.zx"
|