Skip to content

Commit

Permalink
tests: test-hmp: print command execution result
Browse files Browse the repository at this point in the history
Provide HMP monitor command execution result as it would be seen
by user who established an HMP monitor session.

Currently many commands may silently fail without any sign of that.
This patch let this info to be printed once test is running in
verbose mode.

For the future it might be useful to fail the test if command has
failed, however it would require a bit of rework inside test
engine itself.

A simple example of silent failure without reporting it would to
add some non-existent HMP command into 'hmp_cmds' list. In this case
test will report it successfully passed without error.

Signed-off-by: Vadim Galitsyn <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: [email protected]
Message-Id: <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
vgalitsyn authored and dagrh committed Dec 14, 2017
1 parent 81950da commit 0eaf3b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test-hmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ static void test_commands(void)
int i;

for (i = 0; hmp_cmds[i] != NULL; i++) {
response = hmp("%s", hmp_cmds[i]);
if (verbose) {
fprintf(stderr, "\t%s\n", hmp_cmds[i]);
fprintf(stderr,
"\texecute HMP command: %s\n"
"\tresult : %s\n",
hmp_cmds[i], response);
}
response = hmp("%s", hmp_cmds[i]);
g_free(response);
}

Expand Down

0 comments on commit 0eaf3b8

Please sign in to comment.