[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/python: Improve unit test handling



commit fd8fecb97ba98cd7d819d6963d7562fe14436a6b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Mar 14 10:59:25 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    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@xxxxxxxxxx>
    Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 tools/python/Makefile               |  2 +-
 tools/python/xen/migration/tests.py | 14 ++------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/tools/python/Makefile b/tools/python/Makefile
index cc76423647..437431c48e 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -36,7 +36,7 @@ uninstall:
 
 .PHONY: 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
 clean:
diff --git a/tools/python/xen/migration/tests.py 
b/tools/python/xen/migration/tests.py
index ff2768946b..f22e2c2b7c 100644
--- a/tools/python/xen/migration/tests.py
+++ b/tools/python/xen/migration/tests.py
@@ -26,6 +26,8 @@ class TestLibxc(unittest.TestCase):
                          (libxc.X86_TSC_INFO_FORMAT, 24),
                          (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
                          (libxc.HVM_PARAMS_FORMAT, 8),
+                         (libxc.X86_CPUID_POLICY_FORMAT, 24),
+                         (libxc.X86_MSR_POLICY_FORMAT, 16),
                          ):
             self.assertEqual(calcsize(fmt), sz)
 
@@ -40,15 +42,3 @@ class TestLibxl(unittest.TestCase):
                          (libxl.EMULATOR_HEADER_FORMAT, 8),
                          ):
             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()
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.