Fix 2720 closed-flip call wakeups/preservation, live timezone sync, and Power menu
- Default CPU_RPM_SLEEP=0, CPU_L2_SLEEP=0, and MODEM_DRX_MODE=0 across bananarchy-power-policy.conf, bananarchy-power-policy.sh, bananarchy-display-power-sync, and kernel patch 0010 so closed-flip incoming calls wake APSS promptly via smd-edge without AT port contention. - Serialize sxmo_modem.sh incoming/finished call checks, expire stale /tmp/sxmo_hangup_requested flags, re-verify live ModemManager call state before ringing/raising callscreen, guard idle/flip-open HANGUP_CLOSE paths in locker.so, callscreen.so, bananarchy-idle-lock.sh, and bananarchy-lid, preserve calls on flip-open (UNGRAB/RAISE), and add closed-flip cover call controls (bananarchy-cover-idle, bananarchy-cover-event.sh, bananarchy-volume-keys). - Propagate live network/manual timezone updates across statusbar, locker.so, bananarchy-cover-idle, bananarchy-dsds, callscreen.so, and bananarchy-run-aligned without reboot (scripts/test-time-timezone-sync.py), remove non-functional Logout from the Power menu, ignore post-call sxmo_calls markers, add scripts/build-dwm-plugins.sh, and update a1114 (carbonara) hashes and docs.
This commit is contained in:
1 parent
786480a08f
commit
8b466ef8ae
110 files changed
+2728
-285
No files matched your search
Executable
+224
@@ -0,0 +1,224 @@
|
||||
#!/bin/sh
|
||||
# Cross-compile libneoui.so, dwm plugins (*.so except dmenu.so), and plugin
|
||||
# helper binaries for armv7 without recompiling dwm/st/dmenu.so.
|
||||
set -eu
|
||||
|
||||
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
ROOTFS_DIR="${ROOTFS_DIR:-$BASE_DIR/rootfs}"
|
||||
if [ -e "$ROOTFS_DIR" ]; then
|
||||
ROOTFS_DIR="$(realpath "$ROOTFS_DIR")"
|
||||
fi
|
||||
|
||||
exec docker run --rm --network=host \
|
||||
-e HOST_UID="$(id -u)" \
|
||||
-e HOST_GID="$(id -g)" \
|
||||
-v "$BASE_DIR:/bananarchy" \
|
||||
-v "$ROOTFS_DIR:/target-rootfs" \
|
||||
alpine:3.24 sh -eu -c '
|
||||
cat > /etc/apk/repositories <<EOF
|
||||
http://mirror.nura.eco/postmarketos/v26.06
|
||||
https://dl-cdn.alpinelinux.org/alpine/edge/main
|
||||
https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
https://dl-cdn.alpinelinux.org/alpine/edge/testing
|
||||
EOF
|
||||
cp /bananarchy/keys/* /etc/apk/keys/
|
||||
|
||||
echo "[1/4] Installing host cross-compilation toolchain..."
|
||||
apk add --no-cache \
|
||||
build-base \
|
||||
gcc-armv7 \
|
||||
g++-armv7 \
|
||||
binutils-armv7 \
|
||||
pkgconf >/dev/null
|
||||
|
||||
echo "[2/4] Preparing armv7 sysroot..."
|
||||
SYSROOT="/tmp/armv7-sysroot"
|
||||
mkdir -p "$SYSROOT/etc/apk/keys"
|
||||
cp /etc/apk/repositories "$SYSROOT/etc/apk/repositories"
|
||||
cp /etc/apk/keys/* "$SYSROOT/etc/apk/keys/"
|
||||
apk --root "$SYSROOT" --initdb --arch armv7 add --no-scripts \
|
||||
alpine-baselayout \
|
||||
musl-dev \
|
||||
linux-headers \
|
||||
alsa-lib-dev \
|
||||
libx11-dev \
|
||||
libxfixes-dev \
|
||||
libxft-dev \
|
||||
libxinerama-dev \
|
||||
libxext-dev \
|
||||
libxrender-dev \
|
||||
libxcb-dev \
|
||||
xcb-util-dev \
|
||||
fontconfig-dev \
|
||||
freetype-dev \
|
||||
harfbuzz-dev \
|
||||
pango-dev \
|
||||
glib-dev \
|
||||
cairo-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
openssl-dev \
|
||||
opus-dev \
|
||||
gsm-dev \
|
||||
toxcore-dev \
|
||||
gtk+3.0-dev \
|
||||
webkit2gtk-4.1-dev \
|
||||
libwpe-dev \
|
||||
libwpebackend-fdo-dev >/dev/null
|
||||
|
||||
export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
|
||||
export PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/pkgconfig:$SYSROOT/usr/share/pkgconfig"
|
||||
CC="armv7-alpine-linux-musleabihf-gcc --sysroot=$SYSROOT"
|
||||
CXX="armv7-alpine-linux-musleabihf-g++ --sysroot=$SYSROOT"
|
||||
STRIP="armv7-alpine-linux-musleabihf-strip"
|
||||
OPT_CFLAGS="-O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -fno-plt -fomit-frame-pointer"
|
||||
|
||||
echo "[3/4] Compiling NeoUI SDK shared library (libneoui.so)..."
|
||||
mkdir -p /bananarchy/prebuilt/sxmo-x11/usr/lib \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/include \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/bin \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins
|
||||
PLUG_INCS="$(pkgconf --cflags x11 xfixes xft fontconfig freetype2 pango pangoxft alsa libjpeg libpng) -I/bananarchy/src/neoui"
|
||||
PLUG_LIBS="$(pkgconf --libs x11 xfixes xft fontconfig freetype2 pango pangoxft alsa)"
|
||||
MEDIA_LIBS="$(pkgconf --libs libjpeg libpng)"
|
||||
CXX_PLUG_FLAGS="$OPT_CFLAGS -fPIC -shared -std=c++20 -Wall -Wextra -Wno-psabi"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS -Wl,-soname,libneoui.so $PLUG_INCS \
|
||||
/bananarchy/src/neoui/neoui.cpp $PLUG_LIBS $MEDIA_LIBS \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/libneoui.so
|
||||
cp -f /bananarchy/src/neoui/neoui.h /bananarchy/prebuilt/sxmo-x11/usr/include/neoui.h
|
||||
cp -f /bananarchy/src/neoui/neoui.h "$SYSROOT/usr/include/neoui.h"
|
||||
cp -f /bananarchy/prebuilt/sxmo-x11/usr/lib/libneoui.so "$SYSROOT/usr/lib/libneoui.so"
|
||||
NEOUI_LIBS="-L/bananarchy/prebuilt/sxmo-x11/usr/lib -lneoui"
|
||||
|
||||
echo "[4/4] Compiling DWM Plugins and helper binaries (dwm untouched)..."
|
||||
pids=""
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/xdrawer/xdrawer.cpp $NEOUI_LIBS $PLUG_LIBS \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/xdrawer.so &
|
||||
pids="$pids $!"
|
||||
|
||||
for plug in dialer calllog callscreen contacts sms themes modem networks ringtones music passcode engmenu privacy; do
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
"/bananarchy/src/dwm-plugins/${plug}_plugin.cpp" $NEOUI_LIBS $PLUG_LIBS \
|
||||
-o "/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/${plug}.so" &
|
||||
pids="$pids $!"
|
||||
done
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/files_plugin.cpp $NEOUI_LIBS $PLUG_LIBS $MEDIA_LIBS \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/files.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/camera_plugin.cpp $NEOUI_LIBS $PLUG_LIBS $MEDIA_LIBS -lpthread \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/camera.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/wallpapers_plugin.cpp $NEOUI_LIBS $PLUG_LIBS $MEDIA_LIBS \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/locker_plugin.cpp $NEOUI_LIBS $PLUG_LIBS -lcrypt \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/locker.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/sip_plugin.cpp $NEOUI_LIBS $PLUG_LIBS -lssl -lcrypto -lopus -lgsm -lpthread \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sip.so &
|
||||
pids="$pids $!"
|
||||
|
||||
for ssl_plug in email irc smallweb; do
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
"/bananarchy/src/dwm-plugins/${ssl_plug}_plugin.cpp" $NEOUI_LIBS $PLUG_LIBS -lssl -lcrypto \
|
||||
-o "/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/${ssl_plug}.so" &
|
||||
pids="$pids $!"
|
||||
done
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/tox_plugin.cpp $NEOUI_LIBS $PLUG_LIBS -ltoxcore -lpthread \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/tox.so &
|
||||
pids="$pids $!"
|
||||
|
||||
WEBARCHY_INCS="$(pkgconf --cflags webkit2gtk-4.1 gtk+-3.0 wpe-1.0 wpebackend-fdo-1.0)"
|
||||
WEBARCHY_LIBS="$(pkgconf --libs webkit2gtk-4.1 gtk+-3.0 wpe-1.0 wpebackend-fdo-1.0)"
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS $WEBARCHY_INCS \
|
||||
/bananarchy/src/dwm-plugins/webarchy_plugin.cpp $NEOUI_LIBS $PLUG_LIBS $WEBARCHY_LIBS \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/webarchy.so &
|
||||
pids="$pids $!"
|
||||
|
||||
$CXX $CXX_PLUG_FLAGS $PLUG_INCS \
|
||||
/bananarchy/src/dwm-plugins/gps_plugin.cpp $NEOUI_LIBS $PLUG_LIBS $MEDIA_LIBS -lssl -lcrypto -lpthread \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/gps.so &
|
||||
pids="$pids $!"
|
||||
|
||||
for pid in $pids; do
|
||||
wait "$pid"
|
||||
done
|
||||
|
||||
$STRIP --strip-unneeded \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/libneoui.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/xdrawer.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/dialer.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/calllog.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/callscreen.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/contacts.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sms.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/files.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/camera.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/themes.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/modem.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/ringtones.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/music.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/locker.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sip.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/email.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/irc.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/tox.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/smallweb.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/webarchy.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/gps.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/passcode.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/engmenu.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/privacy.so
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/dwm_plugin_runner.c -ldl \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/dwm-plugin
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/dwm-plugin
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/sxmo_vibrate.c \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/sxmo_vibrate
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/sxmo_vibrate
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/verify_passcode.c -lcrypt \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-verify-passcode
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-verify-passcode
|
||||
|
||||
$CC $OPT_CFLAGS -std=c99 -D_DEFAULT_SOURCE -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/engmenu_exec.c \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-engmenu-exec
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-engmenu-exec
|
||||
chmod 4755 /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-engmenu-exec
|
||||
|
||||
$CXX $OPT_CFLAGS -std=c++20 -Wall -Wextra \
|
||||
/bananarchy/src/dwm-plugins/bananarchy_melody.cpp -lm \
|
||||
-o /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-melody
|
||||
$STRIP --strip-unneeded /bananarchy/prebuilt/sxmo-x11/usr/bin/bananarchy-melody
|
||||
|
||||
chown -R "$HOST_UID:$HOST_GID" \
|
||||
/bananarchy/prebuilt/sxmo-x11 \
|
||||
/bananarchy/src/neoui \
|
||||
/bananarchy/src/xdrawer \
|
||||
/bananarchy/src/dwm-plugins
|
||||
ls -lh /bananarchy/prebuilt/sxmo-x11/usr/lib/libneoui.so \
|
||||
/bananarchy/prebuilt/sxmo-x11/usr/lib/dwm/plugins/*.so
|
||||
'
|
||||
"$BASE_DIR/scripts/sync-prebuilt-overlay.sh"
|
||||
@@ -397,8 +397,8 @@ fi
|
||||
|
||||
echo "[check] Known-good flashable image set..."
|
||||
for pair in \
|
||||
"d913b7fe328b3d8c0be242e5d2666d6f03453c565ddc1120ef59698f4445e079 images/bananarchy-nokia-argon.img" \
|
||||
"d290476ba796abc4eb36eeacb0f6312fe3e33623f7a38b2c607a609808fe4f5e images/bananarchy-nokia-beatles.img" \
|
||||
"7b39e0ef4cbfc169a4fa0eeda5641ed59df7644b5e5265f8f3f5b25e7f3a8e41 images/bananarchy-nokia-argon.img" \
|
||||
"19f605dbb5a80ca073895a7ed41149a1a7692c79f12f399bff1e61d497daf069 images/bananarchy-nokia-beatles.img" \
|
||||
"7920fae28fa3389602be16a02ad7311b50e61c9c205be48f160307d594f65eb6 images/boot-bananarchy-nokia-beatles.img" \
|
||||
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
|
||||
set -- $pair
|
||||
@@ -1233,10 +1233,10 @@ for dts in \
|
||||
fail "${dts#"$BASE_DIR/"} is missing MSM8909 interconnect/GPU-BIMC/OPP bandwidth nodes or 0x25800 floor"
|
||||
fi
|
||||
done
|
||||
if ! grep -qxF 'MODEM_DRX_MODE=6' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
if ! grep -qxF 'MODEM_DRX_MODE=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'DSDS_SECONDARY_MODE=active' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'CPU_RPM_SLEEP=1' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'CPU_L2_SLEEP=1' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'CPU_RPM_SLEEP=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'CPU_L2_SLEEP=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'WIFI_SCREEN_OFF_IPV6_MUTE=1' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qxF 'WIFI_STANDBY_RAT=keep' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \
|
||||
! grep -qF 'if [ "$port" = "all" ]; then' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \
|
||||
@@ -1255,10 +1255,20 @@ if ! grep -qxF 'MODEM_DRX_MODE=6' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \
|
||||
! grep -qF 'SPM_SCREEN_OFF_PATH=/sys/module/cpuidle_qcom_spm/parameters/screen_off' \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \
|
||||
! grep -qF 'SPM_RPM_SLEEP_PATH=/sys/module/cpuidle_qcom_spm/parameters/rpm_sleep' \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \
|
||||
! grep -qF 'sync_spm_screen_off' \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \
|
||||
! grep -qF 'sync_schedutil_rate_limit' \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync"; then
|
||||
fail "userspace DSDS DRX, compiled C daemons, CPU/L2/Wi-Fi power policy, or wcn36xx screen_off_offload sync is missing"
|
||||
fi
|
||||
if [ "$(grep -c 'sxmo_modem\.voicecalls\.lock' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_modem.sh" 2>/dev/null || echo 0)" -lt 2 ] || \
|
||||
! grep -qF 'is_recent_hangup_requested' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_modem.sh" || \
|
||||
! grep -qF 'alreadyClosedBlanked' "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp" || \
|
||||
! grep -qF 'lastRejectedCallId' "$BASE_DIR/src/dwm-plugins/callscreen_plugin.cpp"; then
|
||||
fail "voice call lock serialization, stale hangup expiry, or closed-flip hangup guard is missing"
|
||||
fi
|
||||
echo "[check] ZRAM, NetworkManager DNS filter, and target pkill cleanup..."
|
||||
ZRAMSTART="$BASE_DIR/overlay/rootfs/usr/bin/zramstart"
|
||||
NM_DNS_FILTER="$BASE_DIR/overlay/rootfs/usr/lib/NetworkManager/dispatcher.d/50-dns-filter.sh"
|
||||
@@ -1708,6 +1718,11 @@ if [ -x "$BASE_DIR/scripts/test-gps-time-sync.py" ] && \
|
||||
! "$BASE_DIR/scripts/test-gps-time-sync.py" >/dev/null 2>&1; then
|
||||
fail "host GPS-only time source test failed"
|
||||
fi
|
||||
if [ -x "$BASE_DIR/scripts/test-time-timezone-sync.py" ] && \
|
||||
command -v python3 >/dev/null 2>&1 && \
|
||||
! "$BASE_DIR/scripts/test-time-timezone-sync.py" >/dev/null 2>&1; then
|
||||
fail "host network time and live timezone sync test failed"
|
||||
fi
|
||||
|
||||
echo "[check] Cover display behaviour..."
|
||||
COVER_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c"
|
||||
@@ -1746,6 +1761,11 @@ if ! grep -qF 'bananarchy-cover-status.sh' "$COVER_EVENT" || \
|
||||
! grep -qF 'network)' "$COVER_EVENT"; then
|
||||
fail "cover event bridge lost the network/button commands"
|
||||
fi
|
||||
for token in 'mute-ring)' 'hangup-call)' 'HANGUP_CLOSE' 'MUTE_RING'; do
|
||||
if ! grep -qF -- "$token" "$COVER_EVENT"; then
|
||||
fail "cover event bridge is missing closed-flip call control: $token"
|
||||
fi
|
||||
done
|
||||
if ! grep -qF 'bananarchy-cover-event.sh network' "$NET_EVENT" || \
|
||||
! grep -qF 'bananarchy-cover-event.sh network' "$COVER_INIT"; then
|
||||
fail "network indicators are not published to the cover daemon"
|
||||
@@ -1907,6 +1927,27 @@ if ! grep -qF 'parser.add_argument("--dtb"' \
|
||||
fail "sync-beatles-bootfs.py lost its DTB/boot-image overrides"
|
||||
fi
|
||||
|
||||
echo "[check] Lock call-preservation and Power menu hygiene..."
|
||||
LOCK_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_lock.sh"
|
||||
if grep -qF 'HANGUP_CLOSE' "$LOCK_HOOK"; then
|
||||
fail "sxmo_hook_lock.sh still contains HANGUP_CLOSE call termination"
|
||||
fi
|
||||
for f in "$DMENU_SRC" \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/sxmo_appmenu.sh" \
|
||||
"$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh"; do
|
||||
if grep -qF 'Logout' "$f" || grep -qF 'confirm_logout' "$f"; then
|
||||
fail "${f#"$BASE_DIR/"} still exposes the removed Logout menu item"
|
||||
fi
|
||||
done
|
||||
if ! grep -qF 'isLiveSxmoCallFile' "$BASE_DIR/src/dwm-plugins/phone_data.h" || \
|
||||
! grep -qF 'isLiveSxmoCallFile' "$BASE_DIR/src/dwm-plugins/callscreen_plugin.cpp" || \
|
||||
! grep -qF 'is_live_sxmo_call_file' "$DMENU_SRC" || \
|
||||
! grep -qF 'isLiveSxmoCallFileNeoui' "$BASE_DIR/src/neoui/neoui.cpp" || \
|
||||
! grep -qF 'isLiveSxmoCallFileXdrawer' "$BASE_DIR/src/xdrawer/xdrawer.cpp" || \
|
||||
! grep -qF 'is_live_call_entry' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c"; then
|
||||
fail "one or more sxmo_calls readers lost post-call marker filtering"
|
||||
fi
|
||||
|
||||
if [ "$FAILURES" -ne 0 ]; then
|
||||
echo "[check] $FAILURES check(s) failed."
|
||||
exit 1
|
||||
|
||||
+169
-1
@@ -27,7 +27,7 @@ FRAME_SIZE = FB_WIDTH * FB_HEIGHT * (FB_BPP // 8)
|
||||
|
||||
|
||||
class Cover:
|
||||
def __init__(self, root, exe, config, main_cfg, lid_state=None):
|
||||
def __init__(self, root, exe, config, main_cfg, lid_state=None, extra_env=None):
|
||||
self.root = root
|
||||
self.sock_path = root / "cover.sock"
|
||||
self.fb = root / "fb1"
|
||||
@@ -43,6 +43,8 @@ class Cover:
|
||||
})
|
||||
if lid_state is not None:
|
||||
self.env["BANANARCHY_COVER_LID_STATE"] = str(lid_state)
|
||||
if extra_env:
|
||||
self.env.update(extra_env)
|
||||
self.proc = subprocess.Popen([str(exe), "--config", str(config)],
|
||||
env=self.env, stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
@@ -329,6 +331,172 @@ def main():
|
||||
os.close(keep_w)
|
||||
finally:
|
||||
daemon2.close()
|
||||
|
||||
sub3 = root / "run3"
|
||||
sub3.mkdir()
|
||||
main_cfg3 = sub3 / "sxmo.noidle"
|
||||
main_cfg3.write_text("1\n")
|
||||
events_log = sub3 / "cover-events.log"
|
||||
event_stub = sub3 / "cover-event-stub.sh"
|
||||
event_stub.write_text(
|
||||
"#!/bin/sh\n"
|
||||
f'printf "%s\\n" "$*" >> "{events_log}"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
event_stub.chmod(0o755)
|
||||
lt_path = sub3 / "localtime"
|
||||
tz_file = sub3 / "timezone"
|
||||
utc_zi = pathlib.Path("/usr/share/zoneinfo/UTC")
|
||||
ny_zi = pathlib.Path("/usr/share/zoneinfo/America/New_York")
|
||||
lt_path.symlink_to(utc_zi)
|
||||
tz_file.write_text("UTC\n", encoding="utf-8")
|
||||
cfg3 = sub3 / "cover.conf"
|
||||
cfg3.write_text(
|
||||
"enabled = 1\n"
|
||||
"backend = fb\n"
|
||||
"blank_timeout = 1\n"
|
||||
f"socket_path = {sub3 / 'cover.sock'}\n"
|
||||
f"fb_device = {sub3 / 'fb1'}\n"
|
||||
f"backlight_path = {sub3 / 'backlight'}\n"
|
||||
"brightness = 160\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
daemon3 = Cover(
|
||||
sub3,
|
||||
exe,
|
||||
cfg3,
|
||||
main_cfg3,
|
||||
extra_env={
|
||||
"BANANARCHY_COVER_EVENT_CMD": str(event_stub),
|
||||
"BANANARCHY_TZ_LOCALTIME": str(lt_path),
|
||||
"BANANARCHY_TZ_FILE": str(tz_file),
|
||||
},
|
||||
)
|
||||
try:
|
||||
daemon3.send("LID CLOSED")
|
||||
daemon3.send("CALL incoming|+380501234567|Alice|SIM1")
|
||||
if not wait_for(
|
||||
lambda: "call=incoming" in daemon3.send("STATUS") and
|
||||
"visible=1" in daemon3.send("STATUS"),
|
||||
timeout=3,
|
||||
):
|
||||
sys.stderr.write("FAIL: CALL incoming did not wake cover cleanly\n")
|
||||
return 1
|
||||
# Cover must stay lit past the 1 s blank timeout while incoming call rings.
|
||||
time.sleep(1.25)
|
||||
if not daemon3.frame()[1] or "visible=1" not in daemon3.send("STATUS"):
|
||||
sys.stderr.write("FAIL: cover blanked during active incoming call\n")
|
||||
return 1
|
||||
daemon3.send("BUTTON VOLUP")
|
||||
if not wait_for(lambda: "call=muted" in daemon3.send("STATUS"), timeout=3):
|
||||
sys.stderr.write("FAIL: BUTTON VOLUP did not mute incoming call\n")
|
||||
return 1
|
||||
if not wait_for(
|
||||
lambda: events_log.exists() and "mute-ring" in events_log.read_text(),
|
||||
timeout=2,
|
||||
):
|
||||
sys.stderr.write("FAIL: BUTTON VOLUP did not invoke mute-ring bridge\n")
|
||||
return 1
|
||||
daemon3.send("BUTTON POWER")
|
||||
if not wait_for(lambda: "call=none" in daemon3.send("STATUS"), timeout=3):
|
||||
sys.stderr.write("FAIL: BUTTON POWER did not hang up incoming call\n")
|
||||
return 1
|
||||
if not wait_for(
|
||||
lambda: "hangup-call" in events_log.read_text(),
|
||||
timeout=2,
|
||||
):
|
||||
sys.stderr.write("FAIL: BUTTON POWER did not invoke hangup-call bridge\n")
|
||||
return 1
|
||||
# Late CALL muted|-|-|- arriving after hangup must not resurrect call=muted.
|
||||
daemon3.send("CALL muted|-|-|-")
|
||||
if "call=none" not in daemon3.send("STATUS"):
|
||||
sys.stderr.write("FAIL: stale CALL muted overwrote call=none\n")
|
||||
return 1
|
||||
main_cfg3.write_text("0\n")
|
||||
daemon3.send("BUTTON")
|
||||
if not wait_for(lambda: daemon3.frame()[1], timeout=3):
|
||||
sys.stderr.write("FAIL: cover did not show idle clock after call hangup\n")
|
||||
return 1
|
||||
frame_utc = daemon3.frame()[0]
|
||||
lt_path.unlink()
|
||||
lt_path.symlink_to(ny_zi)
|
||||
tz_file.write_text("America/New_York\n", encoding="utf-8")
|
||||
daemon3.send("REFRESH")
|
||||
if not wait_for(lambda: daemon3.frame()[0] != frame_utc, timeout=3):
|
||||
sys.stderr.write("FAIL: live timezone change + REFRESH did not update cover clock\n")
|
||||
return 1
|
||||
if daemon3.backlight_value() == "0":
|
||||
sys.stderr.write("FAIL: expected lit backlight before SIGTERM test\n")
|
||||
return 1
|
||||
daemon3.proc.terminate()
|
||||
rc = daemon3.proc.wait(timeout=3)
|
||||
if rc != 0:
|
||||
sys.stderr.write(f"FAIL: cover daemon exited {rc} on SIGTERM\n")
|
||||
return 1
|
||||
if daemon3.backlight_value() != "0":
|
||||
sys.stderr.write(f"FAIL: SIGTERM did not blank backlight (got {daemon3.backlight_value()!r})\n")
|
||||
return 1
|
||||
print("[ok] closed-flip incoming call UI, side-key mute/hangup, and live TZ refresh")
|
||||
finally:
|
||||
daemon3.close()
|
||||
|
||||
sub4 = pathlib.Path(tmp) / "cover_event_bridge"
|
||||
sub4.mkdir()
|
||||
cover_event_sh = pathlib.Path(__file__).resolve().parents[1] / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh"
|
||||
lid_profile = sub4 / "lid-profile"
|
||||
lid_profile.write_text("flip\n", encoding="utf-8")
|
||||
contacts = sub4 / "contacts.tsv"
|
||||
contacts.write_text("+380501234567\tAlice\n", encoding="utf-8")
|
||||
ctl_log = sub4 / "coverctl.log"
|
||||
fake_ctl = sub4 / "coverctl"
|
||||
fake_ctl.write_text(
|
||||
f"#!/bin/sh\nprintf '%s\\n' \"$*\" >> {ctl_log}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
fake_ctl.chmod(0o755)
|
||||
ring_file = sub4 / "sxmo_call_ringing"
|
||||
ring_file.write_text("+380501234567\n", encoding="utf-8")
|
||||
fifo_path = sub4 / "callscreen.fifo"
|
||||
os.mkfifo(fifo_path)
|
||||
fifo_fd = os.open(fifo_path, os.O_RDWR | os.O_NONBLOCK)
|
||||
try:
|
||||
bridge_env = os.environ.copy()
|
||||
bridge_env.update({
|
||||
"BANANARCHY_LID_PROFILE_FILE": str(lid_profile),
|
||||
"BANANARCHY_COVERCTL_BIN": str(fake_ctl),
|
||||
"BANANARCHY_CALLSCREEN_FIFO": str(fifo_path),
|
||||
"BANANARCHY_RINGING_FILE": str(ring_file),
|
||||
"BANANARCHY_ACTIVE_CALL_FILE": str(sub4 / "sxmo_active_call"),
|
||||
"SXMO_CONTACTFILE": str(contacts),
|
||||
"BANANARCHY_COVER_TEST_USER_SH": "1",
|
||||
})
|
||||
for args in (
|
||||
["ring", "+380501234567", "SIM1"],
|
||||
["ring", "Alice"],
|
||||
["mute-ring"],
|
||||
["hangup-call"],
|
||||
):
|
||||
res = subprocess.run([str(cover_event_sh), *args], env=bridge_env, check=False)
|
||||
if res.returncode != 0:
|
||||
sys.stderr.write(f"FAIL: bananarchy-cover-event.sh {args} exited {res.returncode}\n")
|
||||
return 1
|
||||
ctl_lines = ctl_log.read_text(encoding="utf-8").splitlines()
|
||||
if "CALL incoming|+380501234567|Alice|SIM1" not in ctl_lines:
|
||||
sys.stderr.write(f"FAIL: unexpected ring contact resolution: {ctl_lines!r}\n")
|
||||
return 1
|
||||
if "CALL incoming|-|Alice|-" not in ctl_lines:
|
||||
sys.stderr.write(f"FAIL: unexpected contact-only ring payload: {ctl_lines!r}\n")
|
||||
return 1
|
||||
if ring_file.exists():
|
||||
sys.stderr.write("FAIL: hangup-call did not remove sxmo_call_ringing\n")
|
||||
return 1
|
||||
fifo_data = os.read(fifo_fd, 4096).decode("utf-8", errors="replace")
|
||||
if "MUTE_RING" not in fifo_data or "HANGUP_CLOSE" not in fifo_data:
|
||||
sys.stderr.write(f"FAIL: callscreen FIFO missing mute/hangup commands: {fifo_data!r}\n")
|
||||
return 1
|
||||
print("[ok] cover event bridge resolves contacts and dispatches mute/hangup")
|
||||
finally:
|
||||
os.close(fifo_fd)
|
||||
print("cover display behaviour: all checks passed")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -138,6 +138,130 @@ class DsdsDaemonTests(unittest.TestCase):
|
||||
res2 = subprocess.run([self.bin, q1, q2], capture_output=True, text=True, check=True)
|
||||
self.assertIn("DELIVER\t2\t+358401234567\tOne Two\n", res2.stdout)
|
||||
|
||||
def test_sxmo_calls_post_call_markers_ignored_and_reaped(self):
|
||||
phone_dir = os.path.join(BASE_DIR, "src", "dwm-plugins")
|
||||
cpp_src = os.path.join(self.tmpdir.name, "test_calls.cpp")
|
||||
cpp_bin = os.path.join(self.tmpdir.name, "test_calls.bin")
|
||||
with open(cpp_src, "w") as handle:
|
||||
handle.write(
|
||||
'#include <cassert>\n'
|
||||
'#include <string>\n'
|
||||
'#include "phone_data.h"\n'
|
||||
'int main(int argc, char** argv) {\n'
|
||||
' if (argc < 3) return 2;\n'
|
||||
' std::string dir = argv[1];\n'
|
||||
' std::string name = argv[2];\n'
|
||||
' return bananarchy::isLiveSxmoCallFile(dir, name.c_str()) ? 0 : 1;\n'
|
||||
'}\n'
|
||||
)
|
||||
pkg_cflags = subprocess.run(
|
||||
["pkg-config", "--cflags", "xft", "pangoxft"],
|
||||
capture_output=True, text=True, check=True,
|
||||
).stdout.split()
|
||||
subprocess.run(
|
||||
[
|
||||
"g++", "-std=c++20", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
"-I", phone_dir, *pkg_cflags, "-o", cpp_bin, cpp_src,
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
|
||||
work = os.path.join(self.tmpdir.name, "calls_work")
|
||||
rt = os.path.join(work, "run")
|
||||
cfg = os.path.join(work, "cfg")
|
||||
data = os.path.join(work, "data")
|
||||
hooks = os.path.join(cfg, "sxmo", "hooks")
|
||||
calls_dir = os.path.join(rt, "sxmo_calls")
|
||||
os.makedirs(calls_dir, exist_ok=True)
|
||||
os.makedirs(hooks, exist_ok=True)
|
||||
os.makedirs(data, exist_ok=True)
|
||||
|
||||
stubs = {
|
||||
"mmcli": "#!/bin/sh\necho 'No calls were found.'\nexit 0\n",
|
||||
"doas": "#!/bin/sh\nexit 1\n",
|
||||
"sxmo_hook_discard.sh": "#!/bin/sh\nexit 0\n",
|
||||
"sxmo_hook_hangup.sh": "#!/bin/sh\nexit 0\n",
|
||||
"sxmo_log": "#!/bin/sh\nexit 0\n",
|
||||
"pgrep": "#!/bin/sh\nexit 1\n",
|
||||
"dbus-send": "#!/bin/sh\nexit 0\n",
|
||||
"sxmo_hook_icons.sh": "icon_phn=P\n",
|
||||
"sxmo_common.sh": 'export SXMO_LOGDIR="${SXMO_LOGDIR:-$XDG_DATA_HOME/sxmo/modem}"\n',
|
||||
}
|
||||
for name, content in stubs.items():
|
||||
path = os.path.join(hooks, name)
|
||||
with open(path, "w") as handle:
|
||||
handle.write(content)
|
||||
os.chmod(path, 0o755)
|
||||
|
||||
appmenu = os.path.join(BASE_DIR, "overlay", "rootfs", "usr", "bin", "sxmo_appmenu.sh")
|
||||
modemcall = os.path.join(BASE_DIR, "overlay", "rootfs", "usr", "bin", "sxmo_modemcall.sh")
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"HOME": work,
|
||||
"XDG_CONFIG_HOME": cfg,
|
||||
"XDG_DATA_HOME": data,
|
||||
"XDG_CACHE_HOME": os.path.join(work, "cache"),
|
||||
"XDG_STATE_HOME": os.path.join(work, "state"),
|
||||
"XDG_RUNTIME_DIR": rt,
|
||||
"SXMO_LOGDIR": os.path.join(data, "sxmo", "modem"),
|
||||
"SHELLSPEC_PATH": "1",
|
||||
"PATH": f"{hooks}:{os.environ.get('PATH', '/usr/bin:/bin')}",
|
||||
})
|
||||
|
||||
def clear_calls():
|
||||
for fn in os.listdir(calls_dir):
|
||||
os.unlink(os.path.join(calls_dir, fn))
|
||||
|
||||
def check_live(files, probe_name, expect_live):
|
||||
clear_calls()
|
||||
for fn in files:
|
||||
open(os.path.join(calls_dir, fn), "w").close()
|
||||
res_cpp = subprocess.run([cpp_bin, calls_dir, probe_name], env=env)
|
||||
self.assertEqual(
|
||||
res_cpp.returncode == 0,
|
||||
expect_live,
|
||||
f"isLiveSxmoCallFile({files}, {probe_name}) expected {expect_live}",
|
||||
)
|
||||
res_sh = subprocess.run(
|
||||
["sh", "-c", f'. "{appmenu}"; has_tracked_calls'],
|
||||
env=env,
|
||||
)
|
||||
self.assertEqual(
|
||||
res_sh.returncode == 0,
|
||||
expect_live,
|
||||
f"sxmo_appmenu.sh has_tracked_calls({files}) expected {expect_live}",
|
||||
)
|
||||
|
||||
for marker in [
|
||||
"1.discardedcall",
|
||||
"1.hangedupcall",
|
||||
"1.terminated",
|
||||
"1.blockedcall",
|
||||
"1.mutedring",
|
||||
]:
|
||||
check_live([marker], marker, False)
|
||||
|
||||
check_live(["1.monitoredcall", "1.discardedcall"], "1.monitoredcall", False)
|
||||
check_live(["1.monitoredcall"], "1.monitoredcall", True)
|
||||
check_live(["1.monitoredcall", "1.mutedring"], "1.monitoredcall", True)
|
||||
for live_marker in [
|
||||
"1.pickedupcall",
|
||||
"1.initiatedcall",
|
||||
"sub1_1.ringing-in",
|
||||
"sub1_1.active",
|
||||
]:
|
||||
check_live([live_marker], live_marker, True)
|
||||
|
||||
clear_calls()
|
||||
open(os.path.join(calls_dir, "1.monitoredcall"), "w").close()
|
||||
had_hangup_req = os.path.exists("/tmp/sxmo_hangup_requested")
|
||||
try:
|
||||
subprocess.run(["sh", modemcall, "hangup", "1"], env=env, check=True)
|
||||
finally:
|
||||
if not had_hangup_req and os.path.exists("/tmp/sxmo_hangup_requested"):
|
||||
os.unlink("/tmp/sxmo_hangup_requested")
|
||||
self.assertEqual(os.listdir(calls_dir), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -17,6 +17,8 @@ BIN = BASE / "overlay/rootfs/usr/bin"
|
||||
LOCK = BIN / "bananarchy-idle-lock.sh"
|
||||
BLANK = BIN / "bananarchy-idle-blank.sh"
|
||||
WAKE = BIN / "bananarchy-screen-wake.sh"
|
||||
DPMS_SYNC = BIN / "bananarchy-display-power-sync"
|
||||
MODEM_SH = BIN / "sxmo_modem.sh"
|
||||
UNLOCK_HOOK = BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_unlock.sh"
|
||||
|
||||
WM_STUB = '''#!/bin/sh
|
||||
@@ -183,6 +185,152 @@ def main():
|
||||
if "bananarchy-idle-lock.sh cancel" not in UNLOCK_HOOK.read_text():
|
||||
return failure("sxmo_hook_unlock.sh does not cancel the pending lock")
|
||||
print("[ok] wake: screen-wake and unlock hook cancel the pending lock")
|
||||
|
||||
# Closed flip and ringing/active calls must suppress idle-lock activation.
|
||||
lid_state = root / "lid-state"
|
||||
ring_flag = root / "ring.flag"
|
||||
active_flag = root / "active.flag"
|
||||
env.update({
|
||||
"BANANARCHY_LID_STATE": str(lid_state),
|
||||
"BANANARCHY_RING_FLAG": str(ring_flag),
|
||||
"BANANARCHY_ACTIVE_CALL_FLAG": str(active_flag),
|
||||
})
|
||||
clear()
|
||||
dark(True)
|
||||
cfg.write_text("0\n", encoding="utf-8")
|
||||
lid_state.write_text("closed\n", encoding="utf-8")
|
||||
run(LOCK, "arm")
|
||||
if log():
|
||||
return failure("idle-lock fired while flip was closed")
|
||||
lid_state.write_text("open\n", encoding="utf-8")
|
||||
ring_flag.write_text("1\n", encoding="utf-8")
|
||||
run(LOCK, "arm")
|
||||
if log():
|
||||
return failure("idle-lock fired while a call was ringing")
|
||||
ring_flag.unlink()
|
||||
active_flag.write_text("2\n", encoding="utf-8")
|
||||
run(LOCK, "arm")
|
||||
if log():
|
||||
return failure("idle-lock fired while a call was active")
|
||||
active_flag.unlink()
|
||||
print("[ok] closed-flip and active/ringing calls suppress idle-lock")
|
||||
|
||||
# bananarchy-display-power-sync must keep screen_off=N unless rpm_sleep=Y.
|
||||
for prof_val in ("slider\n", "flip\n"):
|
||||
prof_file = root / "lid-profile"
|
||||
prof_file.write_text(prof_val, encoding="utf-8")
|
||||
lid_state.write_text("open\n" if prof_val == "slider\n" else "closed\n",
|
||||
encoding="utf-8")
|
||||
br_file = root / "brightness"
|
||||
blp_file = root / "bl_power"
|
||||
kbd_file = root / "kbd_brightness"
|
||||
dpms_file = root / "dpms"
|
||||
gpu_file = root / "gpu_gov"
|
||||
wifi_file = root / "wifi_offload"
|
||||
spm_screen_file = root / "spm_screen_off"
|
||||
spm_rpm_file = root / "spm_rpm_sleep"
|
||||
br_file.write_text("0\n", encoding="utf-8")
|
||||
blp_file.write_text("4\n", encoding="utf-8")
|
||||
kbd_file.write_text("0\n", encoding="utf-8")
|
||||
dpms_file.write_text("Off\n", encoding="utf-8")
|
||||
gpu_file.write_text("simple_ondemand\n", encoding="utf-8")
|
||||
wifi_file.write_text("N\n", encoding="utf-8")
|
||||
spm_screen_file.write_text("N\n", encoding="utf-8")
|
||||
spm_rpm_file.write_text("N\n", encoding="utf-8")
|
||||
dpms_env = dict(os.environ)
|
||||
dpms_env.update({
|
||||
"BANANARCHY_LID_PROFILE": str(prof_file),
|
||||
"BANANARCHY_LID_STATE": str(lid_state),
|
||||
"BANANARCHY_LID_GATE": "/bin/false" if prof_val == "flip\n" else "/bin/true",
|
||||
"BANANARCHY_BR_PATH": str(br_file),
|
||||
"BANANARCHY_BL_POWER_PATH": str(blp_file),
|
||||
"BANANARCHY_KBD_PATH": str(kbd_file),
|
||||
"BANANARCHY_DPMS_PATH": str(dpms_file),
|
||||
"BANANARCHY_GPU_GOV_PATH": str(gpu_file),
|
||||
"BANANARCHY_WIFI_OFFLOAD_PATH": str(wifi_file),
|
||||
"BANANARCHY_SPM_SCREEN_OFF_PATH": str(spm_screen_file),
|
||||
"BANANARCHY_SPM_RPM_SLEEP_PATH": str(spm_rpm_file),
|
||||
"BANANARCHY_COVER_MARKER": str(root / "cover-backlight"),
|
||||
"BANANARCHY_FORCE_MARKER": str(root / "cover-bl-force"),
|
||||
"BANANARCHY_STATE_CACHE": str(root / "cover-power-state"),
|
||||
})
|
||||
res = subprocess.run(["sh", str(DPMS_SYNC)], env=dpms_env,
|
||||
capture_output=True, text=True)
|
||||
if res.returncode != 0 or spm_screen_file.read_text().strip() != "N":
|
||||
return failure("display-power-sync set screen_off=Y while rpm_sleep=N (%s)"
|
||||
% prof_val.strip())
|
||||
spm_rpm_file.write_text("Y\n", encoding="utf-8")
|
||||
res = subprocess.run(["sh", str(DPMS_SYNC)], env=dpms_env,
|
||||
capture_output=True, text=True)
|
||||
if res.returncode != 0 or spm_screen_file.read_text().strip() != "Y":
|
||||
return failure("display-power-sync did not set screen_off=Y when rpm_sleep=Y (%s)"
|
||||
% prof_val.strip())
|
||||
print("[ok] display-power-sync gates spm screen_off on rpm_sleep")
|
||||
|
||||
# sxmo_modem.sh must not ring on a call that terminated mid-lookup, and must expire stale hangup flags.
|
||||
modem_rt = root / "modem_rt"
|
||||
modem_bin = root / "modem_bin"
|
||||
modem_calls = modem_rt / "sxmo_calls"
|
||||
modem_logs = modem_rt / "sxmo_logs"
|
||||
modem_rt.mkdir()
|
||||
modem_bin.mkdir()
|
||||
modem_calls.mkdir()
|
||||
modem_logs.mkdir()
|
||||
modem_events = root / "modem_events.log"
|
||||
hangup_flag = root / "sxmo_hangup_requested"
|
||||
for name, body in (
|
||||
("sxmo_hook_icons.sh", "#!/bin/sh\nicon_phn=P\n"),
|
||||
("sxmo_common.sh", "#!/bin/sh\nSXMO_LOGDIR=\"%s\"\nSXMO_BLOCKDIR=\"%s/block\"\nsxmo_log() { :; }\n" % (modem_logs, modem_logs)),
|
||||
("pnc", "#!/bin/sh\n[ \"$1\" = valid ] && exit 0\necho \"$2\"\n"),
|
||||
("sxmo_contacts.sh", "#!/bin/sh\necho 'Test Contact'\n"),
|
||||
("sxmo_hook_block_call.sh", "#!/bin/sh\nexit 1\n"),
|
||||
("sxmo_modemcall.sh", "#!/bin/sh\ncase \"$1\" in vid_to_number) echo '+380631112233' ;; list_active_calls) ;; esac\n"),
|
||||
("sxmo_jobs.sh", "#!/bin/sh\nprintf 'jobs %%s\\n' \"$*\" >> \"%s\"\n" % modem_events),
|
||||
("sxmo_state.sh", "#!/bin/sh\necho unlock\n"),
|
||||
("sxmo_wm.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("xcallscreen", "#!/bin/sh\nprintf 'xcallscreen %%s\\n' \"$*\" >> \"%s\"\n" % modem_events),
|
||||
("sxmo_hook_statusbar.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("sxmo_modemaudio.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("sxmo_notifs.sh", "#!/bin/sh\nprintf 'notif %%s\\n' \"$*\" >> \"%s\"\n" % modem_events),
|
||||
("sxmo_hook_missed_call.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("sxmo_wakelock.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("sxmo_hook_after_call.sh", "#!/bin/sh\nexit 0\n"),
|
||||
("sxmo_vibrate", "#!/bin/sh\nexit 0\n"),
|
||||
("mmcli", "#!/bin/sh\nif [ \"$3\" = '--voice-list-calls' ]; then\n if [ \"$MMCLI_MODE\" = 'terminated' ]; then\n echo '/org/freedesktop/ModemManager1/Call/7 (terminated)'\n else\n echo '/org/freedesktop/ModemManager1/Call/7 incoming (ringing-in)'\n fi\nelif echo \"$*\" | grep -q -- '-K'; then\n echo 'call.properties.state : terminated'\nfi\n"),
|
||||
):
|
||||
p = modem_bin / name
|
||||
p.write_text(body, encoding="utf-8")
|
||||
p.chmod(0o755)
|
||||
modem_env = dict(os.environ)
|
||||
modem_env.update({
|
||||
"HOME": str(home),
|
||||
"XDG_CONFIG_HOME": str(home / ".config"),
|
||||
"XDG_RUNTIME_DIR": str(modem_rt),
|
||||
"SXMO_HANGUP_FLAG": str(hangup_flag),
|
||||
"PATH": "%s:%s" % (modem_bin, os.environ.get("PATH", "")),
|
||||
"MMCLI_MODE": "ringing",
|
||||
})
|
||||
res = subprocess.run(["sh", str(MODEM_SH), "checkforincomingcalls"],
|
||||
env=modem_env, capture_output=True, text=True)
|
||||
ev_txt = modem_events.read_text() if modem_events.exists() else ""
|
||||
if res.returncode != 0 or "jobs start --group ringing" in ev_txt or "xcallscreen incoming" in ev_txt:
|
||||
return failure("sxmo_modem.sh rang or opened callscreen for an already-terminated call: %r" % ev_txt)
|
||||
if (modem_calls / "7.monitoredcall").exists():
|
||||
return failure("sxmo_modem.sh left stale .monitoredcall after terminated lookup")
|
||||
|
||||
# Stale >8s hangup flag must expire so a missed call is not misclassified as wehangedup.
|
||||
hangup_flag.write_text("1\n", encoding="utf-8")
|
||||
stale_t = time.time() - 30
|
||||
os.utime(hangup_flag, (stale_t, stale_t))
|
||||
modem_events.unlink(missing_ok=True)
|
||||
modem_env["MMCLI_MODE"] = "terminated"
|
||||
res = subprocess.run(["sh", str(MODEM_SH), "checkforfinishedcalls"],
|
||||
env=modem_env, capture_output=True, text=True)
|
||||
ev_txt = modem_events.read_text() if modem_events.exists() else ""
|
||||
if res.returncode != 0 or "notif new" not in ev_txt or hangup_flag.exists():
|
||||
return failure("stale sxmo_hangup_requested suppressed missed-call notification: %r" % ev_txt)
|
||||
print("[ok] sxmo_modem.sh guards terminated-call race and expires stale hangup flag")
|
||||
|
||||
run(LOCK, "cancel")
|
||||
print("idle blank screenlock wiring: all checks passed")
|
||||
return 0
|
||||
|
||||
@@ -31,6 +31,7 @@ INPUT_HOOKS = (
|
||||
BASE / "overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_inputhandler.sh",
|
||||
)
|
||||
EVENT = BASE / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh"
|
||||
LOCK_HOOK = BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_lock.sh"
|
||||
HOOKS = (
|
||||
BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh",
|
||||
BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_notification.sh",
|
||||
@@ -86,9 +87,12 @@ def main():
|
||||
if 'write_session_file(LOCK_FLAG, "1")' not in lid_open or \
|
||||
'write_session_file(state, "lock")' not in lid_open:
|
||||
return fail("opening the flip does not keep the desktop locked")
|
||||
if lid_open.index('write_session_file(state, "lock")') > \
|
||||
if 'write_session_file(state, "lock")' in lid_open and \
|
||||
lid_open.index('write_session_file(state, "lock")') > \
|
||||
lid_open.index('write_sysfs_int(BRIGHTNESS, bl)'):
|
||||
return fail("the desktop lock is published after the panel is relit")
|
||||
if 'callscreen_send("RAISE\\n")' not in lid_open:
|
||||
return fail("opening the flip does not raise active/incoming callscreen")
|
||||
print("[ok] lid daemon: instant close, persistent lock and bus handover")
|
||||
|
||||
scratch = pathlib.Path("/tmp/bantam/9064bb701d9e9f7c6412f0ea6846d88a")
|
||||
@@ -129,10 +133,25 @@ def main():
|
||||
"if (!visible || isLidClosed())" not in locker or \
|
||||
'runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake")' not in locker:
|
||||
return fail("locker_plugin.cpp is not gated on /run/bananarchy/lid-state")
|
||||
if "if (blankDisplay && !alreadyClosedBlanked)" not in locker or \
|
||||
locker.index("if (blankDisplay && !alreadyClosedBlanked)") > locker.index("HANGUP_CLOSE") or \
|
||||
"if (hadActiveCall)" not in locker or \
|
||||
'sendPluginCommand("callscreen", "RAISE")' not in locker:
|
||||
return fail("locker_plugin.cpp still hangs up active calls on non-blank LOCK/open or closed-flip blank")
|
||||
if "cancel_idle_lock_timer()" not in lid:
|
||||
return fail("bananarchy-lid.c does not cancel pending idle-lock timers on flip transitions")
|
||||
lock_hook = LOCK_HOOK.read_text(encoding="utf-8")
|
||||
if "HANGUP_CLOSE" in lock_hook or "hangup all" in lock_hook:
|
||||
return fail("sxmo_hook_lock.sh unconditionally hangs up calls on lock/flip-open")
|
||||
callscreen = CALLSCREEN_SRC.read_text(encoding="utf-8")
|
||||
if "/run/bananarchy/lid-state" not in callscreen or \
|
||||
'runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake")' not in callscreen:
|
||||
return fail("callscreen_plugin.cpp wakeDisplayHardware is not lid-gated")
|
||||
'runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake")' not in callscreen or \
|
||||
"isFlipClosed()" not in callscreen or \
|
||||
"notifyCoverCall(" not in callscreen or \
|
||||
"callState == CallState::Idle && !isCallActiveOrRingingFast()" not in callscreen or \
|
||||
"lastRejectedCallId" not in callscreen or \
|
||||
"syncModemCalls();" not in callscreen:
|
||||
return fail("callscreen_plugin.cpp is missing lid-gate, idle HANGUP_CLOSE guard, or stale-call RAISE verification")
|
||||
conf = COVER_CONF.read_text(encoding="utf-8")
|
||||
if "spi_word_bits" not in conf:
|
||||
return fail("the cover config lost the 8/9-bit sign-off knob")
|
||||
|
||||
Executable
+294
@@ -0,0 +1,294 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
COMMON_H = ROOT / "src" / "bananarchy-daemons" / "common.h"
|
||||
RUN_ALIGNED_C = ROOT / "src" / "bananarchy-daemons" / "bananarchy-run-aligned.c"
|
||||
TIME_SYNC_SH = ROOT / "overlay" / "rootfs" / "usr" / "bin" / "bananarchy-time-sync.sh"
|
||||
|
||||
|
||||
def test_ba_refresh_tz(tmp: pathlib.Path) -> None:
|
||||
src = tmp / "tz_probe.c"
|
||||
bin_path = tmp / "tz_probe"
|
||||
src.write_text(
|
||||
'#include "common.h"\n'
|
||||
'int main(void) {\n'
|
||||
' char cmd[16];\n'
|
||||
' time_t sample = (time_t)1700000000;\n'
|
||||
' while (fgets(cmd, sizeof(cmd), stdin)) {\n'
|
||||
' struct tm tm_now;\n'
|
||||
' ba_refresh_tz();\n'
|
||||
' localtime_r(&sample, &tm_now);\n'
|
||||
' printf("%02d\\n", tm_now.tm_hour);\n'
|
||||
' fflush(stdout);\n'
|
||||
' }\n'
|
||||
' return 0;\n'
|
||||
'}\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
"gcc",
|
||||
"-std=c11",
|
||||
"-O2",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
f"-I{COMMON_H.parent}",
|
||||
str(src),
|
||||
"-o",
|
||||
str(bin_path),
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
|
||||
lt = tmp / "localtime"
|
||||
tzf = tmp / "timezone"
|
||||
utc = pathlib.Path("/usr/share/zoneinfo/UTC")
|
||||
ny = pathlib.Path("/usr/share/zoneinfo/America/New_York")
|
||||
kyiv = pathlib.Path("/usr/share/zoneinfo/Europe/Kyiv")
|
||||
assert utc.exists() and ny.exists() and kyiv.exists(), "host zoneinfo missing"
|
||||
|
||||
# 1) Symlink repointing including A -> B -> C -> A cycle
|
||||
lt.symlink_to(utc)
|
||||
tzf.write_text("UTC\n", encoding="utf-8")
|
||||
env = os.environ.copy()
|
||||
env["BANANARCHY_TZ_LOCALTIME"] = str(lt)
|
||||
env["BANANARCHY_TZ_FILE"] = str(tzf)
|
||||
env.pop("TZ", None)
|
||||
|
||||
proc = subprocess.Popen(
|
||||
[str(bin_path)],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
env=env,
|
||||
)
|
||||
try:
|
||||
def query(step_zone: pathlib.Path, label: str, symlink_mode: bool = True) -> str:
|
||||
lt.unlink()
|
||||
if symlink_mode:
|
||||
lt.symlink_to(step_zone)
|
||||
else:
|
||||
shutil.copyfile(step_zone, lt)
|
||||
tzf.write_text(f"{label}\n", encoding="utf-8")
|
||||
assert proc.stdin is not None and proc.stdout is not None
|
||||
proc.stdin.write("q\n")
|
||||
proc.stdin.flush()
|
||||
return proc.stdout.readline().strip()
|
||||
|
||||
assert proc.stdin is not None and proc.stdout is not None
|
||||
proc.stdin.write("q\n")
|
||||
proc.stdin.flush()
|
||||
assert proc.stdout.readline().strip() == "22", "expected initial UTC hour 22"
|
||||
assert query(ny, "America/New_York", True) == "17", "expected New York hour 17"
|
||||
assert query(kyiv, "Europe/Kyiv", True) == "00", "expected Kyiv hour 00"
|
||||
assert query(utc, "UTC", True) == "22", "expected return to UTC hour 22"
|
||||
# 2) In-place file overwrite (no symlink change)
|
||||
assert query(ny, "America/New_York", False) == "17", "expected copy NY hour 17"
|
||||
assert query(kyiv, "Europe/Kyiv", False) == "00", "expected copy Kyiv hour 00"
|
||||
finally:
|
||||
proc.terminate()
|
||||
proc.wait(timeout=5)
|
||||
|
||||
|
||||
def test_run_aligned_sigusr1(tmp: pathlib.Path) -> None:
|
||||
bin_path = tmp / "run_aligned"
|
||||
out_file = tmp / "aligned_ticks"
|
||||
subprocess.run(
|
||||
[
|
||||
"gcc",
|
||||
"-std=c11",
|
||||
"-O2",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
str(RUN_ALIGNED_C),
|
||||
"-o",
|
||||
str(bin_path),
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
proc = subprocess.Popen(
|
||||
[str(bin_path), "300", "sh", "-c", f'echo tick >> "{out_file}"'],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
try:
|
||||
deadline = time.monotonic() + 3.0
|
||||
while time.monotonic() < deadline:
|
||||
if out_file.exists() and len(out_file.read_text().splitlines()) >= 1:
|
||||
break
|
||||
time.sleep(0.05)
|
||||
assert out_file.exists() and len(out_file.read_text().splitlines()) == 1
|
||||
time.sleep(0.15)
|
||||
proc.send_signal(signal.SIGUSR1)
|
||||
deadline = time.monotonic() + 2.0
|
||||
while time.monotonic() < deadline:
|
||||
if len(out_file.read_text().splitlines()) >= 2:
|
||||
break
|
||||
time.sleep(0.05)
|
||||
lines = out_file.read_text().splitlines()
|
||||
assert len(lines) >= 2, f"SIGUSR1 did not wake bananarchy-run-aligned: {lines}"
|
||||
finally:
|
||||
proc.terminate()
|
||||
proc.wait(timeout=5)
|
||||
|
||||
|
||||
def test_time_sync_waits_and_refreshes(tmp: pathlib.Path) -> None:
|
||||
fake_bin = tmp / "bin"
|
||||
fake_bin.mkdir()
|
||||
run_dir = tmp / "run"
|
||||
run_dir.mkdir()
|
||||
trace = tmp / "trace.log"
|
||||
chronyc_calls = tmp / "chronyc_calls"
|
||||
locker_fifo = tmp / "locker.fifo"
|
||||
os.mkfifo(locker_fifo)
|
||||
|
||||
chronyc = fake_bin / "chronyc"
|
||||
chronyc.write_text(
|
||||
"#!/bin/sh\n"
|
||||
f'trace="{trace}"\n'
|
||||
f'calls="{chronyc_calls}"\n'
|
||||
'sock="$2"; shift 2\n'
|
||||
'cmd="${1:-}"\n'
|
||||
'n=0; [ -r "$calls" ] && read -r n < "$calls" || true\n'
|
||||
'n=$((n + 1))\n'
|
||||
'if [ "$cmd" = "tracking" ] || [ "$cmd" = "activity" ]; then\n'
|
||||
' printf "%s\\n" "$n" > "$calls"\n'
|
||||
'fi\n'
|
||||
'echo "chronyc $cmd $n" >> "$trace"\n'
|
||||
'if [ "$cmd" = "activity" ]; then\n'
|
||||
' echo "1 sources online"\n'
|
||||
' echo "0 sources offline"\n'
|
||||
' if [ "$n" -le 5 ]; then\n'
|
||||
' echo "1 sources doing burst"\n'
|
||||
' else\n'
|
||||
' echo "0 sources doing burst"\n'
|
||||
' fi\n'
|
||||
' echo "0 sources with unknown address"\n'
|
||||
'elif [ "$cmd" = "tracking" ]; then\n'
|
||||
' if [ "$n" -le 4 ]; then\n'
|
||||
' echo "Reference ID : 00000000 ()"\n'
|
||||
' else\n'
|
||||
' echo "Reference ID : C0A80101 (ntp)"\n'
|
||||
' fi\n'
|
||||
'fi\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
chronyc.chmod(0o755)
|
||||
|
||||
for name in ("su", "bananarchy-coverctl", "killall", "sxmo_hook_statusbar.sh"):
|
||||
tool = fake_bin / name
|
||||
tool.write_text(
|
||||
f'#!/bin/sh\necho "{name} $*" >> "{trace}"\nexit 0\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
tool.chmod(0o755)
|
||||
|
||||
test_script = tmp / "time-sync-under-test.sh"
|
||||
content = TIME_SYNC_SH.read_text(encoding="utf-8")
|
||||
sock_file = tmp / "chronyd.sock"
|
||||
sock_file.touch()
|
||||
content = (
|
||||
content
|
||||
.replace("SOCKET=/run/chrony/chronyd.sock", f"SOCKET={sock_file}")
|
||||
.replace("CHRONYC=/usr/bin/chronyc", f"CHRONYC={chronyc}")
|
||||
.replace("RUNDIR=/run/bananarchy-time-sync", f"RUNDIR={run_dir}")
|
||||
.replace("[ -S \"$SOCKET\" ]", "[ -e \"$SOCKET\" ]")
|
||||
)
|
||||
test_script.write_text(content, encoding="utf-8")
|
||||
test_script.chmod(0o755)
|
||||
|
||||
fifo_reader = subprocess.Popen(
|
||||
["sh", "-c", f'cat "{locker_fifo}" > "{tmp / "locker.out"}"'],
|
||||
)
|
||||
try:
|
||||
env = os.environ.copy()
|
||||
env["PATH"] = f"{fake_bin}:{env['PATH']}"
|
||||
env["BANANARCHY_TIME_SYNC_NO_ESCALATION"] = "1"
|
||||
env["BANANARCHY_TIME_SOURCE_FILE"] = str(tmp / "missing_source")
|
||||
env["BANANARCHY_STATUS_REFRESH_CMD"] = str(fake_bin / "su")
|
||||
env["BANANARCHY_LOCKER_FIFO"] = str(locker_fifo)
|
||||
env["BANANARCHY_COVERCTL"] = str(fake_bin / "bananarchy-coverctl")
|
||||
env["BANANARCHY_SYNC_WAIT"] = "6"
|
||||
env["BANANARCHY_TIME_SYNC_SLEEP"] = "0.02"
|
||||
|
||||
res = subprocess.run([str(test_script), "network-up"], env=env, capture_output=True, text=True)
|
||||
assert res.returncode == 0, res.stderr
|
||||
finally:
|
||||
fifo_reader.wait(timeout=5)
|
||||
|
||||
events = trace.read_text(encoding="utf-8").splitlines()
|
||||
burst_idx = max(i for i, l in enumerate(events) if l.startswith("chronyc burst"))
|
||||
refresh_idx = next(i for i, l in enumerate(events) if "sxmo_hook_statusbar.sh" in l)
|
||||
tracking_after_burst = [i for i, l in enumerate(events) if i > burst_idx and l.startswith("chronyc tracking")]
|
||||
assert tracking_after_burst, f"missing post-burst tracking check: {events}"
|
||||
assert refresh_idx > tracking_after_burst[-1], (
|
||||
f"UI refresh happened before sync confirmed: {events}"
|
||||
)
|
||||
assert any("bananarchy-coverctl REFRESH" in l for l in events), events
|
||||
assert any("killall -q -USR1 bananarchy-run-aligned" in l for l in events), events
|
||||
assert "REFRESH_TIME" in (tmp / "locker.out").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_shell_syntax_and_no_pkill() -> None:
|
||||
scripts = [
|
||||
ROOT / "overlay/rootfs/usr/bin/bananarchy-time-sync.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/bananarchy-gps-time-sync.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_timezonechange.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh",
|
||||
ROOT / "overlay/rootfs/usr/sbin/setup-timezone",
|
||||
ROOT / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_lock.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_mute_ring.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_discard.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_pickup.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_modem.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_modemcall.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_appmenu.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_power.sh",
|
||||
ROOT / "scripts/build-dwm-plugins.sh",
|
||||
]
|
||||
for path in scripts:
|
||||
res = subprocess.run(["sh", "-n", str(path)], capture_output=True, text=True)
|
||||
assert res.returncode == 0, f"syntax error in {path}: {res.stderr}"
|
||||
|
||||
no_pkill = [
|
||||
ROOT / "src/dwm-plugins/callscreen_plugin.cpp",
|
||||
ROOT / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_mute_ring.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_discard.sh",
|
||||
ROOT / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_pickup.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_modem.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_modemcall.sh",
|
||||
ROOT / "overlay/rootfs/usr/bin/sxmo_power.sh",
|
||||
]
|
||||
for path in no_pkill:
|
||||
txt = path.read_text(encoding="utf-8")
|
||||
assert "pkill" not in txt, f"unexpected pkill in {path}"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
tmp = pathlib.Path(td)
|
||||
test_ba_refresh_tz(tmp)
|
||||
test_run_aligned_sigusr1(tmp)
|
||||
test_time_sync_waits_and_refreshes(tmp)
|
||||
test_shell_syntax_and_no_pkill()
|
||||
print("test-time-timezone-sync: PASS")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user