python-pycdlib/tests/simple/test-pycdlib.py
Brian C. Lane a31bbb3c5a gating: Add gating tests
This adds some simple gating tests using the installed library.

Resolves: rhbz#1972786
2021-06-17 15:30:31 -07:00

28 lines
672 B
Python

"""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)