risu: Add test summary
PATCH 1/1 risu: Add test summary
Currently, a successful test run finishes silently with exit code 0. The last message on the console is "starting image" which can leave the user wondering if they executed the commands correctly.
Now add a summary of the number of executed instructions in case of success. Don't add that message when printing the trace to stdout (-t -).
Tested:
a) master/apprentice mode
b) trace mode to file
c) trace mode to stdout
--- risu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
risu.c +10 -2
@@ -551,6 +551,7 @@ int main(int argc, char **argv)struct option *longopts;char *shortopts;stack_t ss; +int ret; longopts =setup_options (&shortopts);
@@ -635,8 +636,15 @@ int main(int argc, char **argv)arch_init ();if (ismaster) { -return master (); + ret =master (); }else { -return apprentice (); + ret =apprentice (); } + +if (ret ==EXIT_SUCCESS && (!trace || (trace &&strcmp (trace_fn,"-" ) !=0 ))) { +fprintf (stderr,"No mismatches found. Executed %zd checkpoints.\n" , + signal_count); + } + +return ret; }
Signature · 1 line
2.41.0
Quoted 3 lines · Sebastian Mitterle
Currently, a successful test run finishes silently with exit code 0. The last message on the console is "starting image" which can leave the user wondering if they executed the commands correctly.
Thanks for the patch, I think this is a good idea - it also initially puzzled me a couple of times due to the missing feedback.
Quoted 29 lines
Now add a summary of the number of executed instructions in case of success. Don't add that message when printing the trace to stdout (
-t -).Tested:
a) master/apprentice mode
b) trace mode to file
c) trace mode to stdoutSuggested-by Thomas Huth <[email protected]>Signed-off-by Sebastian Mitterle <[email protected]>--- risu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)risu.c +1
-0@@ -551,6 +551,7 @@ int main(int argc, char **argv)struct option *longopts;char *shortopts;stack_t ss; +int ret; longopts =setup_options (&shortopts);@@ -635,8 +636,15 @@ int main(int argc, char **argv)arch_init ();
risu.c int main(int argc, char **argv) · line 644
Quoted 10 lines
risu.c +4
-2if (ismaster) { -return master (); + ret =master (); }else { -return apprentice (); + ret =apprentice (); } + +if (ret ==EXIT_SUCCESS && (!trace || (trace &&strcmp (trace_fn,"-" ) !=0 ))) {
There's a superfluous white space here ------------^
Apart from that, I wonder whether the check for trace-to-stdout is really necessary, since you print the message to stderr below instead?
risu.c int main(int argc, char **argv) · line 650
Quoted 6 lines
risu.c +5
-0+fprintf (stderr,"No mismatches found. Executed %zd checkpoints.\n" , + signal_count); + } + +return ret; }
Thomas
Quoted 51 lines · Thomas Huth
Quoted 3 lines · Sebastian Mitterle
Currently, a successful test run finishes silently with exit code 0. The last message on the console is "starting image" which can leave the user wondering if they executed the commands correctly.
Thanks for the patch, I think this is a good idea - it also initially puzzled me a couple of times due to the missing feedback.
Quoted 29 lines
Now add a summary of the number of executed instructions in case of success. Don't add that message when printing the trace to stdout (
-t -).Tested:
a) master/apprentice mode
b) trace mode to file
c) trace mode to stdoutSuggested-by Thomas Huth <[email protected]>Signed-off-by Sebastian Mitterle <[email protected]>--- risu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)risu.c +1
-0@@ -551,6 +551,7 @@ int main(int argc, char **argv)struct option *longopts;char *shortopts;stack_t ss; +int ret; longopts =setup_options (&shortopts);@@ -635,8 +636,15 @@ int main(int argc, char **argv)arch_init ();risu.c int main(int argc, char **argv) · line 644
Quoted 10 lines
risu.c +4
-2if (ismaster) { -return master (); + ret =master (); }else { -return apprentice (); + ret =apprentice (); } + +if (ret ==EXIT_SUCCESS && (!trace || (trace &&strcmp (trace_fn,"-" ) !=0 ))) {There's a superfluous white space here ------------^
Quoted 2 lines
Apart from that, I wonder whether the check for trace-to-stdout is really necessary, since you print the message to stderr below instead?
Yes, we print other kinds of progress chatter to stderr and we don't need to check for trace-to-stdout in those other places.
thanks
-- PMM