Skip to content

Commit

Permalink
Fix missing ubuntu24 distro override
Browse files Browse the repository at this point in the history
  • Loading branch information
samcmill committed Sep 18, 2024
1 parent e712954 commit 8eec9fa
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hpccm/primitives/baseimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def __init__(self, **kwargs):
hpccm.config.set_linux_distro('ubuntu20')
elif self.__distro == 'ubuntu22':
hpccm.config.set_linux_distro('ubuntu22')
elif self.__distro == 'ubuntu24':
hpccm.config.set_linux_distro('ubuntu24')
elif self.__distro == 'centos':
hpccm.config.set_linux_distro('centos')
elif self.__distro == 'centos7':
Expand Down
49 changes: 49 additions & 0 deletions test/test_baseimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ def test_detect_ubuntu_20(self):
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('20.04'))

@docker
def test_detect_ubuntu_22(self):
"""Base image Linux distribution detection"""
b = baseimage(image='ubuntu:22.04')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('22.04'))

@docker
def test_detect_ubuntu_24(self):
"""Base image Linux distribution detection"""
b = baseimage(image='ubuntu:24.04')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('24.04'))

@docker
def test_detect_centos(self):
"""Base image Linux distribution detection"""
Expand Down Expand Up @@ -216,6 +230,13 @@ def test_detect_rockylinux_8(self):
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX)
self.assertEqual(hpccm.config.g_linux_version, Version('8.0'))

@docker
def test_detect_rockylinux_9(self):
"""Base image Linux distribution detection"""
b = baseimage(image='rockylinux/rockylinux:9')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX)
self.assertEqual(hpccm.config.g_linux_version, Version('9.0'))

@docker
def test_detect_ubi7(self):
"""Base image Linux distribution detection"""
Expand Down Expand Up @@ -274,6 +295,20 @@ def test_distro_ubuntu20(self):
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('20.04'))

@docker
def test_distro_ubuntu22(self):
"""Base image Linux distribution specification"""
b = baseimage(image='foo', _distro='ubuntu22')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('22.04'))

@docker
def test_distro_ubuntu24(self):
"""Base image Linux distribution specification"""
b = baseimage(image='foo', _distro='ubuntu24')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, Version('24.04'))

@docker
def test_distro_centos(self):
"""Base image Linux distribution specification"""
Expand All @@ -295,6 +330,20 @@ def test_distro_centos8(self):
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
self.assertEqual(hpccm.config.g_linux_version, Version('8.0'))

@docker
def test_distro_rockylinux8(self):
"""Base image Linux distribution specification"""
b = baseimage(image='foo', _distro='rockylinux8')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
self.assertEqual(hpccm.config.g_linux_version, Version('8.0'))

@docker
def test_distro_rockylinux9(self):
"""Base image Linux distribution specification"""
b = baseimage(image='foo', _distro='rockylinux9')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
self.assertEqual(hpccm.config.g_linux_version, Version('9.0'))

@docker
def test_distro_nonexistent(self):
"""Base image Linux distribution specification"""
Expand Down

0 comments on commit 8eec9fa

Please sign in to comment.