Generated files for file(1) command.

This commit is contained in:
Richard Jones
2009-04-13 23:58:33 +01:00
parent 4228340388
commit adefe14e30
18 changed files with 532 additions and 48 deletions

View File

@@ -69,3 +69,4 @@ extern int do_umount (const char *pathordevice);
extern char **do_mounts (void);
extern int do_umount_all (void);
extern int do_lvm_remove_all (void);
extern char *do_file (const char *path);

View File

@@ -1137,6 +1137,33 @@ static void lvm_remove_all_stub (XDR *xdr_in)
done: ;
}
static void file_stub (XDR *xdr_in)
{
char *r;
struct guestfs_file_args args;
const char *path;
memset (&args, 0, sizeof args);
if (!xdr_guestfs_file_args (xdr_in, &args)) {
reply_with_error ("%s: daemon failed to decode procedure arguments", "file");
return;
}
path = args.path;
r = do_file (path);
if (r == NULL)
/* do_file has already called reply_with_error */
goto done;
struct guestfs_file_ret ret;
ret.description = r;
reply ((xdrproc_t) &xdr_guestfs_file_ret, (char *) &ret);
free (r);
done:
xdr_free ((xdrproc_t) xdr_guestfs_file_args, (char *) &args);
}
void dispatch_incoming_message (XDR *xdr_in)
{
switch (proc_nr) {
@@ -1284,6 +1311,9 @@ void dispatch_incoming_message (XDR *xdr_in)
case GUESTFS_PROC_LVM_REMOVE_ALL:
lvm_remove_all_stub (xdr_in);
break;
case GUESTFS_PROC_FILE:
file_stub (xdr_in);
break;
default:
reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
}

View File

@@ -51,6 +51,7 @@ void list_commands (void)
printf ("%-20s %s\n", "chown", "change file owner and group");
printf ("%-20s %s\n", "config", "add qemu parameters");
printf ("%-20s %s\n", "exists", "test if file or directory exists");
printf ("%-20s %s\n", "file", "determine file type");
printf ("%-20s %s\n", "get-autosync", "get autosync mode");
printf ("%-20s %s\n", "get-path", "get the search path");
printf ("%-20s %s\n", "get-verbose", "get verbose mode");
@@ -271,6 +272,9 @@ void display_command (const char *cmd)
else
if (strcasecmp (cmd, "lvm_remove_all") == 0 || strcasecmp (cmd, "lvm-remove-all") == 0)
pod2text ("lvm-remove-all - remove all LVM LVs, VGs and PVs", " lvm-remove-all\n\nThis command removes all LVM logical volumes, volume groups\nand physical volumes.\n\nB<This command is dangerous. Without careful use you\ncan easily destroy all your data>.");
else
if (strcasecmp (cmd, "file") == 0)
pod2text ("file - determine file type", " file <path>\n\nThis call uses the standard L<file(1)> command to determine\nthe type or contents of the file. This also works on devices,\nfor example to find out whether a partition contains a filesystem.\n\nThe exact command which runs is C<file -bsL path>. Note in\nparticular that the filename is not prepended to the output\n(the C<-b> option).");
else
display_builtin_command (cmd);
}
@@ -1277,6 +1281,23 @@ static int run_lvm_remove_all (const char *cmd, int argc, char *argv[])
return r;
}
static int run_file (const char *cmd, int argc, char *argv[])
{
char *r;
const char *path;
if (argc != 1) {
fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
return -1;
}
path = argv[0];
r = guestfs_file (g, path);
if (r == NULL) return -1;
printf ("%s\n", r);
free (r);
return 0;
}
int run_action (const char *cmd, int argc, char *argv[])
{
if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0)
@@ -1455,6 +1476,9 @@ int run_action (const char *cmd, int argc, char *argv[])
else
if (strcasecmp (cmd, "lvm_remove_all") == 0 || strcasecmp (cmd, "lvm-remove-all") == 0)
return run_lvm_remove_all (cmd, argc, argv);
else
if (strcasecmp (cmd, "file") == 0)
return run_file (cmd, argc, argv);
else
{
fprintf (stderr, "%s: unknown command\n", cmd);

View File

@@ -236,6 +236,18 @@ This returns C<true> if and only if there is a file, directory
See also C<is_file>, C<is_dir>, C<stat>.
=head2 file
file path
This call uses the standard L<file(1)> command to determine
the type or contents of the file. This also works on devices,
for example to find out whether a partition contains a filesystem.
The exact command which runs is C<file -bsL path>. Note in
particular that the filename is not prepended to the output
(the C<-b> option).
=head2 get-autosync
get-autosync

View File

@@ -312,6 +312,22 @@ See also C<guestfs_is_file>, C<guestfs_is_dir>, C<guestfs_stat>.
This function returns a C truth value on success or -1 on error.
=head2 guestfs_file
char *guestfs_file (guestfs_h *handle,
const char *path);
This call uses the standard L<file(1)> command to determine
the type or contents of the file. This also works on devices,
for example to find out whether a partition contains a filesystem.
The exact command which runs is C<file -bsL path>. Note in
particular that the filename is not prepended to the output
(the C<-b> option).
This function returns a string or NULL on error.
I<The caller must free the returned string after use>.
=head2 guestfs_get_autosync
int guestfs_get_autosync (guestfs_h *handle);

View File

@@ -145,3 +145,4 @@ external umount : t -> string -> unit = "ocaml_guestfs_umount"
external mounts : t -> string array = "ocaml_guestfs_mounts"
external umount_all : t -> unit = "ocaml_guestfs_umount_all"
external lvm_remove_all : t -> unit = "ocaml_guestfs_lvm_remove_all"
external file : t -> string -> string = "ocaml_guestfs_file"

View File

@@ -274,3 +274,6 @@ val umount_all : t -> unit
val lvm_remove_all : t -> unit
(** remove all LVM LVs, VGs and PVs *)
val file : t -> string -> string
(** determine file type *)

View File

@@ -1665,3 +1665,27 @@ ocaml_guestfs_lvm_remove_all (value gv)
CAMLreturn (rv);
}
CAMLprim value
ocaml_guestfs_file (value gv, value pathv)
{
CAMLparam2 (gv, pathv);
CAMLlocal1 (rv);
guestfs_h *g = Guestfs_val (gv);
if (g == NULL)
caml_failwith ("file: used handle after closing it");
const char *path = String_val (pathv);
char *r;
caml_enter_blocking_section ();
r = guestfs_file (g, path);
caml_leave_blocking_section ();
if (r == NULL)
ocaml_guestfs_raise_error (g, "file");
rv = caml_copy_string (r);
free (r);
CAMLreturn (rv);
}

View File

@@ -914,3 +914,19 @@ lvm_remove_all (g)
croak ("lvm_remove_all: %s", guestfs_last_error (g));
}
SV *
file (g, path)
guestfs_h *g;
char *path;
PREINIT:
char *description;
CODE:
description = guestfs_file (g, path);
if (description == NULL) {
croak ("file: %s", guestfs_last_error (g));
}
RETVAL = newSVpv (description, 0);
free (description);
OUTPUT:
RETVAL

View File

@@ -289,6 +289,16 @@ This returns C<true> if and only if there is a file, directory
See also C<$h-E<gt>is_file>, C<$h-E<gt>is_dir>, C<$h-E<gt>stat>.
=item $description = $h->file ($path);
This call uses the standard L<file(1)> command to determine
the type or contents of the file. This also works on devices,
for example to find out whether a partition contains a filesystem.
The exact command which runs is C<file -bsL path>. Note in
particular that the filename is not prepended to the output
(the C<-b> option).
=item $autosync = $h->get_autosync ();
Get the autosync flag.

View File

@@ -1806,6 +1806,31 @@ py_guestfs_lvm_remove_all (PyObject *self, PyObject *args)
return py_r;
}
static PyObject *
py_guestfs_file (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
char *r;
const char *path;
if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_file",
&py_g, &path))
return NULL;
g = get_handle (py_g);
r = guestfs_file (g, path);
if (r == NULL) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyString_FromString (r);
free (r);
return py_r;
}
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -1869,6 +1894,7 @@ static PyMethodDef methods[] = {
{ (char *) "mounts", py_guestfs_mounts, METH_VARARGS, NULL },
{ (char *) "umount_all", py_guestfs_umount_all, METH_VARARGS, NULL },
{ (char *) "lvm_remove_all", py_guestfs_lvm_remove_all, METH_VARARGS, NULL },
{ (char *) "file", py_guestfs_file, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@@ -207,3 +207,6 @@ class GuestFS:
def lvm_remove_all (self):
return libguestfsmod.lvm_remove_all (self._o)
def file (self, path):
return libguestfsmod.file (self._o, path)

View File

@@ -3471,3 +3471,77 @@ int guestfs_lvm_remove_all (guestfs_h *g)
return 0;
}
struct file_rv {
int cb_done; /* flag to indicate callback was called */
struct guestfs_message_header hdr;
struct guestfs_message_error err;
struct guestfs_file_ret ret;
};
static void file_cb (guestfs_h *g, void *data, XDR *xdr)
{
struct file_rv *rv = (struct file_rv *) data;
if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
error (g, "guestfs_file: failed to parse reply header");
return;
}
if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
if (!xdr_guestfs_message_error (xdr, &rv->err)) {
error (g, "guestfs_file: failed to parse reply error");
return;
}
goto done;
}
if (!xdr_guestfs_file_ret (xdr, &rv->ret)) {
error (g, "guestfs_file: failed to parse reply");
return;
}
done:
rv->cb_done = 1;
main_loop.main_loop_quit (g);
}
char *guestfs_file (guestfs_h *g,
const char *path)
{
struct guestfs_file_args args;
struct file_rv rv;
int serial;
if (g->state != READY) {
error (g, "guestfs_file called from the wrong state, %d != READY",
g->state);
return NULL;
}
memset (&rv, 0, sizeof rv);
args.path = (char *) path;
serial = dispatch (g, GUESTFS_PROC_FILE,
(xdrproc_t) xdr_guestfs_file_args, (char *) &args);
if (serial == -1)
return NULL;
rv.cb_done = 0;
g->reply_cb_internal = file_cb;
g->reply_cb_internal_data = &rv;
main_loop.main_loop_run (g);
g->reply_cb_internal = NULL;
g->reply_cb_internal_data = NULL;
if (!rv.cb_done) {
error (g, "guestfs_file failed, see earlier error messages");
return NULL;
}
if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_FILE, serial) == -1)
return NULL;
if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
error (g, "%s", rv.err.error);
return NULL;
}
return rv.ret.description; /* caller will free */
}

View File

@@ -79,3 +79,4 @@ extern int guestfs_umount (guestfs_h *handle, const char *pathordevice);
extern char **guestfs_mounts (guestfs_h *handle);
extern int guestfs_umount_all (guestfs_h *handle);
extern int guestfs_lvm_remove_all (guestfs_h *handle);
extern char *guestfs_file (guestfs_h *handle, const char *path);

View File

@@ -826,6 +826,26 @@ xdr_guestfs_mounts_ret (XDR *xdrs, guestfs_mounts_ret *objp)
return TRUE;
}
bool_t
xdr_guestfs_file_args (XDR *xdrs, guestfs_file_args *objp)
{
register int32_t *buf;
if (!xdr_string (xdrs, &objp->path, ~0))
return FALSE;
return TRUE;
}
bool_t
xdr_guestfs_file_ret (XDR *xdrs, guestfs_file_ret *objp)
{
register int32_t *buf;
if (!xdr_string (xdrs, &objp->description, ~0))
return FALSE;
return TRUE;
}
bool_t
xdr_guestfs_procedure (XDR *xdrs, guestfs_procedure *objp)
{

View File

@@ -426,6 +426,16 @@ struct guestfs_mounts_ret {
};
typedef struct guestfs_mounts_ret guestfs_mounts_ret;
struct guestfs_file_args {
char *path;
};
typedef struct guestfs_file_args guestfs_file_args;
struct guestfs_file_ret {
char *description;
};
typedef struct guestfs_file_ret guestfs_file_ret;
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -475,7 +485,8 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNTS = 46,
GUESTFS_PROC_UMOUNT_ALL = 47,
GUESTFS_PROC_LVM_REMOVE_ALL = 48,
GUESTFS_PROC_dummy = 48 + 1,
GUESTFS_PROC_FILE = 49,
GUESTFS_PROC_dummy = 49 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -575,6 +586,8 @@ extern bool_t xdr_guestfs_sfdisk_args (XDR *, guestfs_sfdisk_args*);
extern bool_t xdr_guestfs_write_file_args (XDR *, guestfs_write_file_args*);
extern bool_t xdr_guestfs_umount_args (XDR *, guestfs_umount_args*);
extern bool_t xdr_guestfs_mounts_ret (XDR *, guestfs_mounts_ret*);
extern bool_t xdr_guestfs_file_args (XDR *, guestfs_file_args*);
extern bool_t xdr_guestfs_file_ret (XDR *, guestfs_file_ret*);
extern bool_t xdr_guestfs_procedure (XDR *, guestfs_procedure*);
extern bool_t xdr_guestfs_message_direction (XDR *, guestfs_message_direction*);
extern bool_t xdr_guestfs_message_status (XDR *, guestfs_message_status*);
@@ -644,6 +657,8 @@ extern bool_t xdr_guestfs_sfdisk_args ();
extern bool_t xdr_guestfs_write_file_args ();
extern bool_t xdr_guestfs_umount_args ();
extern bool_t xdr_guestfs_mounts_ret ();
extern bool_t xdr_guestfs_file_args ();
extern bool_t xdr_guestfs_file_ret ();
extern bool_t xdr_guestfs_procedure ();
extern bool_t xdr_guestfs_message_direction ();
extern bool_t xdr_guestfs_message_status ();

View File

@@ -328,6 +328,14 @@ struct guestfs_mounts_ret {
str devices<>;
};
struct guestfs_file_args {
string path<>;
};
struct guestfs_file_ret {
string description<>;
};
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -377,6 +385,7 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNTS = 46,
GUESTFS_PROC_UMOUNT_ALL = 47,
GUESTFS_PROC_LVM_REMOVE_ALL = 48,
GUESTFS_PROC_FILE = 49,
GUESTFS_PROC_dummy
};

293
tests.c
View File

@@ -3603,6 +3603,190 @@ static int test_umount_all_0 (void)
return 0;
}
static int test_file_0 (void)
{
/* InitBasicFS for file (0): create ext2 on /dev/sda1 */
{
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_lvm_remove_all (g);
if (r == -1)
return -1;
}
{
char *lines[] = {
",",
NULL
};
int r;
suppress_error = 0;
r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mkfs (g, "ext2", "/dev/sda1");
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mount (g, "/dev/sda1", "/");
if (r == -1)
return -1;
}
/* TestOutput for file (0) */
{
int r;
suppress_error = 0;
r = guestfs_touch (g, "/new");
if (r == -1)
return -1;
}
{
char *r;
suppress_error = 0;
r = guestfs_file (g, "/new");
if (r == NULL)
return -1;
if (strcmp (r, "empty") != 0) {
fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
return -1;
}
free (r);
}
return 0;
}
static int test_file_1 (void)
{
/* InitBasicFS for file (1): create ext2 on /dev/sda1 */
{
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_lvm_remove_all (g);
if (r == -1)
return -1;
}
{
char *lines[] = {
",",
NULL
};
int r;
suppress_error = 0;
r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mkfs (g, "ext2", "/dev/sda1");
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mount (g, "/dev/sda1", "/");
if (r == -1)
return -1;
}
/* TestOutput for file (1) */
{
int r;
suppress_error = 0;
r = guestfs_write_file (g, "/new", "some content\n", 0);
if (r == -1)
return -1;
}
{
char *r;
suppress_error = 0;
r = guestfs_file (g, "/new");
if (r == NULL)
return -1;
if (strcmp (r, "ASCII text") != 0) {
fprintf (stderr, "test_file_1: expected \"ASCII text\" but got \"%s\"\n", r);
return -1;
}
free (r);
}
return 0;
}
static int test_file_2 (void)
{
/* InitBasicFS for file (2): create ext2 on /dev/sda1 */
{
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_lvm_remove_all (g);
if (r == -1)
return -1;
}
{
char *lines[] = {
",",
NULL
};
int r;
suppress_error = 0;
r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mkfs (g, "ext2", "/dev/sda1");
if (r == -1)
return -1;
}
{
int r;
suppress_error = 0;
r = guestfs_mount (g, "/dev/sda1", "/");
if (r == -1)
return -1;
}
/* TestLastFail for file (2) */
{
char *r;
suppress_error = 1;
r = guestfs_file (g, "/nofile");
if (r != NULL)
return -1;
free (r);
}
return 0;
}
int main (int argc, char *argv[])
{
char c = 0;
@@ -3716,236 +3900,251 @@ int main (int argc, char *argv[])
exit (1);
}
printf (" 1/ 46 test_mount_0\n");
printf (" 1/ 49 test_mount_0\n");
if (test_mount_0 () == -1) {
printf ("test_mount_0 FAILED\n");
failed++;
}
printf (" 2/ 46 test_sync_0\n");
printf (" 2/ 49 test_sync_0\n");
if (test_sync_0 () == -1) {
printf ("test_sync_0 FAILED\n");
failed++;
}
printf (" 3/ 46 test_touch_0\n");
printf (" 3/ 49 test_touch_0\n");
if (test_touch_0 () == -1) {
printf ("test_touch_0 FAILED\n");
failed++;
}
printf (" 4/ 46 test_cat_0\n");
printf (" 4/ 49 test_cat_0\n");
if (test_cat_0 () == -1) {
printf ("test_cat_0 FAILED\n");
failed++;
}
printf (" 5/ 46 test_ls_0\n");
printf (" 5/ 49 test_ls_0\n");
if (test_ls_0 () == -1) {
printf ("test_ls_0 FAILED\n");
failed++;
}
printf (" 6/ 46 test_list_devices_0\n");
printf (" 6/ 49 test_list_devices_0\n");
if (test_list_devices_0 () == -1) {
printf ("test_list_devices_0 FAILED\n");
failed++;
}
printf (" 7/ 46 test_list_partitions_0\n");
printf (" 7/ 49 test_list_partitions_0\n");
if (test_list_partitions_0 () == -1) {
printf ("test_list_partitions_0 FAILED\n");
failed++;
}
printf (" 8/ 46 test_list_partitions_1\n");
printf (" 8/ 49 test_list_partitions_1\n");
if (test_list_partitions_1 () == -1) {
printf ("test_list_partitions_1 FAILED\n");
failed++;
}
printf (" 9/ 46 test_pvs_0\n");
printf (" 9/ 49 test_pvs_0\n");
if (test_pvs_0 () == -1) {
printf ("test_pvs_0 FAILED\n");
failed++;
}
printf (" 10/ 46 test_pvs_1\n");
printf (" 10/ 49 test_pvs_1\n");
if (test_pvs_1 () == -1) {
printf ("test_pvs_1 FAILED\n");
failed++;
}
printf (" 11/ 46 test_vgs_0\n");
printf (" 11/ 49 test_vgs_0\n");
if (test_vgs_0 () == -1) {
printf ("test_vgs_0 FAILED\n");
failed++;
}
printf (" 12/ 46 test_vgs_1\n");
printf (" 12/ 49 test_vgs_1\n");
if (test_vgs_1 () == -1) {
printf ("test_vgs_1 FAILED\n");
failed++;
}
printf (" 13/ 46 test_lvs_0\n");
printf (" 13/ 49 test_lvs_0\n");
if (test_lvs_0 () == -1) {
printf ("test_lvs_0 FAILED\n");
failed++;
}
printf (" 14/ 46 test_lvs_1\n");
printf (" 14/ 49 test_lvs_1\n");
if (test_lvs_1 () == -1) {
printf ("test_lvs_1 FAILED\n");
failed++;
}
printf (" 15/ 46 test_pvs_full_0\n");
printf (" 15/ 49 test_pvs_full_0\n");
if (test_pvs_full_0 () == -1) {
printf ("test_pvs_full_0 FAILED\n");
failed++;
}
printf (" 16/ 46 test_vgs_full_0\n");
printf (" 16/ 49 test_vgs_full_0\n");
if (test_vgs_full_0 () == -1) {
printf ("test_vgs_full_0 FAILED\n");
failed++;
}
printf (" 17/ 46 test_lvs_full_0\n");
printf (" 17/ 49 test_lvs_full_0\n");
if (test_lvs_full_0 () == -1) {
printf ("test_lvs_full_0 FAILED\n");
failed++;
}
printf (" 18/ 46 test_read_lines_0\n");
printf (" 18/ 49 test_read_lines_0\n");
if (test_read_lines_0 () == -1) {
printf ("test_read_lines_0 FAILED\n");
failed++;
}
printf (" 19/ 46 test_read_lines_1\n");
printf (" 19/ 49 test_read_lines_1\n");
if (test_read_lines_1 () == -1) {
printf ("test_read_lines_1 FAILED\n");
failed++;
}
printf (" 20/ 46 test_rm_0\n");
printf (" 20/ 49 test_rm_0\n");
if (test_rm_0 () == -1) {
printf ("test_rm_0 FAILED\n");
failed++;
}
printf (" 21/ 46 test_rm_1\n");
printf (" 21/ 49 test_rm_1\n");
if (test_rm_1 () == -1) {
printf ("test_rm_1 FAILED\n");
failed++;
}
printf (" 22/ 46 test_rm_2\n");
printf (" 22/ 49 test_rm_2\n");
if (test_rm_2 () == -1) {
printf ("test_rm_2 FAILED\n");
failed++;
}
printf (" 23/ 46 test_rmdir_0\n");
printf (" 23/ 49 test_rmdir_0\n");
if (test_rmdir_0 () == -1) {
printf ("test_rmdir_0 FAILED\n");
failed++;
}
printf (" 24/ 46 test_rmdir_1\n");
printf (" 24/ 49 test_rmdir_1\n");
if (test_rmdir_1 () == -1) {
printf ("test_rmdir_1 FAILED\n");
failed++;
}
printf (" 25/ 46 test_rmdir_2\n");
printf (" 25/ 49 test_rmdir_2\n");
if (test_rmdir_2 () == -1) {
printf ("test_rmdir_2 FAILED\n");
failed++;
}
printf (" 26/ 46 test_rm_rf_0\n");
printf (" 26/ 49 test_rm_rf_0\n");
if (test_rm_rf_0 () == -1) {
printf ("test_rm_rf_0 FAILED\n");
failed++;
}
printf (" 27/ 46 test_mkdir_0\n");
printf (" 27/ 49 test_mkdir_0\n");
if (test_mkdir_0 () == -1) {
printf ("test_mkdir_0 FAILED\n");
failed++;
}
printf (" 28/ 46 test_mkdir_1\n");
printf (" 28/ 49 test_mkdir_1\n");
if (test_mkdir_1 () == -1) {
printf ("test_mkdir_1 FAILED\n");
failed++;
}
printf (" 29/ 46 test_mkdir_p_0\n");
printf (" 29/ 49 test_mkdir_p_0\n");
if (test_mkdir_p_0 () == -1) {
printf ("test_mkdir_p_0 FAILED\n");
failed++;
}
printf (" 30/ 46 test_mkdir_p_1\n");
printf (" 30/ 49 test_mkdir_p_1\n");
if (test_mkdir_p_1 () == -1) {
printf ("test_mkdir_p_1 FAILED\n");
failed++;
}
printf (" 31/ 46 test_mkdir_p_2\n");
printf (" 31/ 49 test_mkdir_p_2\n");
if (test_mkdir_p_2 () == -1) {
printf ("test_mkdir_p_2 FAILED\n");
failed++;
}
printf (" 32/ 46 test_exists_0\n");
printf (" 32/ 49 test_exists_0\n");
if (test_exists_0 () == -1) {
printf ("test_exists_0 FAILED\n");
failed++;
}
printf (" 33/ 46 test_exists_1\n");
printf (" 33/ 49 test_exists_1\n");
if (test_exists_1 () == -1) {
printf ("test_exists_1 FAILED\n");
failed++;
}
printf (" 34/ 46 test_is_file_0\n");
printf (" 34/ 49 test_is_file_0\n");
if (test_is_file_0 () == -1) {
printf ("test_is_file_0 FAILED\n");
failed++;
}
printf (" 35/ 46 test_is_file_1\n");
printf (" 35/ 49 test_is_file_1\n");
if (test_is_file_1 () == -1) {
printf ("test_is_file_1 FAILED\n");
failed++;
}
printf (" 36/ 46 test_is_dir_0\n");
printf (" 36/ 49 test_is_dir_0\n");
if (test_is_dir_0 () == -1) {
printf ("test_is_dir_0 FAILED\n");
failed++;
}
printf (" 37/ 46 test_is_dir_1\n");
printf (" 37/ 49 test_is_dir_1\n");
if (test_is_dir_1 () == -1) {
printf ("test_is_dir_1 FAILED\n");
failed++;
}
printf (" 38/ 46 test_pvcreate_0\n");
printf (" 38/ 49 test_pvcreate_0\n");
if (test_pvcreate_0 () == -1) {
printf ("test_pvcreate_0 FAILED\n");
failed++;
}
printf (" 39/ 46 test_vgcreate_0\n");
printf (" 39/ 49 test_vgcreate_0\n");
if (test_vgcreate_0 () == -1) {
printf ("test_vgcreate_0 FAILED\n");
failed++;
}
printf (" 40/ 46 test_lvcreate_0\n");
printf (" 40/ 49 test_lvcreate_0\n");
if (test_lvcreate_0 () == -1) {
printf ("test_lvcreate_0 FAILED\n");
failed++;
}
printf (" 41/ 46 test_mkfs_0\n");
printf (" 41/ 49 test_mkfs_0\n");
if (test_mkfs_0 () == -1) {
printf ("test_mkfs_0 FAILED\n");
failed++;
}
printf (" 42/ 46 test_write_file_0\n");
printf (" 42/ 49 test_write_file_0\n");
if (test_write_file_0 () == -1) {
printf ("test_write_file_0 FAILED\n");
failed++;
}
printf (" 43/ 46 test_umount_0\n");
printf (" 43/ 49 test_umount_0\n");
if (test_umount_0 () == -1) {
printf ("test_umount_0 FAILED\n");
failed++;
}
printf (" 44/ 46 test_umount_1\n");
printf (" 44/ 49 test_umount_1\n");
if (test_umount_1 () == -1) {
printf ("test_umount_1 FAILED\n");
failed++;
}
printf (" 45/ 46 test_mounts_0\n");
printf (" 45/ 49 test_mounts_0\n");
if (test_mounts_0 () == -1) {
printf ("test_mounts_0 FAILED\n");
failed++;
}
printf (" 46/ 46 test_umount_all_0\n");
printf (" 46/ 49 test_umount_all_0\n");
if (test_umount_all_0 () == -1) {
printf ("test_umount_all_0 FAILED\n");
failed++;
}
printf (" 47/ 49 test_file_0\n");
if (test_file_0 () == -1) {
printf ("test_file_0 FAILED\n");
failed++;
}
printf (" 48/ 49 test_file_1\n");
if (test_file_1 () == -1) {
printf ("test_file_1 FAILED\n");
failed++;
}
printf (" 49/ 49 test_file_2\n");
if (test_file_2 () == -1) {
printf ("test_file_2 FAILED\n");
failed++;
}
guestfs_close (g);
snprintf (buf, sizeof buf, "%s/test1.img", srcdir);
@@ -3956,7 +4155,7 @@ int main (int argc, char *argv[])
unlink (buf);
if (failed > 0) {
printf ("***** %d / 46 tests FAILED *****\n", failed);
printf ("***** %d / 49 tests FAILED *****\n", failed);
exit (1);
}