From 52292782e2d45b2e832e93b2896411ef1a84e172 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 29 Apr 2024 13:37:31 -0700 Subject: [PATCH] Revert "test: Update testing to include small iso and larger iso" This reverts commit 0ccaaae619b3ac828e2c4a9ed28d64430fb39b74. --- Makefile | 3 --- testpyisomd5sum.py | 33 +++++++-------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 99e7107..02f9fb3 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/testpyisomd5sum.py b/testpyisomd5sum.py index 9f4fb30..9324ead 100755 --- a/testpyisomd5sum.py +++ b/testpyisomd5sum.py @@ -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 @@ -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) @@ -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)