tests blackbox ndrdump: Add test for struct printing
authorGary Lockyer <gary@catalyst.net.nz>
Tue, 4 Jun 2019 02:01:49 +0000 (14:01 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 6 Jun 2019 03:30:18 +0000 (03:30 +0000)
Add test for the dumping of a public structure with ndrdump.  This
removes the need to define decode_* functions in the idl.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/blackbox/ndrdump.py
selftest/knownfail.d/ndrdump [new file with mode: 0644]

index 350d576bc81906e6e91408e93d02fbfe2929d1e1..7ca7b93f559cb89538ad7cce352c3890e9600e5a 100644 (file)
@@ -22,7 +22,7 @@ from __future__ import print_function
 """Blackbox tests for ndrdump."""
 
 import os
-from samba.tests import BlackboxTestCase
+from samba.tests import BlackboxTestCase, BlackboxProcessError
 
 for p in ["../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
     data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
@@ -49,6 +49,14 @@ class NdrDumpTests(BlackboxTestCase):
     def test_ndrdump_with_validate(self):
         self.check_run("ndrdump --validate samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
 
-    def test_ndrdump_with_hex(self):
+    def test_ndrdump_with_hex_decode_function(self):
         self.check_run("ndrdump dns decode_dns_name_packet in --hex-input %s" %
                        self.data_path("dns-decode_dns_name_packet-hex.dat"))
+
+    def test_ndrdump_with_hex_struct_name(self):
+        try:
+            self.check_run(
+                "ndrdump dns dns_name_packet struct --hex-input %s" %
+                self.data_path("dns-decode_dns_name_packet-hex.dat"))
+        except BlackboxProcessError as e:
+            self.fail(e)
diff --git a/selftest/knownfail.d/ndrdump b/selftest/knownfail.d/ndrdump
new file mode 100644 (file)
index 0000000..9f7335f
--- /dev/null
@@ -0,0 +1 @@
+^samba.tests.blackbox.ndrdump.samba.tests.blackbox.ndrdump.NdrDumpTests.test_ndrdump_with_hex_struct_name\(none\)