gating: Add gating tests

This adds some simple gating tests using the installed library.

Resolves: rhbz#1972786
This commit is contained in:
Brian C. Lane 2021-06-17 15:30:31 -07:00
parent d432c8a8cd
commit a31bbb3c5a
4 changed files with 57 additions and 0 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

12
tests/simple/run_tests.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -eux
# Make a very simple iso with a volid
xorrisofs -o file.iso -V "test-pycdlib-volid" || exit 1
python3 ./test-pycdlib.py file.iso "test-pycdlib-volid" || exit 1
# Run a couple of the example scripts
python3 /usr/share/doc/python3-pycdlib/examples/create-bootable.py || exit 1
file eltorito.iso | grep bootable || exit 1
python3 /usr/share/doc/python3-pycdlib/examples/create-new.py || exit 1
file new.iso | grep "ISO 9660 CD-ROM" || exit 1

View File

@ -0,0 +1,27 @@
"""Simple test for pycdlib
Extract the volid from the iso and compare it to the one passed on the cmdline
"""
import os
import sys
import pycdlib
from pycdlib.pycdlibexception import PyCdlibException
if len(sys.argv) != 3:
print("usage: %s file.iso volid" % (sys.argv[0]))
sys.exit(1)
try:
iso = pycdlib.PyCdlib()
iso.open(sys.argv[1])
volid = iso.pvd.volume_identifier.decode("UTF-8").strip()
except PyCdlibException as e:
print("ERROR: Problem reading label from %s: %s" % (self.iso_path, e))
sys.exit(1)
print("VOLID: %s" % volid)
if volid != sys.argv[2]:
print("ERROR: %s != %s" % (volid, sys.argv[2]))
sys.exit(1)
sys.exit(0)

12
tests/tests.yml Normal file
View File

@ -0,0 +1,12 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
required_packages:
- python-pycdlib
- xorriso
tests:
- simple:
run: ./run_tests.sh