392 def run(self, test: WorkflowTest) -> bool:
393 self.logger.info("---------------------------------------------------------------------------------------")
394 self.logger.info(f"Running {test.ID} AOD digest")
395
396 file_name = "myAOD.pool.root"
397 output_name = f"{test.ID}_AOD_digest.txt"
398
399 validation_file = test.validation_path / file_name
400 validation_output = test.validation_path / output_name
401 validation_log_file = test.validation_path / f"AODdigest-{test.ID}.log"
402 validation_command = f"xAODDigest.py {validation_file} {validation_output} > {validation_log_file} 2>&1"
403
404 output_val, error_val = subprocess.Popen(["/bin/bash", "-c", validation_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
405 output_val, error_val = output_val.decode("utf-8"), error_val.decode("utf-8")
406 if error_val:
407 self.logger.
error(f
"Something went wrong with the digest calculation for test {test.ID}:")
408 self.logger.
error(error_val)
409
410
411 if self.setup.validation_only:
412
413 reference_path = test.validation_path
414 reference_output_name = f"{test.ID}_AOD_digest.ref"
415 reference_output = reference_path / reference_output_name
416 subprocess.Popen(["/bin/bash", "-c", f"cd {reference_path}; get_files -remove -data {reference_output_name}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
417 if not reference_output.exists():
418 self.logger.info(f"No reference file '{reference_output_name}' to compare the digest with. Printing the full digest:")
419 with validation_output.open() as f:
420 for line in f:
421 self.logger.
print(f
" {line.strip()}")
422 return True
423 else:
424 reference_path = test.reference_path
425 reference_output = reference_path / output_name
426 reference_file = reference_path / file_name
427 reference_log_file = test.reference_path / f"AODdigest-{test.ID}.log"
428
429 reference_command = f"xAODDigest.py {reference_file} {reference_output} > {reference_log_file} 2>&1"
430 subprocess.Popen(["/bin/bash", "-c", reference_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
431
432
433 diff_output, diff_error = subprocess.Popen(["/bin/bash", "-c", f"diff {reference_output} {validation_output}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
434 diff_output, diff_error = diff_output.decode("utf-8"), diff_error.decode("utf-8")
435
436 result = False
437 if not diff_output and not diff_error:
438 self.logger.info("Passed!\n")
439 result = True
440 else:
441
442 if self.setup.disable_release_setup:
443 self.logger.
print(f
"ATLAS-CI-ADD-LABEL: {test.run.value}-{test.type.value}-output-changed")
444 self.logger.
print(
"")
445
446 self.logger.
error(f
"Your change breaks the digest in test {test.ID}.")
447 self.logger.
error(
"Please make sure this has been discussed in the correct meeting (RIG or Simulation) meeting and approved by the relevant experts.")
448 if self.setup.validation_only:
449 self.logger.
error(f
"The output '{output_name}' (>) differs from the reference '{reference_output_name}' (<):")
450 else:
451 self.logger.
error(f
"The output '{validation_output}' (>) differs from the reference '{reference_output}' (<):")
452 if diff_output:
453 with reference_output.open() as file:
454 self.logger.
print(file.readline())
455 self.logger.
print(diff_output)
456 if diff_error:
457 self.logger.
print(diff_error)
458 self.logger.info("-----------------------------------------------------\n")
459
460 return result
461
462
void print(char *figname, TCanvas *c1)
int run(int argc, char *argv[])