On Mon, Aug 16, 2021 at 07:13:37PM +0800, Luke Yue wrote:
Signed-off-by: Luke Yue <lukedyue(a)gmail.com>
---
tests/virshtest.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/virshtest.c b/tests/virshtest.c
index 53db2aa19a..0c46496c74 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -291,6 +291,13 @@ static int testCompareDomControlInfoByName(const void *data
G_GNUC_UNUSED)
return testCompareOutputLit(exp, NULL, argv);
}
+static int testCompareDomJobInfoByName(const void *data G_GNUC_UNUSED)
+{
+ const char *const argv[] = { VIRSH_CUSTOM, "domjobinfo", "fc4",
NULL };
You should be able to do something like:
argv[] = { VIRSH_CUSTOM, "domjobinfo fc4; domjobabort fc4; domjobinfo fc4",
NULL };
to test the behaviour of aborting and similarly for --completed and
--keep-completed.
Maybe you can also pick one VM name that gets initialised with a dummy
job. You can base it on a name or uuid or some other random data for
now.
+ const char *exp = "Job type: None
\n\n";
+ return testCompareOutputLit(exp, NULL, argv);
+}
+
struct testInfo {
const char *const *argv;
const char *result;
@@ -383,6 +390,10 @@ mymain(void)
testCompareDomControlInfoByName, NULL) != 0)
ret = -1;
+ if (virTestRun("virsh domjobinfo (by name)",
+ testCompareDomJobInfoByName, NULL) != 0)
+ ret = -1;
+
/* It's a bit awkward listing result before argument, but that's a
* limitation of C99 vararg macros. */
# define DO_TEST(i, result, ...) \
--
2.32.0