#!/bin/sh # libink: introspection XML well-formedness. # # Covers compound type signatures in generated introspection XML: # Cond1.Dump declares out_sig "a(ss)", which must appear as a single # , not one per signature character. set -eu TEST_DIR=$(dirname "$0") # shellcheck source=/dev/null . "$TEST_DIR/lib/setup.sh" # shellcheck source=/dev/null . "$TEST_DIR/lib/dbus-setup.sh" say "Introspect on /org/finit/cond" xml=$(texec "$CLIENT" introspect "$BUS" /org/finit/cond) say "Cond1.Dump advertises a single a(ss) out arg" case "$xml" in *''*) assert "a(ss) intact" 0 -eq 0 ;; *) fail "a(ss) not found as a single arg" ;; esac say "No per-character type fragments in the XML" case "$xml" in *'type="("'* | *'type=")"'* | *'type="{"'* | *'type="}"'* | *'type="a"'*) fail "per-character fragment leaked" ;; *) assert "no bracket/array fragments" 0 -eq 0 ;; esac # ---------- declarations ---------- say "Cond1 declares the ConditionChanged signal" case "$xml" in *''*) assert "ConditionChanged declared" 0 -eq 0 ;; *) fail "ConditionChanged missing from Cond1 XML" ;; esac say "Manager1 declares ServiceStateChanged and RunlevelChanged" mgr=$(texec "$CLIENT" introspect "$BUS" /org/finit/manager) case "$mgr" in *''*''*) assert "Manager1 signals declared" 0 -eq 0 ;; *) fail "Manager1 signal declarations missing" ;; esac say "Properties declares PropertiesChanged, org.freedesktop.DBus is present" case "$mgr" in *''*) assert "PropertiesChanged declared" 0 -eq 0 ;; *) fail "PropertiesChanged missing from Properties XML" ;; esac # Hello/AddMatch/RemoveMatch are answered on the canonical object # only, so they must be declared there and nowhere else. drv=$(texec "$CLIENT" introspect "$BUS" /org/freedesktop/DBus) case "$drv" in *''*) assert "org.freedesktop.DBus declared on canonical object" 0 -eq 0 ;; *) fail "org.freedesktop.DBus missing from /org/freedesktop/DBus" ;; esac case "$mgr" in *''*) fail "org.freedesktop.DBus leaked onto /org/finit/manager" ;; *) assert "org.freedesktop.DBus not advertised off-path" 0 -eq 0 ;; esac