diff mbox series

[2/4] boot linux test: update arm bionic URL

Message ID 20200907042000.415931-3-crosa@redhat.com
State New
Headers show
Series Acceptance Tests: update assets location and cancel tests if missing | expand

Commit Message

Cleber Rosa Sept. 7, 2020, 4:19 a.m. UTC
Which uses an xz compressed file, which has builtin support for
decompression on avocado.utils.archive.  So the check for P7ZIP can be
dropped, and extraction logic simplified.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

Comments

Philippe Mathieu-Daudé Sept. 7, 2020, 7:52 a.m. UTC | #1
Hi Cleber,

On 9/7/20 6:19 AM, Cleber Rosa wrote:
> Which uses an xz compressed file, which has builtin support for
> decompression on avocado.utils.archive.

This line doesn't make sense without the patch subject
prepended "Update arm bionic URL". To make commit
descriptions coherent, please copy the subject.

Not all email clients display email subject right
before the email content.

> So the check for P7ZIP can be
> dropped, and extraction logic simplified.
> 
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>  tests/acceptance/boot_linux_console.py | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 751b47b8fd..c75c512c8b 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -22,12 +22,6 @@ from avocado.utils import process
>  from avocado.utils import archive
>  from avocado.utils.path import find_command, CmdNotFoundError
>  
> -P7ZIP_AVAILABLE = True
> -try:
> -    find_command('7z')
> -except CmdNotFoundError:
> -    P7ZIP_AVAILABLE = False
> -
>  """
>  Round up to next power of 2
>  """
> @@ -687,7 +681,6 @@ class BootLinuxConsole(LinuxKernelTest):
>          self.vm.wait()
>  
>      @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
> -    @skipUnless(P7ZIP_AVAILABLE, '7z not installed')
>      def test_arm_orangepi_bionic(self):
>          """
>          :avocado: tags=arch:arm
> @@ -695,14 +688,13 @@ class BootLinuxConsole(LinuxKernelTest):
>          :avocado: tags=device:sd
>          """
>  
> -        # This test download a 196MB compressed image and expand it to 1GB
> +        # This test download a 275MB compressed image and expand it to 1.1GB
>          image_url = ('https://dl.armbian.com/orangepipc/archive/'
> -                     'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z')
> -        image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e'
> -        image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash)
> -        image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img'
> -        image_path = os.path.join(self.workdir, image_name)
> -        process.run("7z e -o%s %s" % (self.workdir, image_path_7z))
> +                     'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
> +        image_hash = 'b4d6775f5673486329e45a0586bf06b6dbe792199fd182ac6b9c7bb6c7d3e6dd'
> +        image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
> +                                         algorithm='sha256')
> +        image_path = archive.extract(image_path_xz, self.workdir)
>          image_pow2ceil_expand(image_path)

Nack, this is not the same test. You might be lucky it test the
same things, but this is not what the developer tested.
This is not how acceptance tests are supposed to work IMHO.

>  
>          self.vm.set_console()
>
Willian Rampazzo Sept. 8, 2020, 6:19 p.m. UTC | #2
On Mon, Sep 7, 2020 at 1:20 AM Cleber Rosa <crosa@redhat.com> wrote:
>
> Which uses an xz compressed file, which has builtin support for
> decompression on avocado.utils.archive.  So the check for P7ZIP can be
> dropped, and extraction logic simplified.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>  tests/acceptance/boot_linux_console.py | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 751b47b8fd..c75c512c8b 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -22,12 +22,6 @@ from avocado.utils import process
>  from avocado.utils import archive
>  from avocado.utils.path import find_command, CmdNotFoundError
>
> -P7ZIP_AVAILABLE = True
> -try:
> -    find_command('7z')
> -except CmdNotFoundError:
> -    P7ZIP_AVAILABLE = False
> -
>  """
>  Round up to next power of 2
>  """
> @@ -687,7 +681,6 @@ class BootLinuxConsole(LinuxKernelTest):
>          self.vm.wait()
>
>      @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
> -    @skipUnless(P7ZIP_AVAILABLE, '7z not installed')
>      def test_arm_orangepi_bionic(self):
>          """
>          :avocado: tags=arch:arm
> @@ -695,14 +688,13 @@ class BootLinuxConsole(LinuxKernelTest):
>          :avocado: tags=device:sd
>          """
>
> -        # This test download a 196MB compressed image and expand it to 1GB
> +        # This test download a 275MB compressed image and expand it to 1.1GB
>          image_url = ('https://dl.armbian.com/orangepipc/archive/'
> -                     'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z')
> -        image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e'
> -        image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash)
> -        image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img'
> -        image_path = os.path.join(self.workdir, image_name)
> -        process.run("7z e -o%s %s" % (self.workdir, image_path_7z))
> +                     'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')

I see you bumped the version here because version 19 is not available
in the URL anymore, so it is fine for me.

> +        image_hash = 'b4d6775f5673486329e45a0586bf06b6dbe792199fd182ac6b9c7bb6c7d3e6dd'
> +        image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
> +                                         algorithm='sha256')
> +        image_path = archive.extract(image_path_xz, self.workdir)
>          image_pow2ceil_expand(image_path)
>
>          self.vm.set_console()
> --
> 2.25.4
>

Except for the subject and description seaming a bit confusing as
pointed by Philippe, the changes look good to me.

Reviewed-by: Willian Rampazzo <willianr@redhat.com>
diff mbox series

Patch

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 751b47b8fd..c75c512c8b 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -22,12 +22,6 @@  from avocado.utils import process
 from avocado.utils import archive
 from avocado.utils.path import find_command, CmdNotFoundError
 
-P7ZIP_AVAILABLE = True
-try:
-    find_command('7z')
-except CmdNotFoundError:
-    P7ZIP_AVAILABLE = False
-
 """
 Round up to next power of 2
 """
@@ -687,7 +681,6 @@  class BootLinuxConsole(LinuxKernelTest):
         self.vm.wait()
 
     @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
-    @skipUnless(P7ZIP_AVAILABLE, '7z not installed')
     def test_arm_orangepi_bionic(self):
         """
         :avocado: tags=arch:arm
@@ -695,14 +688,13 @@  class BootLinuxConsole(LinuxKernelTest):
         :avocado: tags=device:sd
         """
 
-        # This test download a 196MB compressed image and expand it to 1GB
+        # This test download a 275MB compressed image and expand it to 1.1GB
         image_url = ('https://dl.armbian.com/orangepipc/archive/'
-                     'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z')
-        image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e'
-        image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash)
-        image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img'
-        image_path = os.path.join(self.workdir, image_name)
-        process.run("7z e -o%s %s" % (self.workdir, image_path_7z))
+                     'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
+        image_hash = 'b4d6775f5673486329e45a0586bf06b6dbe792199fd182ac6b9c7bb6c7d3e6dd'
+        image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
+                                         algorithm='sha256')
+        image_path = archive.extract(image_path_xz, self.workdir)
         image_pow2ceil_expand(image_path)
 
         self.vm.set_console()