From 0e771f0ed6cb900e6eccc3a4205120ae8c0f7ee2 Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 4 Jun 2019 14:01:49 +1200 Subject: [PATCH] tests blackbox ndrdump: Add test for struct printing 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 Reviewed-by: Andrew Bartlett --- python/samba/tests/blackbox/ndrdump.py | 12 ++++++++++-- selftest/knownfail.d/ndrdump | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 selftest/knownfail.d/ndrdump diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py index 350d576bc81..7ca7b93f559 100644 --- a/python/samba/tests/blackbox/ndrdump.py +++ b/python/samba/tests/blackbox/ndrdump.py @@ -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 index 00000000000..9f7335f5d0b --- /dev/null +++ b/selftest/knownfail.d/ndrdump @@ -0,0 +1 @@ +^samba.tests.blackbox.ndrdump.samba.tests.blackbox.ndrdump.NdrDumpTests.test_ndrdump_with_hex_struct_name\(none\) -- 2.11.4.GIT