Skip to content

Commit

Permalink
Revert "test: Update testing to include small iso and larger iso"
Browse files Browse the repository at this point in the history
This reverts commit 0ccaaae.
  • Loading branch information
bcl committed Apr 29, 2024
1 parent 14e4bac commit 5229278
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,4 @@ archive:
@echo "The final archive is in isomd5sum-$(VERSION).tar.bz2"

test:
@echo "Testing with large iso"
$(PYTHON) ./testpyisomd5sum.py 200
@echo "Testing with small iso"
$(PYTHON) ./testpyisomd5sum.py
33 changes: 7 additions & 26 deletions testpyisomd5sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import os
import subprocess
import sys
import tempfile

import pyisomd5sum

# Pass in the rc, the expected value and the pass_all state
Expand All @@ -15,34 +12,18 @@ def pass_fail(rc, pass_value, pass_all):
else:
return ("FAIL", False)

try:
iso_size = int(sys.argv[1])
except (IndexError, ValueError):
iso_size = 0

# create iso file
try:
# Python 3
catch_error = FileNotFoundError
except NameError:
# Python 2
catch_error = OSError

# create iso file using a clean directory
with tempfile.TemporaryDirectory(prefix="isomd5test-") as tmpdir:
# Write temporary data to iso test dir
with open(tmpdir+"/TEST-DATA", "w") as f:
# Write more data base on cmdline arg
for x in range(0,iso_size):
f.write("A" * 1024)

try:
subprocess.check_call(["mkisofs", "-quiet", "-o", "testiso.iso", tmpdir])
except catch_error:
subprocess.check_call(["genisoimage", "-quiet", "-o", "testiso.iso", tmpdir])

if not os.path.exists("testiso.iso"):
print("Error creating iso")
sys.exit(1)
try:
subprocess.check_call(["mkisofs", "-quiet", "-o", "testiso.iso", "."])
except catch_error:
subprocess.check_call(["genisoimage", "-quiet", "-o", "testiso.iso", "."])

# implant it
(rstr, pass_all) = pass_fail(pyisomd5sum.implantisomd5sum("testiso.iso", 1, 0), 0, True)
Expand All @@ -69,11 +50,11 @@ def callback(offset, total):

def callback_abort(offset, total):
print(" %s - %s" % (offset, total))
if offset > 100000:
if offset > 500000:
return True
return False

print("Run with callback and abort after offset of 100000")
print("Run with callback and abort after offset of 500000")
(rstr, pass_all) = pass_fail(pyisomd5sum.checkisomd5sum("testiso.iso", callback_abort), 2, pass_all)
print(rstr)

Expand Down

0 comments on commit 5229278

Please sign in to comment.