Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkclean: report the source file + option on regression failure #191

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mkclean/regression/mkcleanreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def testFile(cli, line_num, src_file, mkclean_options, filesize, hash):
if not os.path.isfile(src_file):
print(f"Fail:2:{line_num}: {src_file} doesn't exist", file=sys.stderr)
print(f"Fail:2:{line_num}: {src_file} doesn't exist for {mkclean_options}", file=sys.stderr)
return
mkclean_exe = cli.mkclean
if not mkclean_exe:
Expand Down Expand Up @@ -47,12 +47,12 @@ def testFile(cli, line_num, src_file, mkclean_options, filesize, hash):
return

if not os.path.isfile(outputfile):
print(f"Fail:4:{line_num}: failed to stat file {outputfile}", file=sys.stderr)
print(f"Fail:4:{line_num}: failed to stat file {outputfile} in {src_file} for {mkclean_options}", file=sys.stderr)
return

outsize = os.path.getsize(outputfile)
if not cli.generate and not outsize == filesize:
print(f"Fail:5:{line_num}: wanted {filesize} got {outsize} size in {src_file}", file=sys.stderr)
print(f"Fail:5:{line_num}: wanted {filesize} got {outsize} size in {src_file} for {mkclean_options}", file=sys.stderr)
return

if not cli.generate:
Expand All @@ -74,14 +74,14 @@ def testFile(cli, line_num, src_file, mkclean_options, filesize, hash):
result = subprocess.run(mkvalidator_run)

if not result.returncode == 0:
print(f"Fail:6:{line_num}: mkvalidator returned {result} for {outputfile}", file=sys.stderr)
print(f"Fail:6:{line_num}: mkvalidator returned {result} for {outputfile} in {src_file} for {mkclean_options}", file=sys.stderr)
return

filemd5 = hashlib.md5(open(outputfile,'rb').read()).hexdigest()
if cli.generate:
print(f"\"{src_file}\" \"{mkclean_options}\" {outsize} {filemd5}", file=sys.stderr)
elif not filemd5 == hash:
print(f"Fail:8:{line_num}: bad MD5 {filemd5} for {outputfile}", file=sys.stderr)
print(f"Fail:8:{line_num}: bad MD5 {filemd5} for {outputfile} in {src_file} for {mkclean_options}", file=sys.stderr)
return

if not cli.keep:
Expand Down
Loading