Tests: Cleanup to return instead of exit

This commit is contained in:
Wilson Snyder 2021-02-25 19:26:36 -05:00
parent 2f8fa75691
commit 57d1404f40
19 changed files with 27 additions and 20 deletions

View File

@ -1845,7 +1845,7 @@ sub _make_main {
$fh->print(" if (sc_time_stamp() == save_time && save_time) {\n");
$fh->print(" save_model(\"$self->{obj_dir}/saved.vltsv\");\n");
$fh->print(" printf(\"Exiting after save_model\\n\");\n");
$fh->print(" exit(0);\n");
$fh->print(" return 0;\n");
$fh->print(" }\n");
}
_print_advance_time($self, $fh, 1, $action);
@ -1870,7 +1870,7 @@ sub _make_main {
$fh->print("\n");
print $fh " topp.reset();\n";
print $fh " exit(0L);\n";
print $fh " return 0;\n";
print $fh "}\n";
$fh->close();
}

View File

@ -49,5 +49,5 @@ int main() {
VerilatedCov::write(VL_STRINGIFY(TEST_OBJ_DIR) "/coverage4.dat");
printf("*-* All Finished *-*\n");
exit(failure ? 10 : 0);
return (failure ? 10 : 0);
}

View File

@ -144,5 +144,5 @@ int main(int argc, char** argv, char** env) {
topp->final();
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}

View File

@ -54,6 +54,6 @@ int main(int argc, char* argv[]) {
exit(10);
} else {
printf("*-* All Finished *-*\n");
exit(0);
return 0;
}
}

View File

@ -24,5 +24,5 @@ int main(int argc, char* argv[]) {
// We aren't calling Verilated::commandArgs(argc, argv)
topp->eval();
exit(0);
return 0;
}

View File

@ -44,5 +44,5 @@ int main(int argc, char* argv[]) {
CHECK_RESULT_HEX(os.isOpen(), false);
}
exit(0);
return 0;
}

View File

@ -94,5 +94,5 @@ int main(int argc, char** argv, char** env) {
VL_DO_DANGLING(delete ap, ap);
VL_DO_DANGLING(delete bp, bp);
exit(0L);
return 0;
}

View File

@ -67,5 +67,5 @@ int sc_main(int argc, char** argv) {
VL_DO_DANGLING(delete ap, ap);
VL_DO_DANGLING(delete bp, bp);
exit(0L);
return 0;
}

View File

@ -34,5 +34,5 @@ int main(int argc, char** argv, char** env) {
topp->final();
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}

View File

@ -200,5 +200,5 @@ int main(int argc, char** argv, char** env) {
topp->final();
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}

View File

@ -308,5 +308,5 @@ int main(int argc, char** argv, char** env) {
topp->final();
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}

View File

@ -278,7 +278,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -291,7 +291,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -220,7 +220,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -288,7 +288,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -258,7 +258,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -233,5 +233,5 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}

View File

@ -67,6 +67,12 @@ bool verbose = false;
return __LINE__; \
}
#define CHECK_RESULT_Z(got) \
if ((got)) { \
printf("%%Error: %s:%d: GOT = !NULL EXP = NULL\n", FILENM, __LINE__); \
return __LINE__; \
}
// Use cout to avoid issues with %d/%lx etc
#define CHECK_RESULT(got, exp) \
if ((got) != (exp)) { \
@ -624,6 +630,7 @@ int _mon_check_vlog_info() {
CHECK_RESULT_CSTR(vlog_info.argv[1], "+PLUS");
CHECK_RESULT_CSTR(vlog_info.argv[2], "+INT=1234");
CHECK_RESULT_CSTR(vlog_info.argv[3], "+STRSTR");
CHECK_RESULT_Z(vlog_info.argv[4]);
if (TestSimulator::is_verilator()) {
CHECK_RESULT_CSTR(vlog_info.product, "Verilator");
CHECK_RESULT(strlen(vlog_info.version) > 0, 1);
@ -734,7 +741,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif

View File

@ -180,7 +180,7 @@ int main(int argc, char** argv, char** env) {
#endif
VL_DO_DANGLING(delete topp, topp);
exit(0L);
return 0;
}
#endif