@@ -87,17 +87,20 @@ struct BugpointPass : public Pass {
87
87
log (" -updates\n " );
88
88
log (" try to remove process updates from syncs.\n " );
89
89
log (" \n " );
90
+ log (" -runner \" <prefix>\"\n " );
91
+ log (" child process wrapping command, e.g., \" timeout 30\" , or valgrind.\n " );
92
+ log (" \n " );
90
93
}
91
94
92
- bool run_yosys (RTLIL::Design *design, string yosys_cmd, string yosys_arg)
95
+ bool run_yosys (RTLIL::Design *design, string runner, string yosys_cmd, string yosys_arg)
93
96
{
94
97
design->sort ();
95
98
96
99
std::ofstream f (" bugpoint-case.il" );
97
100
RTLIL_BACKEND::dump_design (f, design, /* only_selected=*/ false , /* flag_m=*/ true , /* flag_n=*/ false );
98
101
f.close ();
99
102
100
- string yosys_cmdline = stringf (" %s -qq -L bugpoint-case.log %s bugpoint-case.il" , yosys_cmd.c_str (), yosys_arg.c_str ());
103
+ string yosys_cmdline = stringf (" %s %s -qq -L bugpoint-case.log %s bugpoint-case.il" , runner. c_str () , yosys_cmd.c_str (), yosys_arg.c_str ());
101
104
return run_command (yosys_cmdline) == 0 ;
102
105
}
103
106
@@ -394,7 +397,7 @@ struct BugpointPass : public Pass {
394
397
395
398
void execute (std::vector<std::string> args, RTLIL::Design *design) override
396
399
{
397
- string yosys_cmd = " yosys" , yosys_arg, grep;
400
+ string yosys_cmd = " yosys" , yosys_arg, grep, runner ;
398
401
bool fast = false , clean = false ;
399
402
bool modules = false , ports = false , cells = false , connections = false , processes = false , assigns = false , updates = false , wires = false , has_part = false ;
400
403
@@ -472,6 +475,14 @@ struct BugpointPass : public Pass {
472
475
has_part = true ;
473
476
continue ;
474
477
}
478
+ if (args[argidx] == " -runner" && argidx + 1 < args.size ()) {
479
+ runner = args[++argidx];
480
+ if (runner.size () && runner.at (0 ) == ' "' ) {
481
+ log_assert (runner.back () == ' "' );
482
+ runner = runner.substr (1 , runner.size () - 2 );
483
+ }
484
+ continue ;
485
+ }
475
486
break ;
476
487
}
477
488
extra_args (args, argidx, design);
@@ -495,7 +506,7 @@ struct BugpointPass : public Pass {
495
506
log_cmd_error (" This command only operates on fully selected designs!\n " );
496
507
497
508
RTLIL::Design *crashing_design = clean_design (design, clean);
498
- if (run_yosys (crashing_design, yosys_cmd, yosys_arg))
509
+ if (run_yosys (crashing_design, runner, yosys_cmd, yosys_arg))
499
510
log_cmd_error (" The provided script file or command and Yosys binary do not crash on this design!\n " );
500
511
if (!check_logfile (grep))
501
512
log_cmd_error (" The provided grep string is not found in the log file!\n " );
@@ -512,12 +523,12 @@ struct BugpointPass : public Pass {
512
523
if (clean)
513
524
{
514
525
RTLIL::Design *testcase = clean_design (simplified);
515
- crashes = !run_yosys (testcase, yosys_cmd, yosys_arg);
526
+ crashes = !run_yosys (testcase, runner, yosys_cmd, yosys_arg);
516
527
delete testcase;
517
528
}
518
529
else
519
530
{
520
- crashes = !run_yosys (simplified, yosys_cmd, yosys_arg);
531
+ crashes = !run_yosys (simplified, runner, yosys_cmd, yosys_arg);
521
532
}
522
533
523
534
if (crashes && check_logfile (grep))
0 commit comments