def main(): # Register signal handlers signal.signal(signal.SIGINT, sigint_handler) # Register exception handler sys.excepthook = except_hook # Read the important options first args, unparsed = get_options() cfg_f = args.config verbose = args.verbose # Read the config file, cfg = Config(cfg_f, verbose) cfg.parse() cfg.check() # Print out the config if verbose: printv('Contents: ') printoff(str(cfg), CBEIGE2) # Overwrite the output directory if os.path.isdir(args.outdir): printw('Overwriting output directory: ' + args.outdir) shutil.rmtree(args.outdir) elif os.path.isfile(args.outdir): printw('Overwriting output directory: ' + args.outdir) os.remove(args.outdir) run_lcov(args.indir, args.outdir, cfg, verbose)
def main(): global parent global child_pid # Register signal handlers signal.signal(signal.SIGINT, sigint_handler) signal.signal(signal.SIGUSR1, sigusr1_handler) # Register exception handler sys.excepthook = except_hook # Read the important options first args, unparsed = get_options() cfg_f = args.config verbose = args.verbose # Read the config file, cfg = Config(cfg_f, verbose) cfg.parse() cfg.check() # Update arguments from config update_args_with_cfg(args, cfg) # Update rest of the args cores1 = args.cores_stage1 cores2 = args.cores_stage2 force_resp = args.force_resp dry_run = args.dry_run tgtcmd = cfg.tgtcmd if verbose: printv('Updated arguments:') printoff( "cores1 = " + str(args.cores_stage1) + '\n' + \ "cores2 = " + str(args.cores_stage2) + '\n' + \ "force_resp = " + str(args.force_resp) + '\n' + \ "dry_run = " + str(args.dry_run) + '\n' + \ "disable_st2 = " + str(args.disable_stage2) + '\n' + \ "prg_file = " + str(args.progress_file) + '\n' + \ "tgtcmd = " + str(cfg.tgtcmd) + '\n' + \ "prg_int = " + str(args.progress_interval) + '\n' ) printi('PID: ' + str(os.getpid())) # Print out the config if verbose: printv('Contents: ') printoff(str(cfg), CBEIGE2) # Check for image marker in the target command pm_img_marker = False for keywrd in tgtcmd: if common.PM_IMG_MRK in keywrd: pm_img_marker = True if not pm_img_marker: parser.error('--wrkld-cmd option needs the marker ' + common.PM_IMG_MRK + ' to mark location of the pool image. e.g., ' + '/mnt/pmem0/__POOL_IMAGE__') if force_resp != None: force_resp = force_resp[0] # Overwrite the output directory if os.path.isdir(args.outdir): printw('Overwriting output directory: ' + args.outdir) shutil.rmtree(args.outdir) elif os.path.isfile(args.outdir): printw('Overwriting output directory: ' + args.outdir) os.remove(args.outdir) os.makedirs(args.outdir) perform_checks() if args.checks_only: printi('All checks completed') exit(0) # Fork here to run pmfuzz in one thread and statistics collection in the # other thread pid = os.fork() if pid != 0: # Run pmfuzz write_child_pid(args, pid) pmfuzz.run_pmfuzz(args.indir, args.outdir, cfg, cores1=cores1, cores2=cores2, verbose=verbose, force_yes=force_resp, dry_run=dry_run, disable_stage2=args.disable_stage2) else: # Run statistics collection parent = False collect_statistics(cfg, args)