From 9925422bd502153c8cc783b4020269f7ff98c05a Mon Sep 17 00:00:00 2001 From: Stanley Hon Date: Tue, 26 Mar 2019 03:28:01 -0700 Subject: [PATCH] Adding OS Release and OS Build info to the run_info for Edge (#15992) --- tools/wptrunner/wptrunner/browsers/edge.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/wptrunner/wptrunner/browsers/edge.py b/tools/wptrunner/wptrunner/browsers/edge.py index 25309617ad0081..027c8f87d493c2 100644 --- a/tools/wptrunner/wptrunner/browsers/edge.py +++ b/tools/wptrunner/wptrunner/browsers/edge.py @@ -1,4 +1,5 @@ from __future__ import print_function +import subprocess from .base import Browser, ExecutorBrowser, require_arg from ..webdriver_server import EdgeDriverServer from ..executors import executor_kwargs as base_executor_kwargs @@ -16,6 +17,7 @@ "executor_kwargs": "executor_kwargs", "env_extras": "env_extras", "env_options": "env_options", + "run_info_extras": "run_info_extras", "timeout_multiplier": "get_timeout_multiplier"} @@ -97,3 +99,17 @@ def cleanup(self): def executor_browser(self): return ExecutorBrowser, {"webdriver_url": self.server.url} + + +def run_info_extras(**kwargs): + osReleaseCommand = "(Get-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion').ReleaseId" + osBuildCommand = "(Get-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion').BuildLabEx" + try: + os_release = subprocess.check_output(["powershell.exe", osReleaseCommand]).strip() + os_build = subprocess.check_output(["powershell.exe", osBuildCommand]).strip() + except (subprocess.CalledProcessError, OSError): + return {} + + rv = {"os_build": os_build, + "os_release": os_release} + return rv