[Pkg-libvirt-commits] [libguestfs] 42/87: tests: Add regression test for get-attach-method == "appliance".
Hilko Bengen
bengen at moszumanska.debian.org
Wed Feb 19 21:10:08 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository libguestfs.
commit e16da7f80850c97482c74e912f3873682cb1186e
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Mon Jan 20 12:09:29 2014 +0000
tests: Add regression test for get-attach-method == "appliance".
This updates commit ecd31806a491c735878e9e54540a5c11ca1adce9.
(cherry picked from commit ee90a36521e97fdceb9ef3169c25499cee46d0db)
---
tests/regressions/rhbz1055452.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tests/regressions/rhbz1055452.c b/tests/regressions/rhbz1055452.c
index 4a1c115..f656861 100644
--- a/tests/regressions/rhbz1055452.c
+++ b/tests/regressions/rhbz1055452.c
@@ -31,6 +31,7 @@
#include <unistd.h>
#include "guestfs.h"
+#include "guestfs-internal-frontend.h"
int
main (int argc, char *argv[])
@@ -39,6 +40,9 @@ main (int argc, char *argv[])
const char *var[] = { "LIBGUESTFS_BACKEND", "LIBGUESTFS_ATTACH_METHOD", NULL };
const char *value[] = { "appliance", "direct", NULL };
size_t i, j;
+ char *r;
+
+ /* Check that backend can be set to "appliance" or "direct". */
for (i = 0; var[i] != NULL; ++i) {
for (j = 0; value[j] != NULL; ++j) {
@@ -59,5 +63,39 @@ main (int argc, char *argv[])
}
}
+ /* Check that guestfs_get_attach_method returns "appliance" ... */
+
+ g = guestfs_create ();
+ if (!g) {
+ perror ("guestfs_create");
+ exit (EXIT_FAILURE);
+ }
+ if (guestfs_set_backend (g, "direct") == -1)
+ exit (EXIT_FAILURE);
+
+ r = guestfs_get_attach_method (g);
+ if (!r)
+ exit (EXIT_FAILURE);
+ if (STRNEQ (r, "appliance")) {
+ fprintf (stderr, "%s: expecting guestfs_get_attach_method to return 'appliance', but it returned '%s'.\n",
+ argv[0], r);
+ exit (EXIT_FAILURE);
+ }
+ free (r);
+
+ /* ... but that guestfs_get_backend returns "direct". */
+
+ r = guestfs_get_backend (g);
+ if (!r)
+ exit (EXIT_FAILURE);
+ if (STRNEQ (r, "direct")) {
+ fprintf (stderr, "%s: expecting guestfs_get_backend to return 'direct', but it returned '%s'.\n",
+ argv[0], r);
+ exit (EXIT_FAILURE);
+ }
+ free (r);
+
+ guestfs_close (g);
+
exit (EXIT_SUCCESS);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list