Skip to content

Commit 65a2dcd

Browse files
Copilotsuperm1
andcommitted
Extend VARIANT_ID check to support both workstation and kde editions
Co-authored-by: superm1 <494526+superm1@users.noreply.github.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
1 parent 4cb12a8 commit 65a2dcd

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

src/amd_debug/installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def install(self):
6464
for line in release.split("\n"):
6565
if line.startswith("VARIANT_ID"):
6666
variant = line.split("=")[-1]
67-
if variant != "workstation":
67+
if variant not in ("workstation", "kde"):
6868
return False
6969
installer = ["dnf", "install", "-y", self.rpm]
7070
elif dist == "arch" or os.path.exists("/etc/arch-release"):

src/test_installer.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,29 @@ def test_install_iasl_fedora(
125125
)
126126
self.assertTrue(ret)
127127

128+
@patch("builtins.print")
129+
@patch("amd_debug.installer.get_distro", return_value="fedora")
130+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
131+
@patch("os.execvp", return_value=None)
132+
@patch("subprocess.check_call", return_value=0)
133+
@patch("subprocess.call", return_value=1)
134+
def test_install_iasl_fedora_kde(
135+
self,
136+
_mock_call,
137+
_mock_check_call,
138+
_mock_variant,
139+
_mock_distro,
140+
_fake_sudo,
141+
_mock_print,
142+
):
143+
"""Test install requirements function on Fedora KDE"""
144+
self.installer.set_requirements("iasl")
145+
ret = self.installer.install_dependencies()
146+
_mock_check_call.assert_called_once_with(
147+
["dnf", "install", "-y", "acpica-tools"]
148+
)
149+
self.assertTrue(ret)
150+
128151
@patch("builtins.print")
129152
@patch("amd_debug.installer.get_distro", return_value="ubuntu")
130153
@patch("os.execvp", return_value=None)
@@ -162,6 +185,27 @@ def test_install_ethtool_fedora(
162185
_mock_check_call.assert_called_once_with(["dnf", "install", "-y", "ethtool"])
163186
self.assertTrue(ret)
164187

188+
@patch("builtins.print")
189+
@patch("amd_debug.installer.get_distro", return_value="fedora")
190+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
191+
@patch("os.execvp", return_value=None)
192+
@patch("subprocess.check_call", return_value=0)
193+
@patch("subprocess.call", return_value=1)
194+
def test_install_ethtool_fedora_kde(
195+
self,
196+
_mock_call,
197+
_mock_check_call,
198+
_mock_variant,
199+
_mock_distro,
200+
_fake_sudo,
201+
_mock_print,
202+
):
203+
"""Test install requirements function on Fedora KDE"""
204+
self.installer.set_requirements("ethtool")
205+
ret = self.installer.install_dependencies()
206+
_mock_check_call.assert_called_once_with(["dnf", "install", "-y", "ethtool"])
207+
self.assertTrue(ret)
208+
165209
@patch("builtins.print")
166210
@patch("amd_debug.installer.get_distro", return_value="arch")
167211
@patch("os.execvp", return_value=None)
@@ -235,6 +279,29 @@ def test_install_edid_decode_fedora(
235279
)
236280
self.assertTrue(ret)
237281

282+
@patch("builtins.print")
283+
@patch("amd_debug.installer.get_distro", return_value="fedora")
284+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
285+
@patch("os.execvp", return_value=None)
286+
@patch("subprocess.check_call", return_value=0)
287+
@patch("subprocess.call", return_value=1)
288+
def test_install_edid_decode_fedora_kde(
289+
self,
290+
_mock_call,
291+
_mock_check_call,
292+
_mock_variant,
293+
_mock_distro,
294+
_fake_sudo,
295+
_mock_print,
296+
):
297+
"""Test install requirements function for edid-decode on Fedora KDE"""
298+
self.installer.set_requirements("edid-decode")
299+
ret = self.installer.install_dependencies()
300+
_mock_check_call.assert_called_once_with(
301+
["dnf", "install", "-y", "libdisplay-info-tools"]
302+
)
303+
self.assertTrue(ret)
304+
238305
@patch("builtins.print")
239306
@patch("amd_debug.installer.get_distro", return_value="arch")
240307
@patch("os.execvp", return_value=None)

0 commit comments

Comments
 (0)