firewalld/SOURCES/0012-test-dbus-direct-add-coverage-for-signatures.patch
2021-12-02 16:38:13 +00:00

380 lines
14 KiB
Diff

From e0bc051a52bccdbd17ada7ab974b1c32d25ac7c1 Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Mon, 8 Feb 2021 14:53:38 -0500
Subject: [PATCH 12/22] test(dbus): direct: add coverage for signatures
(cherry picked from commit 4673e0e55353c3f0243035f47d7c2832db9928e4)
(cherry picked from commit 1b1b27ec0c19046ef041d465e44c81ad0f675fc9)
---
src/tests/dbus/dbus.at | 1 +
src/tests/dbus/direct.at | 348 +++++++++++++++++++++++++++++++++++++++
2 files changed, 349 insertions(+)
create mode 100644 src/tests/dbus/direct.at
diff --git a/src/tests/dbus/dbus.at b/src/tests/dbus/dbus.at
index 5f7b6cbdc108..a9707f825041 100644
--- a/src/tests/dbus/dbus.at
+++ b/src/tests/dbus/dbus.at
@@ -9,3 +9,4 @@ m4_include([dbus/policy_permanent_signatures.at])
m4_include([dbus/policy_runtime_signatures.at])
m4_include([dbus/policy_permanent_functional.at])
m4_include([dbus/policy_runtime_functional.at])
+m4_include([dbus/direct.at])
diff --git a/src/tests/dbus/direct.at b/src/tests/dbus/direct.at
new file mode 100644
index 000000000000..fe92db6bb510
--- /dev/null
+++ b/src/tests/dbus/direct.at
@@ -0,0 +1,348 @@
+FWD_START_TEST([dbus api - direct signatures])
+AT_KEYWORDS(dbus direct)
+
+dnl ###############################
+dnl ########## runtime ############
+dnl ###############################
+
+DBUS_INTROSPECT([], [[//method[@name="addChain"]]], 0, [dnl
+ <method name="addChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="addPassthrough"]]], 0, [dnl
+ <method name="addPassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="addRule"]]], 0, [dnl
+ <method name="addRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getAllChains"]]], 0, [dnl
+ <method name="getAllChains">
+ <arg direction="out" type="a(sss)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getAllPassthroughs"]]], 0, [dnl
+ <method name="getAllPassthroughs">
+ <arg direction="out" type="a(sas)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getAllRules"]]], 0, [dnl
+ <method name="getAllRules">
+ <arg direction="out" type="a(sssias)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getChains"]]], 0, [dnl
+ <method name="getChains">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="out" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getPassthroughs"]]], 0, [dnl
+ <method name="getPassthroughs">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="out" type="aas"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="getRules"]]], 0, [dnl
+ <method name="getRules">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="out" type="a(ias)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="passthrough"]]], 0, [dnl
+ <method name="passthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ <arg direction="out" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="queryChain"]]], 0, [dnl
+ <method name="queryChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="queryPassthrough"]]], 0, [dnl
+ <method name="queryPassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="queryRule"]]], 0, [dnl
+ <method name="queryRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="removeAllPassthroughs"]]], 0, [dnl
+ <method name="removeAllPassthroughs">
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="removeChain"]]], 0, [dnl
+ <method name="removeChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="removePassthrough"]]], 0, [dnl
+ <method name="removePassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="removeRule"]]], 0, [dnl
+ <method name="removeRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//method[@name="removeRules"]]], 0, [dnl
+ <method name="removeRules">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="ChainAdded"]]], 0, [dnl
+ <signal name="ChainAdded">
+ <arg name="ipv" type="s"></arg>
+ <arg name="table" type="s"></arg>
+ <arg name="chain" type="s"></arg>
+ </signal>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="ChainRemoved"]]], 0, [dnl
+ <signal name="ChainRemoved">
+ <arg name="ipv" type="s"></arg>
+ <arg name="table" type="s"></arg>
+ <arg name="chain" type="s"></arg>
+ </signal>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="PassthroughAdded"]]], 0, [dnl
+ <signal name="PassthroughAdded">
+ <arg name="ipv" type="s"></arg>
+ <arg name="args" type="as"></arg>
+ </signal>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="PassthroughRemoved"]]], 0, [dnl
+ <signal name="PassthroughRemoved">
+ <arg name="ipv" type="s"></arg>
+ <arg name="args" type="as"></arg>
+ </signal>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="RuleAdded"]]], 0, [dnl
+ <signal name="RuleAdded">
+ <arg name="ipv" type="s"></arg>
+ <arg name="table" type="s"></arg>
+ <arg name="chain" type="s"></arg>
+ <arg name="priority" type="i"></arg>
+ <arg name="args" type="as"></arg>
+ </signal>
+])
+
+DBUS_INTROSPECT([], [[//signal[@name="RuleRemoved"]]], 0, [dnl
+ <signal name="RuleRemoved">
+ <arg name="ipv" type="s"></arg>
+ <arg name="table" type="s"></arg>
+ <arg name="chain" type="s"></arg>
+ <arg name="priority" type="i"></arg>
+ <arg name="args" type="as"></arg>
+ </signal>
+])
+
+dnl ###############################
+dnl ######### permanent ###########
+dnl ###############################
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getSettings"]]], 0, [dnl
+ <method name="getSettings">
+ <arg direction="out" type="(a(sss)a(sssias)a(sas))"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="update"]]], 0, [dnl
+ <method name="update">
+ <arg direction="in" name="settings" type="(a(sss)a(sssias)a(sas))"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="addChain"]]], 0, [dnl
+ <method name="addChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="addPassthrough"]]], 0, [dnl
+ <method name="addPassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="addRule"]]], 0, [dnl
+ <method name="addRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getAllChains"]]], 0, [dnl
+ <method name="getAllChains">
+ <arg direction="out" type="a(sss)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getAllPassthroughs"]]], 0, [dnl
+ <method name="getAllPassthroughs">
+ <arg direction="out" type="a(sas)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getAllRules"]]], 0, [dnl
+ <method name="getAllRules">
+ <arg direction="out" type="a(sssias)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getChains"]]], 0, [dnl
+ <method name="getChains">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="out" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getPassthroughs"]]], 0, [dnl
+ <method name="getPassthroughs">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="out" type="aas"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="getRules"]]], 0, [dnl
+ <method name="getRules">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="out" type="a(ias)"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="queryChain"]]], 0, [dnl
+ <method name="queryChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="queryPassthrough"]]], 0, [dnl
+ <method name="queryPassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="queryRule"]]], 0, [dnl
+ <method name="queryRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ <arg direction="out" type="b"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="removeChain"]]], 0, [dnl
+ <method name="removeChain">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="removePassthrough"]]], 0, [dnl
+ <method name="removePassthrough">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="removeRule"]]], 0, [dnl
+ <method name="removeRule">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ <arg direction="in" name="priority" type="i"></arg>
+ <arg direction="in" name="args" type="as"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//method[@name="removeRules"]]], 0, [dnl
+ <method name="removeRules">
+ <arg direction="in" name="ipv" type="s"></arg>
+ <arg direction="in" name="table" type="s"></arg>
+ <arg direction="in" name="chain" type="s"></arg>
+ </method>
+])
+
+DBUS_INTROSPECT([config], [[//interface[@name="org.fedoraproject.FirewallD1.config.direct"]//signal[@name="Updated"]]], 0, [dnl
+ <signal name="Updated">
+ </signal>
+])
+
+FWD_END_TEST
--
2.27.0