From 238d08b07d0178940c28839518c9f1afbc605378 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 6 Dec 2019 11:00:57 +1300 Subject: [PATCH] selftest: Confirm that ndrdump struct mode is not available for enums These are not passed by pointer so the structure dump system does not work for these. It is best to dump the containing structure instead. Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- python/samba/tests/blackbox/ndrdump.py | 14 ++++++++++++++ selftest/knownfail.d/ndrdump-structs-only | 1 + 2 files changed, 15 insertions(+) create mode 100644 selftest/knownfail.d/ndrdump-structs-only diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py index f56858e98ba..5e4b3bfbd8c 100644 --- a/python/samba/tests/blackbox/ndrdump.py +++ b/python/samba/tests/blackbox/ndrdump.py @@ -111,6 +111,20 @@ dump OK # convert expected to bytes for python 3 self.assertEqual(actual, expected.encode('utf-8')) + def test_ndrdump_with_enum_not_struct(self): + expected = '''Public structure 'netr_SchannelType' not found +''' + try: + actual = self.check_exit_code( + "ndrdump misc netr_SchannelType --input=x struct", + 1) + except BlackboxProcessError as e: + self.fail(e) + + # check_output will return bytes + # convert expected to bytes for python 3 + self.assertEqual(actual, expected.encode('utf-8')) + def test_ndrdump_input_cmdline_short_struct_name(self): expected = '''pull returned Buffer Size Error ''' diff --git a/selftest/knownfail.d/ndrdump-structs-only b/selftest/knownfail.d/ndrdump-structs-only new file mode 100644 index 00000000000..733ea495490 --- /dev/null +++ b/selftest/knownfail.d/ndrdump-structs-only @@ -0,0 +1 @@ +^samba.tests.blackbox.ndrdump.samba.tests.blackbox.ndrdump.NdrDumpTests.test_ndrdump_with_enum_not_struct