tools/python: Improve unit test handling

* Add X86_{CPUID,MSR}_POLICY_FORMAT checks which were missed previously.
 * Drop test_suite().  It hasn't been necessary since the Py2.3 era.
 * Drop the __main__ logic.  This can't be used without manually adjusting the
   include path, and `make test` knows how to do the right thing.
 * For `make test`, use `-v` to see which tests have been discovered and run.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
Andrew Cooper committed 2023-03-17 10:44:16 +00:00
1 parent 8d14976d37
commit fd8fecb97b
2 files changed
+3 -13

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ uninstall:
.PHONY: test .PHONY: test
test: test:
LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover -v
.PHONY: clean .PHONY: clean
clean: clean:
+2 -12
View File
@@ -26,6 +26,8 @@ class TestLibxc(unittest.TestCase):
(libxc.X86_TSC_INFO_FORMAT, 24), (libxc.X86_TSC_INFO_FORMAT, 24),
(libxc.HVM_PARAMS_ENTRY_FORMAT, 16), (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
(libxc.HVM_PARAMS_FORMAT, 8), (libxc.HVM_PARAMS_FORMAT, 8),
(libxc.X86_CPUID_POLICY_FORMAT, 24),
(libxc.X86_MSR_POLICY_FORMAT, 16),
): ):
self.assertEqual(calcsize(fmt), sz) self.assertEqual(calcsize(fmt), sz)
@@ -40,15 +42,3 @@ class TestLibxl(unittest.TestCase):
(libxl.EMULATOR_HEADER_FORMAT, 8), (libxl.EMULATOR_HEADER_FORMAT, 8),
): ):
self.assertEqual(calcsize(fmt), sz) self.assertEqual(calcsize(fmt), sz)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestLibxc))
suite.addTest(unittest.makeSuite(TestLibxl))
return suite
if __name__ == "__main__":
unittest.main()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.