On Wed, Oct 19, 2022 at 3:05 PM Philippe Mathieu-Daudé
<phi...@linaro.org> wrote:
>
> >>> +    List,
> >>> +    Optional,
> >>> +    Sequence,
> >>> +)
> >>> +from qemu.machine import QEMUMachine
> >>> +from avocado import skipIf
> >>> +from avocado_qemu import QemuBaseTest
>
> >>> +@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> >>> +class AcpiBitsTest(QemuBaseTest): #pylint: 
> >>> disable=too-many-instance-attributes
> >>> +    """
> >>> +    ACPI and SMBIOS tests using biosbits.
> >
> >   <snip>
> >
> >>> +
> >>> +    def setUp(self): # pylint: disable=arguments-differ
> >>> +        super().setUp('qemu-system-')
> >>> +
> >>> +        if shutil.which('xorriso') is None:
> >>> +            logging.error('xorriso is required to run this test.')
> >>> +            self.skipTest("xorriso is not installed. Please install it.")
> >>
> >> This would result in output like this when xorriso is not found:
> >>
> >> $ which xorriso
> >> /usr/bin/which: no xorriso in
> >> (/home/anisinha/.local/bin:/home/anisinha/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
> >> [anisinha@centos8 build]$ ./tests/venv/bin/avocado run -t acpi 
> >> tests/avocado
> >> Fetching asset from
> >> tests/avocado/acpi-bits.py:AcpiBitsTest.test_acpi_smbios_bits
> >> JOB ID     : 95aba043201755ed888ef7d1598402c555118df4
> >> JOB LOG    : 
> >> /home/anisinha/avocado/job-results/job-2022-10-19T02.27-95aba04/job.log
> >>   (1/1) tests/avocado/acpi-bits.py:AcpiBitsTest.test_acpi_smbios_bits:
> >> ERROR: xorriso is not installed. Please install it. (0.00 s)
>
> If an optional tool is missing, the test should be SKIPped, this is not
> an ERROR.

Yes will fix in v6.

>
> >> RESULTS    : PASS 0 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
> >> | CANCEL 0
> >> JOB TIME   : 0.61 s
> >>
> >>
> >
> > skipIf() was not working for me, hence I had to resort to this. I got
> > skipIf() working now so in v6 I will remove the above hunk and add the
> > conditional as @skipIf decorator.
> >
> > For the records,
> >> @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > does not work for me.
> >> @skipIf(os.getenv('GITLAB_CI') is not None, 'Running on GitLab')
> > works.
> > A quick grep indicates that the former is used all over the place!
>
> Because @skipIf works (at least as a class decorator).
>
> Maybe something is missing on your side? Look at the
> tesseract_available() example:

Yeah never mind. None type is correctly getting converted to boolean.


>
> $ git grep tesseract_available
> tests/avocado/machine_m68k_nextcube.py:14:from tesseract_utils import
> tesseract_available, tesseract_ocr
> tests/avocado/machine_m68k_nextcube.py:58:
> @skipUnless(tesseract_available(3), 'tesseract v3 OCR tool not available')
> tests/avocado/machine_m68k_nextcube.py:70:
> @skipUnless(tesseract_available(4), 'tesseract v4 OCR tool not available')
> tests/avocado/tesseract_utils.py:14:def
> tesseract_available(expected_version):
>
> > $ grep GITLAB_CI *
> > grep: acpi-bits: Is a directory
> > acpi-bits.py:@skipIf(os.getenv('GITLAB_CI') is not None, 'Running on 
> > GitLab')
> > grep: avocado_qemu: Is a directory
> > boot_linux.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > intel_iommu.py:@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > linux_initrd.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > machine_aspeed.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > machine_aspeed.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
> > machine_mips_malta.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on 
> > GitLab')
> > machine_mips_malta.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on 
> > GitLab')
> > machine_rx_gdbsim.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on 
> > GitLab')
> > machine_rx_gdbsim.py:    @skipIf(os.getenv('GITLAB_CI'), 'Running on 
> > GitLab')
> [...]

Reply via email to