bpo-34582: Adds JUnit XML output for regression tests (GH-9210)

(cherry picked from commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index dab17c3..2af839a 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -268,6 +268,10 @@
                        help='if a test file alters the environment, mark '
                             'the test as failed')
 
+    group.add_argument('--junit-xml', dest='xmlpath', metavar='FILENAME',
+                       help='writes JUnit-style XML results to the specified '
+                            'file')
+
     return parser