Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 00/10] Make --run imply -U -
Should have done this a long time ago. I feel it is about time we change the default of nbdkit --run to imply -U -, rather than opening a public port. Patch series turned out to be a little bit more complicated than I anticipated, but it contains some nice clean ups. Last patch updating the documentation wouldn't be applied any time soon, so that the old docs stay around on the website. Rich.
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 01/10] server: Introduce service_mode concept
Previously there were two places where similiar-ish logic was used to decide if we are going to serve over a socket activation, -s, Unix socket, AF_VSOCK or TCP/IP. Let's abstract that into a service_mode. One place where we did this was when calculating the $uri variable for --run. This change adjusts and fixes this calculation (revealed as I made the above change). In particular if --port was not set then the $uri would contain fairly bogus values in some cases: $ nbdkit --vsock null 1M --run 'echo $uri ; nbdinfo $uri' nbd nbdinfo: nbd_connect_uri: NBD URI does not have a scheme: valid NBD URIs should start with a scheme like nbd://, nbds:// or nbd+unix://: Invalid argument (note uri='nbd') After this commit: $ nbdkit --vsock null 1M --run 'echo $uri ; nbdinfo $uri' nbd+vsock://1 protocol: newstyle-fixed without TLS, using structured packets export="": export-size: 1048576 (1M) content: data uri: nbd+vsock://1:10809/ ... --- server/internal.h | 11 +++++++ server/captive.c | 56 ++++++++++++++++++++--------------- server/main.c | 75 ++++++++++++++++++++++++++++++----------------- 3 files changed, 91 insertions(+), 51 deletions(-) diff --git a/server/internal.h b/server/internal.h index fcfbf0573..0652f8a86 100644 --- a/server/internal.h +++ b/server/internal.h @@ -108,6 +108,16 @@ enum log_to { LOG_TO_NULL, /* --log=null forced on the command line */ }; +enum service_mode { + /* These two modes cannot form an NBD URI: */ + SERVICE_MODE_SOCKET_ACTIVATION, /* socket activation. */ + SERVICE_MODE_LISTEN_STDIN, /* -s */ + + SERVICE_MODE_UNIXSOCKET, /* -U */ + SERVICE_MODE_VSOCK, /* --vsock */ + SERVICE_MODE_TCPIP, /* --port */ +}; + extern int tcpip_sock_af; extern struct debug_flag *debug_flags; extern const char *export_name; @@ -131,6 +141,7 @@ extern char *unixsocket; extern const char *user, *group; extern bool verbose; extern bool vsock; +extern enum service_mode service_mode; extern bool configured; extern int saved_stdin; extern int saved_stdout; diff --git a/server/captive.c b/server/captive.c index 2361bb60b..31fd949e5 100644 --- a/server/captive.c +++ b/server/captive.c @@ -78,36 +78,44 @@ run_command (void) /* Construct $uri. */ fprintf (fp, "uri="); - if (tls == 2) /* --tls=require */ - fprintf (fp, "nbds"); - else - fprintf (fp, "nbd"); - if (port) { - if (!vsock) { - fprintf (fp, "://localhost:"); - shell_quote (port, fp); - if (strcmp (export_name, "") != 0) { - putc ('/', fp); - uri_quote (export_name, fp); - } - } - else { - fprintf (fp, "+vsock://1:"); /* 1 = VMADDR_CID_LOCAL */ - shell_quote (port, fp); - if (strcmp (export_name, "") != 0) { - putc ('/', fp); - uri_quote (export_name, fp); - } - } - } - else if (unixsocket) { - fprintf (fp, "+unix://"); + switch (service_mode) { + case SERVICE_MODE_SOCKET_ACTIVATION: + case SERVICE_MODE_LISTEN_STDIN: + break; /* can't form a URI, leave it blank */ + case SERVICE_MODE_UNIXSOCKET: + fprintf (fp, "nbd%s+unix://", tls == 2 ? "s" : ""); if (strcmp (export_name, "") != 0) { putc ('/', fp); uri_quote (export_name, fp); } fprintf (fp, "\\?socket="); uri_quote (unixsocket, fp); + break; + case SERVICE_MODE_VSOCK: + /* 1 = VMADDR_CID_LOCAL */ + fprintf (fp, "nbd%s+vsock://1", tls == 2 ? "s" : ""); + if (port) { + putc (':', fp); + shell_quote (port, fp); + } + if (strcmp (export_name, "") != 0) { + putc ('/', fp); + uri_quote (export_name, fp); + } + break; + case SERVICE_MODE_TCPIP: + fprintf (fp, "nbd%s://localhost", tls == 2 ? "s" : ""); + if (port) { + putc (':', fp); + shell_quote (port, fp); + } + if (strcmp (export_name, "") != 0) { + putc ('/', fp); + uri_quote (export_name, fp); + } + break; + default: + abort (); } putc ('\n', fp); diff --git a/server/main.c b/server/main.c index 528a2dfea..2a332bfdd 100644 --- a/server/main.c +++ b/server/main.c @@ -117,6 +117,7 @@ const char *user, *group; /* -u & -g */ bool verbose; /* -v */ bool vsock; /* --vsock */ unsigned int socket_activation; /* $LISTEN_FDS and $LISTEN_PID set */ +enum service_mode service_mode; /* serving over TCP, Unix, etc */ bool configured; /* .config_complete done */ int saved_stdin = -1; /* dup'd stdin during -s/--run */ int saved_stdout = -1; /* dup'd stdout during -s/--run */ @@ -617,6 +618,18 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* By the point we have enough information to calculate the service mode. */ + if (socket_activation) + service_mode = SERVICE_MODE_SOCKET_ACTIVATION; + else if (listen_stdin) + service_mode = SERVICE_MODE_LISTEN_STDIN; + else if (unixsocket) + service_mode = SERVICE_MODE_UNIXSOCKET; + else if (vsock) + service_mode = SERVICE_MODE_VSOCK; + else + service_mode = SERVICE_MODE_TCPIP; + /* The remaining command line arguments are the plugin name and * parameters. If --help, --version or --dump-plugin were specified * then we open the plugin so that we can display the per-plugin @@ -970,15 +983,16 @@ start_serving (void) #endif } - /* Socket activation: the ?socket_activation? variable (> 0) is the - * number of file descriptors from FIRST_SOCKET_ACTIVATION_FD to - * FIRST_SOCKET_ACTIVATION_FD+socket_activation-1. - */ - if (socket_activation) { - if (sockets_reserve (&socks, socket_activation) == -1) { - perror ("realloc"); - exit (EXIT_FAILURE); - } + switch (service_mode) { + case SERVICE_MODE_SOCKET_ACTIVATION: + /* Socket activation: the ?socket_activation? variable (> 0) is + * the number of file descriptors from FIRST_SOCKET_ACTIVATION_FD + * to FIRST_SOCKET_ACTIVATION_FD+socket_activation-1. + */ + if (sockets_reserve (&socks, socket_activation) == -1) { + perror ("realloc"); + exit (EXIT_FAILURE); + } for (i = 0; i < socket_activation; ++i) { int s = FIRST_SOCKET_ACTIVATION_FD + i, r; /* This can't fail because of the reservation above. */ @@ -990,35 +1004,42 @@ start_serving (void) write_pidfile (); top->after_fork (top); accept_incoming_connections (&socks); - return; - } + break; - /* Handling a single connection on stdin/stdout. */ - if (listen_stdin) { + case SERVICE_MODE_LISTEN_STDIN: + /* Handling a single connection on stdin/stdout. */ change_user (); write_pidfile (); top->after_fork (top); threadlocal_new_server_thread (); handle_single_connection (saved_stdin, saved_stdout); - return; - } + break; - /* Handling multiple connections on TCP/IP, Unix domain socket or - * AF_VSOCK. - */ - if (unixsocket) + case SERVICE_MODE_UNIXSOCKET: bind_unix_socket (&socks); - else if (vsock) + goto serve_socks; + + case SERVICE_MODE_VSOCK: bind_vsock (&socks); - else + goto serve_socks; + + case SERVICE_MODE_TCPIP: bind_tcpip_socket (&socks); + serve_socks: + /* Common code for handling multiple connections on TCP/IP, Unix + * domain socket or AF_VSOCK. + */ + run_command (); + change_user (); + fork_into_background (); + write_pidfile (); + top->after_fork (top); + accept_incoming_connections (&socks); + break; - run_command (); - change_user (); - fork_into_background (); - write_pidfile (); - top->after_fork (top); - accept_incoming_connections (&socks); + default: + abort (); + } } static void -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 02/10] server: Don't set export_name as a side effect of using --run
Reduce long-range code dependencies by not setting export_name in run_command (--run functionality), especially as this function is not always called. If the -e option was not used at all then export_name will be NULL. --- server/captive.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/captive.c b/server/captive.c index 31fd949e5..40c4bb2ca 100644 --- a/server/captive.c +++ b/server/captive.c @@ -67,9 +67,6 @@ run_command (void) if (!run) return; - if (!export_name) - export_name = ""; - fp = open_memstream (&cmd, &len); if (fp == NULL) { perror ("open_memstream"); @@ -84,7 +81,7 @@ run_command (void) break; /* can't form a URI, leave it blank */ case SERVICE_MODE_UNIXSOCKET: fprintf (fp, "nbd%s+unix://", tls == 2 ? "s" : ""); - if (strcmp (export_name, "") != 0) { + if (export_name && strcmp (export_name, "") != 0) { putc ('/', fp); uri_quote (export_name, fp); } @@ -98,7 +95,7 @@ run_command (void) putc (':', fp); shell_quote (port, fp); } - if (strcmp (export_name, "") != 0) { + if (export_name && strcmp (export_name, "") != 0) { putc ('/', fp); uri_quote (export_name, fp); } @@ -109,7 +106,7 @@ run_command (void) putc (':', fp); shell_quote (port, fp); } - if (strcmp (export_name, "") != 0) { + if (export_name && strcmp (export_name, "") != 0) { putc ('/', fp); uri_quote (export_name, fp); } @@ -124,7 +121,8 @@ run_command (void) /* Expose $exportname. */ fprintf (fp, "exportname="); - shell_quote (export_name, fp); + if (export_name) + shell_quote (export_name, fp); putc ('\n', fp); /* Construct $tls, $port and $unixsocket. */ -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 03/10] server: Don't set port as a side effect
This removes another long-range code dependency. --- server/sockets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/sockets.c b/server/sockets.c index fe8b24409..d49b1755b 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -171,26 +171,26 @@ bind_unix_socket (sockets *socks) void bind_tcpip_socket (sockets *socks) { + const char *ipport; struct addrinfo *ai = NULL; struct addrinfo hints; struct addrinfo *a; int err, opt; int saved_errno = 0; - if (port == NULL) - port = "10809"; + ipport = port ? port : "10809"; memset (&hints, 0, sizeof hints); hints.ai_flags = AI_PASSIVE; hints.ai_family = tcpip_sock_af; hints.ai_socktype = SOCK_STREAM; - err = getaddrinfo (ipaddr, port, &hints, &ai); + err = getaddrinfo (ipaddr, ipport, &hints, &ai); if (err != 0) { fprintf (stderr, "%s: getaddrinfo: %s: %s: %s\n", program_name, ipaddr ? ipaddr : "<any>", - port, + ipport, gai_strerror (err)); exit (EXIT_FAILURE); } @@ -272,7 +272,7 @@ bind_tcpip_socket (sockets *socks) } debug ("bound to IP address %s:%s (%zu socket(s))", - ipaddr ? ipaddr : "<any>", port, socks->len); + ipaddr ? ipaddr : "<any>", ipport, socks->len); } void -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 04/10] server: Calculate $uri in one place
Move the calculation of $uri to the main function (well, inlined there), and out of --run code. This is largely code motion. In theory it changes the content of $uri since we now shell quote it after generating it, but this ought not to have any practical effect. --- server/internal.h | 1 + server/captive.c | 41 ++---------------------- server/main.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 39 deletions(-) diff --git a/server/internal.h b/server/internal.h index 0652f8a86..656b6d8ce 100644 --- a/server/internal.h +++ b/server/internal.h @@ -142,6 +142,7 @@ extern const char *user, *group; extern bool verbose; extern bool vsock; extern enum service_mode service_mode; +extern char *uri; extern bool configured; extern int saved_stdin; extern int saved_stdout; diff --git a/server/captive.c b/server/captive.c index 40c4bb2ca..51dafca34 100644 --- a/server/captive.c +++ b/server/captive.c @@ -75,45 +75,8 @@ run_command (void) /* Construct $uri. */ fprintf (fp, "uri="); - switch (service_mode) { - case SERVICE_MODE_SOCKET_ACTIVATION: - case SERVICE_MODE_LISTEN_STDIN: - break; /* can't form a URI, leave it blank */ - case SERVICE_MODE_UNIXSOCKET: - fprintf (fp, "nbd%s+unix://", tls == 2 ? "s" : ""); - if (export_name && strcmp (export_name, "") != 0) { - putc ('/', fp); - uri_quote (export_name, fp); - } - fprintf (fp, "\\?socket="); - uri_quote (unixsocket, fp); - break; - case SERVICE_MODE_VSOCK: - /* 1 = VMADDR_CID_LOCAL */ - fprintf (fp, "nbd%s+vsock://1", tls == 2 ? "s" : ""); - if (port) { - putc (':', fp); - shell_quote (port, fp); - } - if (export_name && strcmp (export_name, "") != 0) { - putc ('/', fp); - uri_quote (export_name, fp); - } - break; - case SERVICE_MODE_TCPIP: - fprintf (fp, "nbd%s://localhost", tls == 2 ? "s" : ""); - if (port) { - putc (':', fp); - shell_quote (port, fp); - } - if (export_name && strcmp (export_name, "") != 0) { - putc ('/', fp); - uri_quote (export_name, fp); - } - break; - default: - abort (); - } + if (uri) + shell_quote (uri, fp); putc ('\n', fp); /* Since nbdkit 1.24, $nbd is a synonym for $uri. */ diff --git a/server/main.c b/server/main.c index 2a332bfdd..54eb348ba 100644 --- a/server/main.c +++ b/server/main.c @@ -66,6 +66,7 @@ #include "ascii-string.h" #include "exit-with-parent.h" #include "nbd-protocol.h" +#include "open_memstream.h" #include "realpath.h" #include "strndup.h" #include "syslog.h" @@ -79,6 +80,7 @@ #endif static char *make_random_fifo (void); +static char *make_uri (void); static struct backend *open_plugin_so (size_t i, const char *filename, int short_name); static struct backend *open_filter_so (struct backend *next, size_t i, @@ -118,6 +120,7 @@ bool verbose; /* -v */ bool vsock; /* --vsock */ unsigned int socket_activation; /* $LISTEN_FDS and $LISTEN_PID set */ enum service_mode service_mode; /* serving over TCP, Unix, etc */ +char *uri; /* NBD URI */ bool configured; /* .config_complete done */ int saved_stdin = -1; /* dup'd stdin during -s/--run */ int saved_stdout = -1; /* dup'd stdout during -s/--run */ @@ -630,6 +633,11 @@ main (int argc, char *argv[]) else service_mode = SERVICE_MODE_TCPIP; + /* By the point we have enough information to calculate the NBD URI. + * Note this may be NULL. + */ + uri = make_uri (); + /* The remaining command line arguments are the plugin name and * parameters. If --help, --version or --dump-plugin were specified * then we open the plugin so that we can display the per-plugin @@ -799,6 +807,7 @@ main (int argc, char *argv[]) free (unixsocket); free (pidfile); + free (uri); if (random_fifo) { unlink (random_fifo); @@ -856,6 +865,76 @@ make_random_fifo (void) return NULL; } +static char * +make_uri (void) +{ + FILE *fp; + size_t len = 0; + char *r = NULL; + + switch (service_mode) { + case SERVICE_MODE_SOCKET_ACTIVATION: + case SERVICE_MODE_LISTEN_STDIN: + /* can't form a URI, uri will be NULL */ + return NULL; + default: ; + } + + fp = open_memstream (&r, &len); + if (fp == NULL) { + perror ("open_memstream"); + exit (EXIT_FAILURE); + } + + switch (service_mode) { + case SERVICE_MODE_UNIXSOCKET: + fprintf (fp, "nbd%s+unix://", tls == 2 ? "s" : ""); + if (export_name && strcmp (export_name, "") != 0) { + putc ('/', fp); + uri_quote (export_name, fp); + } + fprintf (fp, "?socket="); + uri_quote (unixsocket, fp); + break; + case SERVICE_MODE_VSOCK: + /* 1 = VMADDR_CID_LOCAL */ + fprintf (fp, "nbd%s+vsock://1", tls == 2 ? "s" : ""); + if (port) { + putc (':', fp); + fputs (port, fp); + } + if (export_name && strcmp (export_name, "") != 0) { + putc ('/', fp); + uri_quote (export_name, fp); + } + break; + case SERVICE_MODE_TCPIP: + fprintf (fp, "nbd%s://localhost", tls == 2 ? "s" : ""); + if (port) { + putc (':', fp); + fputs (port, fp); + } + if (export_name && strcmp (export_name, "") != 0) { + putc ('/', fp); + uri_quote (export_name, fp); + } + break; + + case SERVICE_MODE_SOCKET_ACTIVATION: + case SERVICE_MODE_LISTEN_STDIN: + abort (); /* see above */ + default: + abort (); + } + + if (fclose (fp) == EOF) { + perror ("memstream failed"); + exit (EXIT_FAILURE); + } + + return r; +} + static struct backend * open_plugin_so (size_t i, const char *name, int short_name) { -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 05/10] server: Add the NBD URI to debug output
Example after applying this patch: $ ./nbdkit -fv --port 9999 -e foo null 1M /home/rjones/d/nbdkit/server/nbdkit -f -v --port=9999 -e foo -- /home/rjones/d/nbdkit/plugins/null/.libs/nbdkit-null-plugin.so 1M nbdkit: debug: nbdkit 1.35.12 nbdkit: debug: TLS disabled: could not load TLS certificates nbdkit: debug: NBD URI: nbd://localhost:9999/foo An alternative I considered was adding a --print-uri option which would print the URI on stdout. Maybe we could do this as an alternative later. Normally the server does not print anything on stdout, and it is problematic in some modes, like when using -s. --- server/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/main.c b/server/main.c index 54eb348ba..0c9019d94 100644 --- a/server/main.c +++ b/server/main.c @@ -637,6 +637,8 @@ main (int argc, char *argv[]) * Note this may be NULL. */ uri = make_uri (); + if (uri) + debug ("NBD URI: %s", uri); /* The remaining command line arguments are the plugin name and * parameters. If --help, --version or --dump-plugin were specified -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 06/10] server: Make --run imply -U -
Almost always when you used nbdkit --run you should also use -U - (to use a private Unix domain socket). Otherwise nbdkit listened on TCP port 10809, which had two bad side effects: It permitted other processes to interfere with your --run command, and it reserved a public TCP port which would stop two instances of nbdkit running at the same time. This was a frequent cause of bugs in test cases. Switch the default so now --run implies -U - You can still get the old behaviour by using --port explicitly, but that is almost certainly a bad idea. (Using --run and --vsock works the same way as before too. It is also usually a bad idea, although we use it in one test.) --- docs/nbdkit-captive.pod | 7 ------- docs/nbdkit.pod | 9 ++++++++- server/main.c | 9 +++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/nbdkit-captive.pod b/docs/nbdkit-captive.pod index 34a1d0922..248f9df28 100644 --- a/docs/nbdkit-captive.pod +++ b/docs/nbdkit-captive.pod @@ -98,13 +98,6 @@ I<--run> implies I<--foreground>. It is not possible, and probably not desirable, to have nbdkit fork into the background when using I<--run>. -Even when running captive, nbdkit still listens on the regular TCP/IP -port, unless you specify the I<-p>/I<-U> options. If you want a truly -private captive nbdkit, then you should create a private random -Unix socket, like this: - - nbdkit -U - plugin [args] --run '...' - =head2 Copying data in and out of plugins with captive nbdkit Captive nbdkit + L<qemu-img(1)> can be used to copy data into and out diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod index 634c97e3a..f62796886 100644 --- a/docs/nbdkit.pod +++ b/docs/nbdkit.pod @@ -382,6 +382,12 @@ like Debian this might not be a full-featured shell. This option implies I<--foreground>. +In nbdkit E<le> 1.34 you normally had to add I<-U ->, otherwise nbdkit +would use a TCP/IP port which was normally not what you wanted. In +nbdkit E<ge> 1.36, using I<--run> implies I<-U ->. If you want the +old behaviour of nbdkit then you must add the I<--port> option +explicitly. + =item B<--selinux-label=>SOCKET-LABEL Apply the SELinux label C<SOCKET-LABEL> to the nbdkit listening @@ -481,7 +487,8 @@ should delete the socket file after use (else if you try to start nbdkit up again you will get an C<Address already in use> error). If the socket name is I<-> then nbdkit generates a randomly named -private socket. This is useful with L<nbdkit-captive(1)/CAPTIVE NBDKIT>. +private socket. This is implied by the I<--run> option. See also +L<nbdkit-captive(1)/CAPTIVE NBDKIT>. =item B<-u> USER diff --git a/server/main.c b/server/main.c index 0c9019d94..978a720cf 100644 --- a/server/main.c +++ b/server/main.c @@ -621,6 +621,15 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* Since nbdkit 1.36, --run implies -U -, unless --vsock or --port + * was set explicitly. + */ + if (run && !unixsocket && !port && !vsock) { + unixsocket = make_random_fifo (); + if (!unixsocket) + exit (EXIT_FAILURE); + } + /* By the point we have enough information to calculate the service mode. */ if (socket_activation) service_mode = SERVICE_MODE_SOCKET_ACTIVATION; -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 07/10] tests/test-parallel-*.sh: Remove redundant comment
--- tests/test-parallel-file.sh | 1 - tests/test-parallel-nbd.sh | 1 - tests/test-parallel-sh.sh | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/test-parallel-file.sh b/tests/test-parallel-file.sh index 3cbaa2d46..add60007a 100755 --- a/tests/test-parallel-file.sh +++ b/tests/test-parallel-file.sh @@ -32,7 +32,6 @@ source ./functions.sh -# Check file-data was created by Makefile and qemu-io exists. requires test -f file-data requires qemu-io --version requires timeout 60s true diff --git a/tests/test-parallel-nbd.sh b/tests/test-parallel-nbd.sh index ebecb6cab..3467e9f98 100755 --- a/tests/test-parallel-nbd.sh +++ b/tests/test-parallel-nbd.sh @@ -32,7 +32,6 @@ source ./functions.sh -# Check file-data was created by Makefile and qemu-io exists. requires test -f file-data requires qemu-io --version requires timeout 60s true diff --git a/tests/test-parallel-sh.sh b/tests/test-parallel-sh.sh index 73f5ab512..fae44e537 100755 --- a/tests/test-parallel-sh.sh +++ b/tests/test-parallel-sh.sh @@ -32,7 +32,6 @@ source ./functions.sh -# Check file-data was created by Makefile and qemu-io exists. requires test -f file-data requires qemu-io --version requires timeout 60s true -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 08/10] tests: Be punctilious about using requires_run in tests that use --run
This requires that nbdkit is built with the --run feature, which (currently) is not true for Windows. (In some tests we separately checked for !Windows, but let's favour consistency.) --- plugins/rust/test-ramdisk.sh | 2 ++ tests/test-S3.sh | 1 + tests/test-blkio.sh | 1 + tests/test-block-size-constraints.sh | 1 + tests/test-blocksize-default.sh | 1 + tests/test-blocksize-error-policy.sh | 1 + tests/test-blocksize-extents.sh | 1 + tests/test-blocksize-policy.sh | 1 + tests/test-blocksize-sharding.sh | 1 + tests/test-blocksize-write-disconnect.sh | 1 + tests/test-cc-cpp.sh | 1 + tests/test-cc-ocaml.sh | 1 + tests/test-cc.sh | 1 + tests/test-cow-block-size.sh | 1 + tests/test-cow.sh | 1 + tests/test-curl-file.sh | 1 + tests/test-curl-header-script-fail.sh | 1 + tests/test-eflags.sh | 1 + tests/test-eval-cache.sh | 1 + tests/test-eval-exports.sh | 1 + tests/test-eval-file.sh | 1 + tests/test-eval.sh | 1 + tests/test-evil-cosmic.sh | 1 + tests/test-evil-large-p.sh | 1 + tests/test-evil-small-p.sh | 1 + tests/test-exportname.sh | 1 + tests/test-file-dir.sh | 1 + tests/test-file-extents.sh | 1 + tests/test-ip-filter-anyunix.sh | 1 + tests/test-ip-filter-anyvsock.sh | 1 + tests/test-ip-filter-gid.sh | 1 + tests/test-ip-filter-uid.sh | 1 + tests/test-linuxdisk-copy-out.sh | 1 + tests/test-multi-conn-name.sh | 1 + tests/test-multi-conn.sh | 1 + tests/test-nbd-block-size.sh | 1 + tests/test-nbd-extents.sh | 1 + tests/test-nbd-vsock.sh | 1 + tests/test-nozero.sh | 1 + tests/test-old-plugins.sh | 1 + tests/test-ondemand-list.sh | 1 + tests/test-parallel-file.sh | 1 + tests/test-parallel-nbd.sh | 1 + tests/test-parallel-sh.sh | 1 + tests/test-partition2.sh | 1 + tests/test-qcow2dec-map.sh | 1 + tests/test-qcow2dec.sh | 1 + tests/test-readahead.sh | 1 + tests/test-retry-extents.sh | 1 + tests/test-retry-open.sh | 1 + tests/test-retry-readonly.sh | 1 + tests/test-retry-reopen-fail.sh | 1 + tests/test-retry-request-open.sh | 1 + tests/test-retry-request.sh | 1 + tests/test-retry-size.sh | 1 + tests/test-retry-zero-flags.sh | 1 + tests/test-retry.sh | 1 + tests/test-sh-errors.sh | 1 + tests/test-sh-extents.sh | 1 + tests/test-shebang-cc.sh | 1 + tests/test-ssh.sh | 1 + tests/test-stdio.sh | 1 + tests/test-swab-extents.sh | 1 + tests/test-tar-info-xz-qcow2dec.sh | 1 + tests/test-tar-info-xz.sh | 1 + tests/test-tar-info.sh | 1 + tests/test-tls.sh | 1 + tests/test-tmpdisk-command.sh | 1 + tests/test-vddk-password-fd.sh | 1 + tests/test-vddk-password-interactive.sh | 1 + tests/test-vddk-real-create.sh | 1 + tests/test-vddk-real.sh | 1 + tests/test-vddk-reexec.sh | 1 + tests/test-vddk-run.sh | 1 + tests/test-vsock.sh | 1 + 75 files changed, 76 insertions(+) diff --git a/plugins/rust/test-ramdisk.sh b/plugins/rust/test-ramdisk.sh index a10f6300d..430ee5190 100755 --- a/plugins/rust/test-ramdisk.sh +++ b/plugins/rust/test-ramdisk.sh @@ -44,6 +44,8 @@ if is_windows; then exit 77 fi +requires_run + ramdisk=target/release/examples/libramdisk.so requires test -x $ramdisk diff --git a/tests/test-S3.sh b/tests/test-S3.sh index ec2177704..047c931ca 100755 --- a/tests/test-S3.sh +++ b/tests/test-S3.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires hexdump --version requires $PYTHON --version requires_nbdcopy diff --git a/tests/test-blkio.sh b/tests/test-blkio.sh index 4e45126de..31896ad96 100755 --- a/tests/test-blkio.sh +++ b/tests/test-blkio.sh @@ -39,6 +39,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin blkio requires_nbdsh_uri requires test -f disk diff --git a/tests/test-block-size-constraints.sh b/tests/test-block-size-constraints.sh index e282923da..692a918e9 100755 --- a/tests/test-block-size-constraints.sh +++ b/tests/test-block-size-constraints.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires nbdsh -c 'print(h.get_block_size)' requires_nbdsh_uri diff --git a/tests/test-blocksize-default.sh b/tests/test-blocksize-default.sh index 2736a8a1c..c5df88bfb 100755 --- a/tests/test-blocksize-default.sh +++ b/tests/test-blocksize-default.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires nbdsh -c 'print(h.get_block_size)' requires dd iflag=count_bytes </dev/null diff --git a/tests/test-blocksize-error-policy.sh b/tests/test-blocksize-error-policy.sh index 322c13762..44e9fd5cc 100755 --- a/tests/test-blocksize-error-policy.sh +++ b/tests/test-blocksize-error-policy.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires nbdsh -c 'print(h.get_block_size)' requires nbdsh -c 'print(h.get_strict_mode)' diff --git a/tests/test-blocksize-extents.sh b/tests/test-blocksize-extents.sh index ceec66b9a..3fc452158 100755 --- a/tests/test-blocksize-extents.sh +++ b/tests/test-blocksize-extents.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdsh_uri requires nbdsh --base-allocation diff --git a/tests/test-blocksize-policy.sh b/tests/test-blocksize-policy.sh index 50522c9c0..0b4895bd1 100755 --- a/tests/test-blocksize-policy.sh +++ b/tests/test-blocksize-policy.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires nbdsh -c 'print(h.get_block_size)' requires_nbdsh_uri diff --git a/tests/test-blocksize-sharding.sh b/tests/test-blocksize-sharding.sh index 9ce328296..e3251e70b 100755 --- a/tests/test-blocksize-sharding.sh +++ b/tests/test-blocksize-sharding.sh @@ -37,6 +37,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdsh_uri requires dd oflag=seek_bytes </dev/null diff --git a/tests/test-blocksize-write-disconnect.sh b/tests/test-blocksize-write-disconnect.sh index 1d3c1326c..ff8991fab 100755 --- a/tests/test-blocksize-write-disconnect.sh +++ b/tests/test-blocksize-write-disconnect.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires nbdsh -c 'print(h.get_block_size)' requires nbdsh -c 'print(h.get_strict_mode)' diff --git a/tests/test-cc-cpp.sh b/tests/test-cc-cpp.sh index 7c7bf6353..c5751dcf9 100755 --- a/tests/test-cc-cpp.sh +++ b/tests/test-cc-cpp.sh @@ -43,6 +43,7 @@ if test ! -f "$script"; then exit 1 fi +requires_run requires_plugin cc requires $CXX --version requires_nbdsh_uri diff --git a/tests/test-cc-ocaml.sh b/tests/test-cc-ocaml.sh index c6380d969..c17d0c23c 100755 --- a/tests/test-cc-ocaml.sh +++ b/tests/test-cc-ocaml.sh @@ -43,6 +43,7 @@ if test ! -f "$script"; then exit 1 fi +requires_run requires_plugin cc requires $OCAMLOPT -version requires_nbdsh_uri diff --git a/tests/test-cc.sh b/tests/test-cc.sh index 5214327bd..f4f5644b7 100755 --- a/tests/test-cc.sh +++ b/tests/test-cc.sh @@ -43,6 +43,7 @@ if test ! -f "$script"; then exit 1 fi +requires_run requires_plugin cc requires_nbdsh_uri requires_nbdinfo diff --git a/tests/test-cow-block-size.sh b/tests/test-cow-block-size.sh index 25dd86678..e6852d8d6 100755 --- a/tests/test-cow-block-size.sh +++ b/tests/test-cow-block-size.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin linuxdisk requires guestfish --version requires_nbdcopy diff --git a/tests/test-cow.sh b/tests/test-cow.sh index a3a158003..5b137ff4d 100755 --- a/tests/test-cow.sh +++ b/tests/test-cow.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin linuxdisk requires guestfish --version requires_nbdcopy diff --git a/tests/test-curl-file.sh b/tests/test-curl-file.sh index 7b993334a..0269768ed 100755 --- a/tests/test-curl-file.sh +++ b/tests/test-curl-file.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires test -r /dev/null requires_nbdinfo diff --git a/tests/test-curl-header-script-fail.sh b/tests/test-curl-header-script-fail.sh index 2f3073564..1bd5f3dba 100755 --- a/tests/test-curl-header-script-fail.sh +++ b/tests/test-curl-header-script-fail.sh @@ -39,6 +39,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires_nbdinfo diff --git a/tests/test-eflags.sh b/tests/test-eflags.sh index 09f550016..4972c6260 100755 --- a/tests/test-eflags.sh +++ b/tests/test-eflags.sh @@ -42,6 +42,7 @@ source ./functions.sh set -e +requires_run requires_plugin sh requires qemu-nbd --version diff --git a/tests/test-eval-cache.sh b/tests/test-eval-cache.sh index b56bba050..fb3fc884a 100755 --- a/tests/test-eval-cache.sh +++ b/tests/test-eval-cache.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdsh_uri requires dd iflag=count_bytes </dev/null diff --git a/tests/test-eval-exports.sh b/tests/test-eval-exports.sh index 6a21d4fd5..acb04bc63 100755 --- a/tests/test-eval-exports.sh +++ b/tests/test-eval-exports.sh @@ -37,6 +37,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdinfo requires_nbdsh_uri diff --git a/tests/test-eval-file.sh b/tests/test-eval-file.sh index c4fe8599f..ad787a88d 100755 --- a/tests/test-eval-file.sh +++ b/tests/test-eval-file.sh @@ -37,6 +37,7 @@ source ./functions.sh set -e set -x +requires_run requires guestfish --version requires test -f disk requires dd iflag=count_bytes </dev/null diff --git a/tests/test-eval.sh b/tests/test-eval.sh index cb2052117..6493ba61d 100755 --- a/tests/test-eval.sh +++ b/tests/test-eval.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdinfo requires dd iflag=count_bytes </dev/null diff --git a/tests/test-evil-cosmic.sh b/tests/test-evil-cosmic.sh index 2e5e6ab24..50619966e 100755 --- a/tests/test-evil-cosmic.sh +++ b/tests/test-evil-cosmic.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin null requires_filter evil requires_filter noextents diff --git a/tests/test-evil-large-p.sh b/tests/test-evil-large-p.sh index 0fcd9de4c..e9a25b3fc 100755 --- a/tests/test-evil-large-p.sh +++ b/tests/test-evil-large-p.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin null requires_filter evil requires_filter noextents diff --git a/tests/test-evil-small-p.sh b/tests/test-evil-small-p.sh index 7b56cd135..5f2956147 100755 --- a/tests/test-evil-small-p.sh +++ b/tests/test-evil-small-p.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin null requires_filter evil requires_filter noextents diff --git a/tests/test-exportname.sh b/tests/test-exportname.sh index 63a400849..606a0e998 100755 --- a/tests/test-exportname.sh +++ b/tests/test-exportname.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdinfo requires_nbdsh_uri diff --git a/tests/test-file-dir.sh b/tests/test-file-dir.sh index 698d88baf..98a5e77e1 100755 --- a/tests/test-file-dir.sh +++ b/tests/test-file-dir.sh @@ -43,6 +43,7 @@ if is_windows; then exit 77 fi +requires_run requires_nbdinfo requires_nbdsh_uri requires nbdsh -c 'print(h.set_full_info)' diff --git a/tests/test-file-extents.sh b/tests/test-file-extents.sh index 3d7d2b6ef..e3900b0a7 100755 --- a/tests/test-file-extents.sh +++ b/tests/test-file-extents.sh @@ -38,6 +38,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires jq --version requires qemu-img --version diff --git a/tests/test-ip-filter-anyunix.sh b/tests/test-ip-filter-anyunix.sh index b17af0115..9b94dc969 100755 --- a/tests/test-ip-filter-anyunix.sh +++ b/tests/test-ip-filter-anyunix.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo # Not supported on Windows. diff --git a/tests/test-ip-filter-anyvsock.sh b/tests/test-ip-filter-anyvsock.sh index 078299304..4fb3b6a4c 100755 --- a/tests/test-ip-filter-anyvsock.sh +++ b/tests/test-ip-filter-anyvsock.sh @@ -42,6 +42,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo requires nbdsh --version requires nbdsh -c 'print(h.connect_vsock)' diff --git a/tests/test-ip-filter-gid.sh b/tests/test-ip-filter-gid.sh index 3e3af7cd9..8d9ee1eb0 100755 --- a/tests/test-ip-filter-gid.sh +++ b/tests/test-ip-filter-gid.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo # Not supported on Windows. diff --git a/tests/test-ip-filter-uid.sh b/tests/test-ip-filter-uid.sh index 610297ae5..b942345a5 100755 --- a/tests/test-ip-filter-uid.sh +++ b/tests/test-ip-filter-uid.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo # Not supported on Windows. diff --git a/tests/test-linuxdisk-copy-out.sh b/tests/test-linuxdisk-copy-out.sh index 3c4bcc079..492b6d069 100755 --- a/tests/test-linuxdisk-copy-out.sh +++ b/tests/test-linuxdisk-copy-out.sh @@ -37,6 +37,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin linuxdisk requires guestfish --version requires_nbdcopy diff --git a/tests/test-multi-conn-name.sh b/tests/test-multi-conn-name.sh index ceaf5dba7..c3657d482 100755 --- a/tests/test-multi-conn-name.sh +++ b/tests/test-multi-conn-name.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdsh_uri requires nbdsh -c 'print(h.set_opt_mode)' diff --git a/tests/test-multi-conn.sh b/tests/test-multi-conn.sh index acd12989a..6ce863dfe 100755 --- a/tests/test-multi-conn.sh +++ b/tests/test-multi-conn.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdsh_uri requires dd iflag=count_bytes </dev/null diff --git a/tests/test-nbd-block-size.sh b/tests/test-nbd-block-size.sh index 6c2c53c92..c6971edf3 100755 --- a/tests/test-nbd-block-size.sh +++ b/tests/test-nbd-block-size.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_plugin nbd requires nbdsh -c 'print(h.get_block_size)' diff --git a/tests/test-nbd-extents.sh b/tests/test-nbd-extents.sh index d6fc26167..e91f19b1c 100755 --- a/tests/test-nbd-extents.sh +++ b/tests/test-nbd-extents.sh @@ -38,6 +38,7 @@ source ./functions.sh set -e set -x +requires_run requires jq --version requires qemu-img --version requires qemu-img map --help diff --git a/tests/test-nbd-vsock.sh b/tests/test-nbd-vsock.sh index d4949cac2..63fbedb93 100755 --- a/tests/test-nbd-vsock.sh +++ b/tests/test-nbd-vsock.sh @@ -44,6 +44,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdsh_uri requires nbdsh -c 'print(h.connect_vsock)' requires_linux_kernel_version 5.6 diff --git a/tests/test-nozero.sh b/tests/test-nozero.sh index 3728df403..4cd834398 100755 --- a/tests/test-nozero.sh +++ b/tests/test-nozero.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires $STAT --version sock2=$(mktemp -u /tmp/nbdkit-test-sock.XXXXXX) diff --git a/tests/test-old-plugins.sh b/tests/test-old-plugins.sh index 7fc958064..fd593a17d 100755 --- a/tests/test-old-plugins.sh +++ b/tests/test-old-plugins.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires guestfish --version requires $CUT --version requires test -f disk diff --git a/tests/test-ondemand-list.sh b/tests/test-ondemand-list.sh index 5cff0cb19..bc264c7df 100755 --- a/tests/test-ondemand-list.sh +++ b/tests/test-ondemand-list.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin ondemand requires qemu-nbd --version requires bash -c 'qemu-nbd --help | grep -- --list' diff --git a/tests/test-parallel-file.sh b/tests/test-parallel-file.sh index add60007a..476a5f669 100755 --- a/tests/test-parallel-file.sh +++ b/tests/test-parallel-file.sh @@ -32,6 +32,7 @@ source ./functions.sh +requires_run requires test -f file-data requires qemu-io --version requires timeout 60s true diff --git a/tests/test-parallel-nbd.sh b/tests/test-parallel-nbd.sh index 3467e9f98..c2055e80f 100755 --- a/tests/test-parallel-nbd.sh +++ b/tests/test-parallel-nbd.sh @@ -32,6 +32,7 @@ source ./functions.sh +requires_run requires test -f file-data requires qemu-io --version requires timeout 60s true diff --git a/tests/test-parallel-sh.sh b/tests/test-parallel-sh.sh index fae44e537..08fd8a630 100755 --- a/tests/test-parallel-sh.sh +++ b/tests/test-parallel-sh.sh @@ -32,6 +32,7 @@ source ./functions.sh +requires_run requires test -f file-data requires qemu-io --version requires timeout 60s true diff --git a/tests/test-partition2.sh b/tests/test-partition2.sh index 6ad8a81e3..f195bc78e 100755 --- a/tests/test-partition2.sh +++ b/tests/test-partition2.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo requires test -f disk diff --git a/tests/test-qcow2dec-map.sh b/tests/test-qcow2dec-map.sh index 1b5ee509b..dc451a02a 100755 --- a/tests/test-qcow2dec-map.sh +++ b/tests/test-qcow2dec-map.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires_nbdinfo requires qemu-img --version diff --git a/tests/test-qcow2dec.sh b/tests/test-qcow2dec.sh index d6ca253d1..0c6a759f3 100755 --- a/tests/test-qcow2dec.sh +++ b/tests/test-qcow2dec.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires_nbdcopy requires_nbdinfo diff --git a/tests/test-readahead.sh b/tests/test-readahead.sh index 3f4a3f729..267d7678d 100755 --- a/tests/test-readahead.sh +++ b/tests/test-readahead.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdsh_uri requires dd iflag=count_bytes </dev/null diff --git a/tests/test-retry-extents.sh b/tests/test-retry-extents.sh index 7f2f3980f..6df977fa4 100755 --- a/tests/test-retry-extents.sh +++ b/tests/test-retry-extents.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdsh_uri requires nbdsh --base-allocation diff --git a/tests/test-retry-open.sh b/tests/test-retry-open.sh index 6180444e7..4a74d5d42 100755 --- a/tests/test-retry-open.sh +++ b/tests/test-retry-open.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires qemu-io --version diff --git a/tests/test-retry-readonly.sh b/tests/test-retry-readonly.sh index 5c9cf128b..985ac8b92 100755 --- a/tests/test-retry-readonly.sh +++ b/tests/test-retry-readonly.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires qemu-io --version diff --git a/tests/test-retry-reopen-fail.sh b/tests/test-retry-reopen-fail.sh index 5f332e024..65ecbdca7 100755 --- a/tests/test-retry-reopen-fail.sh +++ b/tests/test-retry-reopen-fail.sh @@ -39,6 +39,7 @@ set -x fail=0 +requires_run requires_plugin sh requires qemu-io --version requires dd iflag=count_bytes </dev/null diff --git a/tests/test-retry-request-open.sh b/tests/test-retry-request-open.sh index f2d56f7d6..bb60374b1 100755 --- a/tests/test-retry-request-open.sh +++ b/tests/test-retry-request-open.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdcopy requires dd iflag=count_bytes </dev/null diff --git a/tests/test-retry-request.sh b/tests/test-retry-request.sh index 27bfbdda3..e821eebe6 100755 --- a/tests/test-retry-request.sh +++ b/tests/test-retry-request.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdcopy requires dd iflag=count_bytes </dev/null diff --git a/tests/test-retry-size.sh b/tests/test-retry-size.sh index 47b592cd6..e0d22a3d3 100755 --- a/tests/test-retry-size.sh +++ b/tests/test-retry-size.sh @@ -36,6 +36,7 @@ set -x fail=0 +requires_run requires_plugin sh requires_nbdsh_uri requires dd iflag=count_bytes </dev/null diff --git a/tests/test-retry-zero-flags.sh b/tests/test-retry-zero-flags.sh index 30cde95d5..eff60925b 100755 --- a/tests/test-retry-zero-flags.sh +++ b/tests/test-retry-zero-flags.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdsh_uri requires nbdsh -c 'i = nbd.CMD_FLAG_FAST_ZERO' diff --git a/tests/test-retry.sh b/tests/test-retry.sh index 705201657..67708cf13 100755 --- a/tests/test-retry.sh +++ b/tests/test-retry.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires_nbdcopy requires dd iflag=count_bytes </dev/null diff --git a/tests/test-sh-errors.sh b/tests/test-sh-errors.sh index 74a5a0ece..2b05c7baa 100755 --- a/tests/test-sh-errors.sh +++ b/tests/test-sh-errors.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires qemu-io --version diff --git a/tests/test-sh-extents.sh b/tests/test-sh-extents.sh index f8a06b098..e6a15073b 100755 --- a/tests/test-sh-extents.sh +++ b/tests/test-sh-extents.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin sh requires jq --version requires qemu-img --version diff --git a/tests/test-shebang-cc.sh b/tests/test-shebang-cc.sh index a5e557648..e1f1e9fbe 100755 --- a/tests/test-shebang-cc.sh +++ b/tests/test-shebang-cc.sh @@ -41,6 +41,7 @@ if test ! -f "$script"; then exit 1 fi +requires_run requires_plugin cc requires guestfish --version diff --git a/tests/test-ssh.sh b/tests/test-ssh.sh index 035108070..eccab1518 100755 --- a/tests/test-ssh.sh +++ b/tests/test-ssh.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires_nbdcopy requires $STAT --version diff --git a/tests/test-stdio.sh b/tests/test-stdio.sh index c55ff2ab5..b8c18a82a 100755 --- a/tests/test-stdio.sh +++ b/tests/test-stdio.sh @@ -33,6 +33,7 @@ source ./functions.sh set -xe +requires_run requires_nbdsh_uri plugin=.libs/test-stdio-plugin.$SOEXT diff --git a/tests/test-swab-extents.sh b/tests/test-swab-extents.sh index f4ea9f0e9..68fd3bdcb 100755 --- a/tests/test-swab-extents.sh +++ b/tests/test-swab-extents.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin eval requires_nbdsh_uri requires nbdsh --base-allocation diff --git a/tests/test-tar-info-xz-qcow2dec.sh b/tests/test-tar-info-xz-qcow2dec.sh index b1e1cd97c..f8a4f54c7 100755 --- a/tests/test-tar-info-xz-qcow2dec.sh +++ b/tests/test-tar-info-xz-qcow2dec.sh @@ -37,6 +37,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires tar --version requires qemu-img --version diff --git a/tests/test-tar-info-xz.sh b/tests/test-tar-info-xz.sh index abd854974..064ee8eba 100755 --- a/tests/test-tar-info-xz.sh +++ b/tests/test-tar-info-xz.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires tar --version requires qemu-img --version diff --git a/tests/test-tar-info.sh b/tests/test-tar-info.sh index 5c015d88e..3f98999db 100755 --- a/tests/test-tar-info.sh +++ b/tests/test-tar-info.sh @@ -36,6 +36,7 @@ source ./functions.sh set -e set -x +requires_run requires test -f disk requires tar --version requires qemu-img --version diff --git a/tests/test-tls.sh b/tests/test-tls.sh index 5043456b4..cf570a9ec 100755 --- a/tests/test-tls.sh +++ b/tests/test-tls.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires qemu-img --version if ! qemu-img --help | grep -- --object; then diff --git a/tests/test-tmpdisk-command.sh b/tests/test-tmpdisk-command.sh index da0b8f9ed..4254d20ce 100755 --- a/tests/test-tmpdisk-command.sh +++ b/tests/test-tmpdisk-command.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires_plugin tmpdisk requires_nbdsh_uri diff --git a/tests/test-vddk-password-fd.sh b/tests/test-vddk-password-fd.sh index 2b251f142..1ccaee070 100755 --- a/tests/test-vddk-password-fd.sh +++ b/tests/test-vddk-password-fd.sh @@ -41,6 +41,7 @@ set -e set -x skip_if_valgrind "because setting LD_LIBRARY_PATH breaks valgrind" +requires_run requires_nbdinfo f=test-vddk-password-fd.file diff --git a/tests/test-vddk-password-interactive.sh b/tests/test-vddk-password-interactive.sh index 21b4baf3a..f9173da7b 100755 --- a/tests/test-vddk-password-interactive.sh +++ b/tests/test-vddk-password-interactive.sh @@ -41,6 +41,7 @@ set -e set -x skip_if_valgrind "because setting LD_LIBRARY_PATH breaks valgrind" +requires_run requires_nbdinfo requires expect -v diff --git a/tests/test-vddk-real-create.sh b/tests/test-vddk-real-create.sh index 84155e439..422bbcec8 100755 --- a/tests/test-vddk-real-create.sh +++ b/tests/test-vddk-real-create.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test "x$vddkdir" != "x" requires test -d "$vddkdir" requires test -f "$vddkdir/lib64/libvixDiskLib.so" diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh index 0b189665b..667b6fc20 100755 --- a/tests/test-vddk-real.sh +++ b/tests/test-vddk-real.sh @@ -34,6 +34,7 @@ source ./functions.sh set -e set -x +requires_run requires test "x$vddkdir" != "x" requires test -d "$vddkdir" requires test -f "$vddkdir/lib64/libvixDiskLib.so" diff --git a/tests/test-vddk-reexec.sh b/tests/test-vddk-reexec.sh index 14cbf4933..939bf1fb3 100755 --- a/tests/test-vddk-reexec.sh +++ b/tests/test-vddk-reexec.sh @@ -35,6 +35,7 @@ set -e set -x skip_if_valgrind "because setting LD_LIBRARY_PATH breaks valgrind" +requires_run # We ensure that LD_LIBRARY_PATH in the child is not further modified, # even if nbdkit had to re-exec. It's tricky, though: when running diff --git a/tests/test-vddk-run.sh b/tests/test-vddk-run.sh index c37ef4722..260c94bef 100755 --- a/tests/test-vddk-run.sh +++ b/tests/test-vddk-run.sh @@ -37,6 +37,7 @@ set -e set -x skip_if_valgrind "because setting LD_LIBRARY_PATH breaks valgrind" +requires_run requires_nbdinfo out=test-vddk-run.out diff --git a/tests/test-vsock.sh b/tests/test-vsock.sh index 5c71a04ab..43cf18423 100755 --- a/tests/test-vsock.sh +++ b/tests/test-vsock.sh @@ -42,6 +42,7 @@ source ./functions.sh set -e set -x +requires_run requires_nbdinfo requires nbdsh --version requires nbdsh -c 'print(h.connect_vsock)' -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 09/10] tests: Remove references to -U - when it is implicit
In tests where we used 'nbdkit -U - ... --run', remove -U - as that is now implicit. --- tests/Makefile.am | 2 +- plugins/rust/test-ramdisk.sh | 4 +-- tests/test-S3.sh | 2 +- tests/test-blkio.sh | 2 +- tests/test-block-size-constraints.sh | 2 +- tests/test-blocksize-default.sh | 2 +- tests/test-blocksize-error-policy.sh | 2 +- tests/test-blocksize-extents.sh | 2 +- tests/test-blocksize-policy.sh | 12 +++---- tests/test-blocksize-sharding.sh | 2 +- tests/test-blocksize-write-disconnect.sh | 2 +- tests/test-captive-tls.sh | 2 +- tests/test-captive.sh | 4 +-- tests/test-cc-cpp.sh | 2 +- tests/test-cc-ocaml.sh | 2 +- tests/test-cc.sh | 2 +- tests/test-checkwrite-bounds.sh | 2 +- tests/test-checkwrite.sh | 2 +- tests/test-cow-block-size.sh | 2 +- tests/test-cow-extents-large.sh | 2 +- tests/test-cow-null.sh | 2 +- tests/test-cow.sh | 2 +- tests/test-curl-file.sh | 2 +- tests/test-curl-header-script-fail.sh | 2 +- tests/test-data-bad.sh | 2 +- tests/test-data-extents.sh | 2 +- tests/test-data-format.sh | 8 ++--- tests/test-data-optimum.sh | 2 +- tests/test-data-partition.sh | 2 +- tests/test-data-raw-copy.sh | 2 +- tests/test-data-reloffset.sh | 4 +-- tests/test-data-size.sh | 2 +- tests/test-debug-flags.sh | 22 ++++++------- tests/test-delay-close.sh | 2 +- tests/test-delay-open.sh | 2 +- tests/test-disk2data.sh | 2 +- tests/test-eflags.sh | 2 +- tests/test-eval-cache.sh | 4 +-- tests/test-eval-exports.sh | 8 ++--- tests/test-eval-file.sh | 2 +- tests/test-eval.sh | 2 +- tests/test-evil-cosmic.sh | 2 +- tests/test-evil-large-p.sh | 6 ++-- tests/test-evil-small-p.sh | 6 ++-- tests/test-exportname.sh | 40 ++++++++++++------------ tests/test-extentlist.sh | 2 +- tests/test-file-dir.sh | 6 ++-- tests/test-file-extents.sh | 2 +- tests/test-ip-filter-anyunix.sh | 4 +-- tests/test-ip-filter-gid.sh | 4 +-- tests/test-ip-filter-pid.sh | 4 +-- tests/test-ip-filter-security.sh | 4 +-- tests/test-ip-filter-uid.sh | 4 +-- tests/test-linuxdisk-copy-out.sh | 2 +- tests/test-log-script-info.sh | 2 +- tests/test-long-name.sh | 14 ++++----- tests/test-luks-copy-zero.sh | 2 +- tests/test-luks-info.sh | 2 +- tests/test-multi-conn-name.sh | 4 +-- tests/test-multi-conn.sh | 18 +++++------ tests/test-nbd-block-size.sh | 4 +-- tests/test-nbd-extents.sh | 2 +- tests/test-nbd-vsock.sh | 2 +- tests/test-nbdkit-backend-debug.sh | 6 ++-- tests/test-nofilter.sh | 2 +- tests/test-nozero.sh | 2 +- tests/test-null-extents.sh | 2 +- tests/test-ocaml-fork.sh | 2 +- tests/test-ocaml-list-exports.sh | 2 +- tests/test-offset-extents.sh | 2 +- tests/test-offset-truncate.sh | 6 ++-- tests/test-old-plugins.sh | 2 +- tests/test-ondemand-list.sh | 2 +- tests/test-ones.sh | 6 ++-- tests/test-parallel-file.sh | 6 ++-- tests/test-parallel-nbd.sh | 4 +-- tests/test-parallel-sh.sh | 6 ++-- tests/test-partition-4k-gpt.sh | 2 +- tests/test-partition-4k-mbr.sh | 2 +- tests/test-partition1.sh | 2 +- tests/test-partition2.sh | 8 ++--- tests/test-partitioning1.sh | 6 ++-- tests/test-partitioning4.sh | 2 +- tests/test-partitioning6.sh | 2 +- tests/test-protect-ranges.sh | 2 +- tests/test-qcow2dec-map.sh | 2 +- tests/test-qcow2dec.sh | 2 +- tests/test-random-copy.sh | 2 +- tests/test-random-sock.sh | 4 +-- tests/test-rate-dynamic.sh | 2 +- tests/test-rate.sh | 2 +- tests/test-readahead-copy.sh | 4 +-- tests/test-readahead.sh | 2 +- tests/test-retry-extents.sh | 2 +- tests/test-retry-open.sh | 2 +- tests/test-retry-readonly.sh | 2 +- tests/test-retry-reopen-fail.sh | 2 +- tests/test-retry-request-open.sh | 2 +- tests/test-retry-request.sh | 2 +- tests/test-retry-size.sh | 2 +- tests/test-retry-zero-flags.sh | 2 +- tests/test-retry.sh | 2 +- tests/test-scan-copy.sh | 4 +-- tests/test-scan-info.sh | 8 ++--- tests/test-sh-errors.sh | 2 +- tests/test-sh-extents.sh | 2 +- tests/test-sh-tmpdir-leak.sh | 4 +-- tests/test-shebang-cc-ocaml.sh | 2 +- tests/test-shebang-cc.sh | 2 +- tests/test-sparse-random-copy.sh | 2 +- tests/test-sparse-random-info.sh | 2 +- tests/test-split-extents.sh | 2 +- tests/test-ssh.sh | 4 +-- tests/test-stdio.sh | 2 +- tests/test-swab-16w.sh | 2 +- tests/test-swab-32w.sh | 2 +- tests/test-swab-64w.sh | 2 +- tests/test-swab-8.sh | 4 +-- tests/test-swab-extents.sh | 2 +- tests/test-tar-info-xz-qcow2dec.sh | 4 +-- tests/test-tar-info-xz.sh | 2 +- tests/test-tar-info.sh | 2 +- tests/test-tar-limit.sh | 2 +- tests/test-tls.sh | 2 +- tests/test-tmpdisk-command.sh | 2 +- tests/test-truncate-extents.sh | 2 +- tests/test-vddk-password-fd.sh | 4 +-- tests/test-vddk-password-interactive.sh | 2 +- tests/test-vddk-real-create.sh | 2 +- tests/test-vddk-real.sh | 2 +- tests/test-vddk-reexec.sh | 4 +-- tests/test-vddk-run.sh | 2 +- tests/test-zero.sh | 2 +- 133 files changed, 232 insertions(+), 232 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index e69893e0d..2b67e17d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -116,7 +116,7 @@ disk: rm -rf disk.tmp $@ $@-t mkdir disk.tmp echo -n "hello,world" > disk.tmp/hello.txt - $(top_builddir)/nbdkit$(EXEEXT) -fv -U - linuxdisk disk.tmp size=100M \ + $(top_builddir)/nbdkit$(EXEEXT) -fv linuxdisk disk.tmp size=100M \ --run 'qemu-img convert $$nbd $@-t' rm -rf disk.tmp mv $@-t $@ diff --git a/plugins/rust/test-ramdisk.sh b/plugins/rust/test-ramdisk.sh index 430ee5190..781461860 100755 --- a/plugins/rust/test-ramdisk.sh +++ b/plugins/rust/test-ramdisk.sh @@ -52,8 +52,8 @@ requires test -x $ramdisk requires_nbdinfo requires_nbdsh_uri -nbdkit -fv -U - $ramdisk size=10M --run 'nbdinfo "$uri"' -nbdkit -fv -U - $ramdisk size=10M \ +nbdkit -fv $ramdisk size=10M --run 'nbdinfo "$uri"' +nbdkit -fv $ramdisk size=10M \ --run ' nbdsh -u "$uri" \ -c "buf = b\"1234\"*1024" \ diff --git a/tests/test-S3.sh b/tests/test-S3.sh index 047c931ca..5931ccec5 100755 --- a/tests/test-S3.sh +++ b/tests/test-S3.sh @@ -51,7 +51,7 @@ rm -f $file cleanup_fn rm -f $file # The fake module checks the parameters have these particular values. -nbdkit -U - S3 \ +nbdkit S3 \ access-key=TEST_ACCESS_KEY \ secret-key=TEST_SECRET_KEY \ session-token=TEST_SESSION_TOKEN \ diff --git a/tests/test-blkio.sh b/tests/test-blkio.sh index 31896ad96..97c955245 100755 --- a/tests/test-blkio.sh +++ b/tests/test-blkio.sh @@ -45,7 +45,7 @@ requires_nbdsh_uri requires test -f disk requires_linux_kernel_version 6.0 -nbdkit -U - -r blkio io_uring path=disk \ +nbdkit -r blkio io_uring path=disk \ --run ' nbdsh -u "$uri" \ -c "import os" \ diff --git a/tests/test-block-size-constraints.sh b/tests/test-block-size-constraints.sh index 692a918e9..a44d7e5fe 100755 --- a/tests/test-block-size-constraints.sh +++ b/tests/test-block-size-constraints.sh @@ -41,7 +41,7 @@ requires_nbdsh_uri # Create an nbdkit eval plugin which presents block size constraints. # Check the advertised block size constraints can be read. -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --run 'nbdsh \ diff --git a/tests/test-blocksize-default.sh b/tests/test-blocksize-default.sh index c5df88bfb..fe6eafe5a 100755 --- a/tests/test-blocksize-default.sh +++ b/tests/test-blocksize-default.sh @@ -71,7 +71,7 @@ assert hb.pread(1024 * 1024 + 1, 1) == b"\0" * (1024 * 1024 + 1) ha.shutdown() hb.shutdown() ' -nbdkit -v -U - --filter=blocksize eval \ +nbdkit -v --filter=blocksize eval \ open='echo $3' \ get_size="echo $((2 * 1024 * 1024 - 1))" \ block_size='case $2 in diff --git a/tests/test-blocksize-error-policy.sh b/tests/test-blocksize-error-policy.sh index 44e9fd5cc..d1c49a4e0 100755 --- a/tests/test-blocksize-error-policy.sh +++ b/tests/test-blocksize-error-policy.sh @@ -41,7 +41,7 @@ requires nbdsh -c 'print(h.get_strict_mode)' requires_nbdsh_uri requires dd iflag=count_bytes </dev/null -nbdkit -v -U - eval \ +nbdkit -v eval \ block_size="echo 512 4096 1M" \ get_size="echo 64M" \ pread=" dd if=/dev/zero count=\$3 iflag=count_bytes " \ diff --git a/tests/test-blocksize-extents.sh b/tests/test-blocksize-extents.sh index 3fc452158..9b38a9ede 100755 --- a/tests/test-blocksize-extents.sh +++ b/tests/test-blocksize-extents.sh @@ -100,6 +100,6 @@ assert entries == [(1, 0), (1, 3)] ' # Now run everything -nbdkit -U - --filter=blocksize eval minblock=4k maxlen=32k \ +nbdkit --filter=blocksize eval minblock=4k maxlen=32k \ get_size='echo 64k' pread='exit 1' extents="$exts" \ --run 'nbdsh --base-allocation -u "$uri" -c "$script"' diff --git a/tests/test-blocksize-policy.sh b/tests/test-blocksize-policy.sh index 0b4895bd1..046913f8c 100755 --- a/tests/test-blocksize-policy.sh +++ b/tests/test-blocksize-policy.sh @@ -43,7 +43,7 @@ requires_nbdsh_uri # using some nbdsh. # No parameters. -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --filter=blocksize-policy \ @@ -55,7 +55,7 @@ nbdkit -U - eval \ ' # Adjust single values. -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --filter=blocksize-policy \ @@ -66,7 +66,7 @@ nbdkit -U - eval \ -c "assert h.get_block_size(nbd.SIZE_PREFERRED) == 128 * 1024" \ -c "assert h.get_block_size(nbd.SIZE_MAXIMUM) == 32 * 1024 * 1024" \ ' -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --filter=blocksize-policy \ @@ -77,7 +77,7 @@ nbdkit -U - eval \ -c "assert h.get_block_size(nbd.SIZE_PREFERRED) == 64 * 1024" \ -c "assert h.get_block_size(nbd.SIZE_MAXIMUM) == 32 * 1024 * 1024" \ ' -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --filter=blocksize-policy \ @@ -90,7 +90,7 @@ nbdkit -U - eval \ ' # Adjust all values for a plugin which is advertising. -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --filter=blocksize-policy \ @@ -105,7 +105,7 @@ nbdkit -U - eval \ ' # Set all values for a plugin which is not advertising. -nbdkit -U - eval \ +nbdkit eval \ get_size="echo 0" \ --filter=blocksize-policy \ blocksize-minimum=1 \ diff --git a/tests/test-blocksize-sharding.sh b/tests/test-blocksize-sharding.sh index e3251e70b..7e926ad14 100755 --- a/tests/test-blocksize-sharding.sh +++ b/tests/test-blocksize-sharding.sh @@ -156,7 +156,7 @@ assert t >= 8 # Now run everything $TRUNCATE -s 16 blocksize-sharding.img export witness="$PWD/blocksize-sharding.tmp" -nbdkit -U - --filter=blocksize --filter=delay eval delay-write=2 \ +nbdkit --filter=blocksize --filter=delay eval delay-write=2 \ config='ln -sf "$(realpath "$3")" $tmpdir/$2' \ img="$PWD/blocksize-sharding.img" tmp="$PWD/blocksize-sharding.tmp" \ get_size='echo 16' block_size='echo 16 64K 1M' \ diff --git a/tests/test-blocksize-write-disconnect.sh b/tests/test-blocksize-write-disconnect.sh index ff8991fab..04a2be996 100755 --- a/tests/test-blocksize-write-disconnect.sh +++ b/tests/test-blocksize-write-disconnect.sh @@ -49,7 +49,7 @@ requires dd iflag=count_bytes </dev/null # 32M+1 to 64M kill the connection (ENOTCONN visible to client), and # 64M+1 and above fails with ERANGE in libnbd. -nbdkit -v -U - eval \ +nbdkit -v eval \ block_size="echo 2 4096 16M" \ get_size="echo 64M" \ pread=' dd if=/dev/zero count=$3 iflag=count_bytes ' \ diff --git a/tests/test-captive-tls.sh b/tests/test-captive-tls.sh index 5787e7248..3deb2f6be 100755 --- a/tests/test-captive-tls.sh +++ b/tests/test-captive-tls.sh @@ -65,7 +65,7 @@ cleanup_fn rm -f $out rm -f $out LANG=C \ -nbdkit -U - --tls=require --tls-certificates="$pkidir" \ +nbdkit --tls=require --tls-certificates="$pkidir" \ -D nbdkit.tls.session=1 \ null \ --run '[ "x$tls" = "x2" ] && nbdinfo "$uri"' > $out diff --git a/tests/test-captive.sh b/tests/test-captive.sh index 6421892d0..0a886229d 100755 --- a/tests/test-captive.sh +++ b/tests/test-captive.sh @@ -60,7 +60,7 @@ fi # Check that a failed --run process affects exit status status=0 -nbdkit -U - example1 --run 'exit 2' > captive.out || status=$? +nbdkit example1 --run 'exit 2' > captive.out || status=$? if test $status != 2; then echo "$0: unexpected exit status $status" fail=1 @@ -73,7 +73,7 @@ fi # Check that nbdkit death from unhandled signal affects exit status. status=0 -nbdkit -U - -P captive.pid example1 --run ' +nbdkit -P captive.pid example1 --run ' for i in {1..60}; do if test -s captive.pid; then break; fi sleep 1 diff --git a/tests/test-cc-cpp.sh b/tests/test-cc-cpp.sh index c5751dcf9..ebbdab31d 100755 --- a/tests/test-cc-cpp.sh +++ b/tests/test-cc-cpp.sh @@ -53,7 +53,7 @@ out=test-cc-cpp.out cleanup_fn rm -f $out rm -f $out -nbdkit -U - cc $script \ +nbdkit cc $script \ CC="$CXX" \ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \ --run 'nbdinfo --size $uri' > $out diff --git a/tests/test-cc-ocaml.sh b/tests/test-cc-ocaml.sh index c17d0c23c..68972fce0 100755 --- a/tests/test-cc-ocaml.sh +++ b/tests/test-cc-ocaml.sh @@ -56,7 +56,7 @@ out=test-cc-ocaml.out cleanup_fn rm -f $out rm -f $out -nbdkit -v -U - cc $script a=1 b=2 c=3 d=4 \ +nbdkit -v cc $script a=1 b=2 c=3 d=4 \ CC="$OCAMLOPT" CFLAGS="-output-obj -runtime-variant _pic -I $abs_top_srcdir/plugins/ocaml $OCAML_PLUGIN_LIBRARIES NBDKit.cmx -cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml" \ --run 'nbdinfo --size $uri' > $out test "$(cat $out)" -eq $((512 * 2048)) diff --git a/tests/test-cc.sh b/tests/test-cc.sh index f4f5644b7..2646704be 100755 --- a/tests/test-cc.sh +++ b/tests/test-cc.sh @@ -52,7 +52,7 @@ out=test-cc.out cleanup_fn rm -f $out rm -f $out -nbdkit -U - cc $script \ +nbdkit cc $script \ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \ --run 'nbdinfo --size $uri' > $out test "$(cat $out)" -eq $((100 * 1024 * 1024)) diff --git a/tests/test-checkwrite-bounds.sh b/tests/test-checkwrite-bounds.sh index 1f4d28740..9ad93b3fe 100755 --- a/tests/test-checkwrite-bounds.sh +++ b/tests/test-checkwrite-bounds.sh @@ -43,7 +43,7 @@ requires nbdsh --version requires_nbdsh_uri requires dd iflag=count_bytes </dev/null -nbdkit -U - sh - --filter=checkwrite <<'EOF' \ +nbdkit sh - --filter=checkwrite <<'EOF' \ --run 'nbdsh -u "$uri" -c "h.zero (655360, 262144, 0)"' case "$1" in get_size) echo 1048576 ;; diff --git a/tests/test-checkwrite.sh b/tests/test-checkwrite.sh index 8b1219dd9..7c5cb35ee 100755 --- a/tests/test-checkwrite.sh +++ b/tests/test-checkwrite.sh @@ -45,7 +45,7 @@ requires_libnbd_version 1.5.9 do_test () { - nbdkit -U - -v --filter=checkwrite "$@" --run 'nbdcopy "$uri" "$uri"' + nbdkit -v --filter=checkwrite "$@" --run 'nbdcopy "$uri" "$uri"' } # Tests zero-sized disk. diff --git a/tests/test-cow-block-size.sh b/tests/test-cow-block-size.sh index e6852d8d6..a10757388 100755 --- a/tests/test-cow-block-size.sh +++ b/tests/test-cow-block-size.sh @@ -49,7 +49,7 @@ cleanup_fn rm -f $files rm -rf cow-block-size.d mkdir cow-block-size.d cleanup_fn rm -rf cow-block-size.d -nbdkit -fv -U - linuxdisk cow-block-size.d size=100M \ +nbdkit -fv linuxdisk cow-block-size.d size=100M \ --run 'nbdcopy "$uri" cow-block-size-base.img' lastmod="$($STAT -c "%y" cow-block-size-base.img)" diff --git a/tests/test-cow-extents-large.sh b/tests/test-cow-extents-large.sh index 3c0e50ee1..3db835978 100755 --- a/tests/test-cow-extents-large.sh +++ b/tests/test-cow-extents-large.sh @@ -48,5 +48,5 @@ if ! nbdinfo --help | grep -- --map ; then fi for size in 0 3G 4G 5G 8G; do - nbdkit -U - sparse-random $size --filter=cow --run 'nbdinfo --map $uri' + nbdkit sparse-random $size --filter=cow --run 'nbdinfo --map $uri' done diff --git a/tests/test-cow-null.sh b/tests/test-cow-null.sh index 9a06ff81d..0de144d75 100755 --- a/tests/test-cow-null.sh +++ b/tests/test-cow-null.sh @@ -40,4 +40,4 @@ set -x requires_run requires_nbdinfo -nbdkit -fv -U - --filter=cow null --run 'nbdinfo $nbd' +nbdkit -fv --filter=cow null --run 'nbdinfo $nbd' diff --git a/tests/test-cow.sh b/tests/test-cow.sh index 5b137ff4d..700ad8f1a 100755 --- a/tests/test-cow.sh +++ b/tests/test-cow.sh @@ -50,7 +50,7 @@ cleanup_fn rm -f $files rm -rf cow.d mkdir cow.d cleanup_fn rm -rf cow.d -nbdkit -fv -U - linuxdisk cow.d size=100M \ +nbdkit -fv linuxdisk cow.d size=100M \ --run 'nbdcopy "$uri" cow-base.img' lastmod="$($STAT -c "%y" cow-base.img)" diff --git a/tests/test-curl-file.sh b/tests/test-curl-file.sh index 0269768ed..c87b00388 100755 --- a/tests/test-curl-file.sh +++ b/tests/test-curl-file.sh @@ -78,7 +78,7 @@ for opt in \ user=alice \ user-agent="Mozilla/1" do - nbdkit -fv -D curl.verbose=1 -U - \ + nbdkit -fv -D curl.verbose=1 \ curl file:$PWD/disk protocols=file "$opt" \ --run 'nbdinfo $nbd' done diff --git a/tests/test-curl-header-script-fail.sh b/tests/test-curl-header-script-fail.sh index 1bd5f3dba..cf9614f96 100755 --- a/tests/test-curl-header-script-fail.sh +++ b/tests/test-curl-header-script-fail.sh @@ -48,7 +48,7 @@ rm -f $errors cleanup_fn rm -f $errors # This command is expected to fail. -nbdkit -rfv -U - \ +nbdkit -rfv \ curl file:$PWD/disk protocols=file \ header-script=$PWD/test-curl-header-script-fail.script \ --run 'nbdinfo --no-content $uri' >$errors 2>&1 ||: diff --git a/tests/test-data-bad.sh b/tests/test-data-bad.sh index 5194cfe9f..f327578e0 100755 --- a/tests/test-data-bad.sh +++ b/tests/test-data-bad.sh @@ -46,7 +46,7 @@ bad () data="$1" # This command is expected to fail. - if nbdkit -U - -fv -D data.AST=1 data "$data" --run true; then + if nbdkit -fv -D data.AST=1 data "$data" --run true; then echo "$0: data plugin was expected to fail on bad input: $data" exit 1 fi diff --git a/tests/test-data-extents.sh b/tests/test-data-extents.sh index 56c70b6ab..b7e681315 100755 --- a/tests/test-data-extents.sh +++ b/tests/test-data-extents.sh @@ -52,7 +52,7 @@ cleanup_fn rm -f $files do_test () { # We use jq to normalize the output and convert it to plain text. - nbdkit -U - data "$1" size="$2" \ + nbdkit data "$1" size="$2" \ --run 'qemu-img map -f raw --output=json $nbd' | jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ > $out diff --git a/tests/test-data-format.sh b/tests/test-data-format.sh index 8bec76492..59f2b102b 100755 --- a/tests/test-data-format.sh +++ b/tests/test-data-format.sh @@ -56,7 +56,7 @@ do_test () shift 2 for allocator in $allocators; do - nbdkit -U - -v -D data.AST=1 \ + nbdkit -v -D data.AST=1 \ data "$data" \ allocator=$allocator "$@" \ --run ' @@ -290,7 +290,7 @@ unset b unset c # Unknown variable should fail. -if nbdkit -U - data ' $a $b $c ' --run 'exit 0'; then +if nbdkit data ' $a $b $c ' --run 'exit 0'; then echo "$0: expected unknown variables to fail" exit 1 fi @@ -323,13 +323,13 @@ do_test ' $a $b $c ' 'b"\1\2\3\4\5\5\5\5\5"' \ a=' 1 2 ' b=' 3 4 ' c=' $d*5 ' d=' 5 ' # Badly formatted variable should fail. -if nbdkit -U - data ' $a ' a='NONSENSE' --run 'exit 0'; then +if nbdkit data ' $a ' a='NONSENSE' --run 'exit 0'; then echo "$0: expected unknown variables to fail" exit 1 fi # Using an extra parameter without data= should fail. -if nbdkit -U - data raw='' a='NONSENSE' --run 'exit 0'; then +if nbdkit data raw='' a='NONSENSE' --run 'exit 0'; then echo "$0: expected extra params to fail with !data" exit 1 fi diff --git a/tests/test-data-optimum.sh b/tests/test-data-optimum.sh index 865c5bc8a..cbb0bd98e 100755 --- a/tests/test-data-optimum.sh +++ b/tests/test-data-optimum.sh @@ -52,7 +52,7 @@ do_test () data="$1" expected_AST="$2" - nbdkit -U - -fv -D data.AST=1 data "$data" --run true >$log 2>&1 + nbdkit -fv -D data.AST=1 data "$data" --run true >$log 2>&1 # Collect up all lines of debug output containing the AST # and concatenate them into a single string. diff --git a/tests/test-data-partition.sh b/tests/test-data-partition.sh index 99a8fdfbb..c38d008d2 100755 --- a/tests/test-data-partition.sh +++ b/tests/test-data-partition.sh @@ -45,7 +45,7 @@ out=data-partition.out rm -f $out cleanup_fn rm -f $out -nbdkit -U - --filter=partition data partition=1 size=1M ' +nbdkit --filter=partition data partition=1 size=1M ' @0x1be # MBR first partition entry 0 # Partition status 0 2 0 # CHS start diff --git a/tests/test-data-raw-copy.sh b/tests/test-data-raw-copy.sh index c81257122..6903c8ec9 100755 --- a/tests/test-data-raw-copy.sh +++ b/tests/test-data-raw-copy.sh @@ -44,7 +44,7 @@ out=test-data-raw-copy.out cleanup_fn rm -f $out rm -f $out -nbdkit -U - data raw='Hello, world!' --run \ +nbdkit data raw='Hello, world!' --run \ 'nbdcopy "$uri" -' > $out if [ "$(cat $out)" != 'Hello, world!' ]; then diff --git a/tests/test-data-reloffset.sh b/tests/test-data-reloffset.sh index 2782d48c6..12e1f4d0c 100755 --- a/tests/test-data-reloffset.sh +++ b/tests/test-data-reloffset.sh @@ -46,11 +46,11 @@ cleanup_fn rm -f $out # A series of relative offset moves should result in a # final disk size we can check. -nbdkit -v -U - data '@+10 @-5 @-4 @+20' --run 'nbdinfo --size "$uri"' > $out +nbdkit -v data '@+10 @-5 @-4 @+20' --run 'nbdinfo --size "$uri"' > $out test "$(cat $out)" -eq 21 # Trying to move negative should be an error. -if nbdkit -v -U - data '@+10 @-11' --run 'exit 0' ; then +if nbdkit -v data '@+10 @-11' --run 'exit 0' ; then echo "$0: expected error" exit 1 fi diff --git a/tests/test-data-size.sh b/tests/test-data-size.sh index 285ba6cff..7a6bd712b 100755 --- a/tests/test-data-size.sh +++ b/tests/test-data-size.sh @@ -48,7 +48,7 @@ size () expected_size="$2" size="$( - nbdkit -U - -fv -D data.AST=1 data "$data" --run 'nbdinfo --size "$uri"' + nbdkit -fv -D data.AST=1 data "$data" --run 'nbdinfo --size "$uri"' )" if [ "$size" -ne "$expected_size" ]; then echo "$0: data has unexpected size: $data" diff --git a/tests/test-debug-flags.sh b/tests/test-debug-flags.sh index 51358f360..4ae8cd4f8 100755 --- a/tests/test-debug-flags.sh +++ b/tests/test-debug-flags.sh @@ -47,7 +47,7 @@ rm -f $files cleanup_fn rm -f $files # This should work and show the "extra debugging" line in debug output. -nbdkit -U - -f -v -D example2.extra=1 example2 file=disk \ +nbdkit -f -v -D example2.extra=1 example2 file=disk \ --run 'nbdinfo "$uri"' 2>debug-flags.out cat debug-flags.out if ! grep -sq 'extra debugging:' debug-flags.out ; then @@ -83,33 +83,33 @@ check_warning () # This is expected to fail because we didn't set the file= parameter, # but it should not fail because of the debug flag. -nbdkit -U - -f -D example2.extra=1 example2 2>debug-flags.out && expected_failure +nbdkit -f -D example2.extra=1 example2 2>debug-flags.out && expected_failure check_error "you must supply the file=" # This should fail because we didn't set the file= parameter, but it # should also print a warning about the unknown -D flag. -nbdkit -U - -f -D example2.unknown=1 example2 2>debug-flags.out && expected_failure +nbdkit -f -D example2.unknown=1 example2 2>debug-flags.out && expected_failure check_error "you must supply the file=" check_warning "does not contain a global variable called example2_debug_unknown" # This should fail because we didn't set the file= parameter, but it # should also print a warning because the -D flag is unused. -nbdkit -U - -f -D example1.foo=1 example2 2>debug-flags.out && expected_failure +nbdkit -f -D example1.foo=1 example2 2>debug-flags.out && expected_failure check_error "you must supply the file=" check_warning "was not used" # These should fail because the -D flag has a bad format. -nbdkit -U - -f -D = example2 2>debug-flags.out && expected_failure +nbdkit -f -D = example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D . example2 2>debug-flags.out && expected_failure +nbdkit -f -D . example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D =. example2 2>debug-flags.out && expected_failure +nbdkit -f -D =. example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D .= example2 2>debug-flags.out && expected_failure +nbdkit -f -D .= example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D .extra=1 example2 2>debug-flags.out && expected_failure +nbdkit -f -D .extra=1 example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D example2.=1 example2 2>debug-flags.out && expected_failure +nbdkit -f -D example2.=1 example2 2>debug-flags.out && expected_failure check_error "must have the format" -nbdkit -U - -f -D example2.extra= example2 2>debug-flags.out && expected_failure +nbdkit -f -D example2.extra= example2 2>debug-flags.out && expected_failure check_error "must have the format" diff --git a/tests/test-delay-close.sh b/tests/test-delay-close.sh index a7a0e3695..0af03f8e1 100755 --- a/tests/test-delay-close.sh +++ b/tests/test-delay-close.sh @@ -41,7 +41,7 @@ requires_nbdsh_uri # Test delay-close with a well-behaved client. -nbdkit -U - null --filter=delay delay-close=3 \ +nbdkit null --filter=delay delay-close=3 \ --run ' start_t=$(date +%s) nbdsh -u "$uri" -c "h.shutdown()" diff --git a/tests/test-delay-open.sh b/tests/test-delay-open.sh index a8933ce98..9d3bd4409 100755 --- a/tests/test-delay-open.sh +++ b/tests/test-delay-open.sh @@ -40,7 +40,7 @@ requires_filter delay requires_nbdinfo start_t=$SECONDS -nbdkit -U - null --filter=delay delay-open=3 --run 'nbdinfo "$uri"' +nbdkit null --filter=delay delay-open=3 --run 'nbdinfo "$uri"' end_t=$SECONDS if [ $((end_t - start_t)) -lt 3 ]; then diff --git a/tests/test-disk2data.sh b/tests/test-disk2data.sh index 2644b9d1e..80b623599 100755 --- a/tests/test-disk2data.sh +++ b/tests/test-disk2data.sh @@ -103,7 +103,7 @@ hexdump -C $disk $disk2data $disk > $cmd # Modify the generated nbdkit command. -$SED -i -e $'s/^nbdkit /nbdkit -U - --run \'nbdcopy "$uri" -\' /' $cmd +$SED -i -e $'s/^nbdkit /nbdkit --run \'nbdcopy "$uri" -\' /' $cmd chmod +x $cmd cat $cmd diff --git a/tests/test-eflags.sh b/tests/test-eflags.sh index 4972c6260..ba74ef5ce 100755 --- a/tests/test-eflags.sh +++ b/tests/test-eflags.sh @@ -81,7 +81,7 @@ do_nbdkit () else touch $tmpdir/seen_$1 fi - '; cat; } | nbdkit -v -U - "$@" sh - $late_args \ + '; cat; } | nbdkit -v "$@" sh - $late_args \ --run 'qemu-nbd --list -k $unixsocket' | grep -E "flags: 0x" | grep -Eoi '0x[a-f0-9]+' >eflags.out 2>eflags.err printf eflags=; cat eflags.out diff --git a/tests/test-eval-cache.sh b/tests/test-eval-cache.sh index fb3fc884a..555149ddd 100755 --- a/tests/test-eval-cache.sh +++ b/tests/test-eval-cache.sh @@ -74,7 +74,7 @@ buf = h.pread(64 * 1024 * 1024, 64 * 1024 * 1024) if hasattr(buf, "is_zero"): assert buf.is_zero() ' -nbdkit -U - -v eval \ +nbdkit -v eval \ get_size='echo 128M' can_cache='echo emulate' open='touch "$cache"' \ pread=' if test -f "$witness"; then @@ -86,7 +86,7 @@ nbdkit -U - -v eval \ ' --run 'nbdsh -u "$uri" -c "$script"' # This plugin provides .cache but not .can_cache; eval should synthesize one. -nbdkit -U - -v eval \ +nbdkit -v eval \ get_size='echo 1M' cache='exit 0' pread='echo EIO >&2; exit 1' \ --run 'nbdsh -u "$uri" -c "assert h.can_cache()" \ -c "h.cache(1024*1024, 0)"' diff --git a/tests/test-eval-exports.sh b/tests/test-eval-exports.sh index acb04bc63..6294632cc 100755 --- a/tests/test-eval-exports.sh +++ b/tests/test-eval-exports.sh @@ -52,7 +52,7 @@ fail=0 # Control case: no .list_exports, which defaults to advertising "" rm -f eval-exports.list -nbdkit -U - -v eval \ +nbdkit -v eval \ open='[ "$3" = "" ] || { echo EINVAL wrong export >&2; exit 1; }' \ get_size='echo 0' --run 'nbdinfo --list --json "$uri"' > eval-exports.out cat eval-exports.out @@ -95,12 +95,12 @@ except nbd.Error: nbdsh -u nbd+unix:///name\?socket=$sock -c 'quit()' # Setting .default_export but not .list_exports advertises the canonical name -nbdkit -U - eval default_export='echo hello' get_size='echo 0' \ +nbdkit eval default_export='echo hello' get_size='echo 0' \ --run 'nbdinfo --list "$uri"' >eval-exports.out diff -u <(grep '^export=' eval-exports.out) <(echo 'export="hello":') # Failing .default_export without .list_exports results in an empty list -nbdkit -U - eval default_export='echo ENOENT >&2; exit 1' get_size='echo 0' \ +nbdkit eval default_export='echo ENOENT >&2; exit 1' get_size='echo 0' \ --run 'nbdinfo --list "$uri"' >eval-exports.out diff -u <(grep '^export=' eval-exports.out) /dev/null @@ -151,7 +151,7 @@ echo $long >>eval-exports.list do_nbdkit $long "[[\"$long\",\"$long\",4097]]" # Invalid name (too long) causes an error response to NBD_OPT_LIST -nbdkit -U - -v eval list_exports="echo 2$long" \ +nbdkit -v eval list_exports="echo 2$long" \ get_size='echo 0' --run 'nbdinfo --list --json "$uri"' && fail=1 exit $fail diff --git a/tests/test-eval-file.sh b/tests/test-eval-file.sh index ad787a88d..a1e415a72 100755 --- a/tests/test-eval-file.sh +++ b/tests/test-eval-file.sh @@ -50,7 +50,7 @@ cleanup_fn rm -f $files cp disk eval-file.img export STAT -nbdkit -fv -U - eval \ +nbdkit -fv eval \ config='ln -sf "$(realpath "$3")" $tmpdir/file' \ get_size='$STAT -Lc %s $tmpdir/file' \ pread='dd if=$tmpdir/file skip=$4 count=$3 iflag=count_bytes,skip_bytes' \ diff --git a/tests/test-eval.sh b/tests/test-eval.sh index 6493ba61d..583d198e3 100755 --- a/tests/test-eval.sh +++ b/tests/test-eval.sh @@ -47,7 +47,7 @@ cleanup_fn rm -f $files # method really runs. Otherwise there is a race where the connection # is dropped by nbdinfo, the --run command exits, a signal is sent to # nbdkit, and nbdkit shuts down before the .close callback is called. -nbdkit -U - eval \ +nbdkit eval \ get_size='echo 64M' \ pread='dd if=/dev/zero count=$3 iflag=count_bytes' \ missing='echo "in missing: $@" >> eval.missing; exit 2' \ diff --git a/tests/test-evil-cosmic.sh b/tests/test-evil-cosmic.sh index 50619966e..71107ef89 100755 --- a/tests/test-evil-cosmic.sh +++ b/tests/test-evil-cosmic.sh @@ -55,7 +55,7 @@ cleanup_fn rm -f $f # might be biased. export f -nbdkit -U - null 10000000 \ +nbdkit null 10000000 \ --filter=evil --filter=noextents \ evil=cosmic-rays evil-probability=1/800000 \ --run 'nbdcopy "$uri" $f' diff --git a/tests/test-evil-large-p.sh b/tests/test-evil-large-p.sh index e9a25b3fc..eee3c631d 100755 --- a/tests/test-evil-large-p.sh +++ b/tests/test-evil-large-p.sh @@ -43,14 +43,14 @@ requires_filter noextents requires_nbdcopy_null_output # This is the largest probability we support. -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=1/8 \ --run 'nbdcopy "$uri" null:' # Anything larger is treated as 100%. -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=0.5 \ --run 'nbdcopy "$uri" null:' -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=1.0 \ --run 'nbdcopy "$uri" null:' diff --git a/tests/test-evil-small-p.sh b/tests/test-evil-small-p.sh index 5f2956147..0c3c2b23f 100755 --- a/tests/test-evil-small-p.sh +++ b/tests/test-evil-small-p.sh @@ -43,16 +43,16 @@ requires_filter noextents requires_nbdcopy_null_output # Check absence of divide by zero errors. -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=0 \ --run 'nbdcopy "$uri" null:' # Smallest valid probability. -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=1e-12 \ --run 'nbdcopy "$uri" null:' # Should be treated same as P = 0. -nbdkit -U - -fv null 1M \ +nbdkit -fv null 1M \ --filter=evil --filter=noextents evil-probability=1e-13 \ --run 'nbdcopy "$uri" null:' diff --git a/tests/test-exportname.sh b/tests/test-exportname.sh index 606a0e998..771ec7a12 100755 --- a/tests/test-exportname.sh +++ b/tests/test-exportname.sh @@ -72,54 +72,54 @@ EOF chmod +x exportname.sh # Establish a baseline -nbdkit -U - sh exportname.sh \ +nbdkit sh exportname.sh \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = \ '[["a","x",1],["b","y",2],["c","z",3]]' # Set the default export -nbdkit -U - --filter=exportname sh exportname.sh default-export= \ +nbdkit --filter=exportname sh exportname.sh default-export= \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[["","1",1]]' -nbdkit -U - --filter=exportname sh exportname.sh default-export=b \ +nbdkit --filter=exportname sh exportname.sh default-export=b \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[["b","2",2]]' # Test export list policies -nbdkit -U - --filter=exportname sh exportname.sh exportname-list=keep \ +nbdkit --filter=exportname sh exportname.sh exportname-list=keep \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = \ '[["a","x",1],["b","y",2],["c","z",3]]' -nbdkit -U - --filter=exportname sh exportname.sh exportname-list=error \ +nbdkit --filter=exportname sh exportname.sh exportname-list=error \ --run 'nbdinfo --json --list "$uri"' > exportname.out && fail=1 || : test ! -s exportname.out -nbdkit -U - --filter=exportname sh exportname.sh exportname-list=empty \ +nbdkit --filter=exportname sh exportname.sh exportname-list=empty \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[]' -nbdkit -U - --filter=exportname sh exportname.sh exportname-list=defaultonly \ +nbdkit --filter=exportname sh exportname.sh exportname-list=defaultonly \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out got="$(jq -c "$query" exportname.out)" # libnbd 1.4.0 and 1.4.1 differ on whether --list grabs description test "$got" = '[["a",null,1]]' || test "$got" = '[["a","1",1]]' || fail=1 -nbdkit -U - --filter=exportname sh exportname.sh default-export=b \ +nbdkit --filter=exportname sh exportname.sh default-export=b \ exportname-list=defaultonly exportname=a exportname=b \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out got="$(jq -c "$query" exportname.out)" test "$got" = '[["b",null,2]]' || test "$got" = '[["b","2",2]]' || fail=1 -nbdkit -U - --filter=exportname sh exportname.sh \ +nbdkit --filter=exportname sh exportname.sh \ exportname-list=explicit exportname=b exportname=a \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out @@ -127,31 +127,31 @@ got="$(jq -c "$query" exportname.out)" test "$got" = '[["a",null,1],["b",null,2]]' || test "$got" = '[["a","1",1],["b","2",2]]' || fail=1 -nbdkit -U - --filter=exportname sh exportname.sh exportname-list=explicit \ +nbdkit --filter=exportname sh exportname.sh exportname-list=explicit \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[]' # Test description modes with lists -nbdkit -U - --filter=exportname sh exportname.sh exportdesc=keep \ +nbdkit --filter=exportname sh exportname.sh exportdesc=keep \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = \ '[["a","x",1],["b","y",2],["c","z",3]]' -nbdkit -U - --filter=exportname sh exportname.sh exportdesc=none \ +nbdkit --filter=exportname sh exportname.sh exportdesc=none \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = \ '[["a",null,1],["b",null,2],["c",null,3]]' -nbdkit -U - --filter=exportname sh exportname.sh exportdesc=fixed:hi \ +nbdkit --filter=exportname sh exportname.sh exportdesc=fixed:hi \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = \ '[["a","hi",1],["b","hi",2],["c","hi",3]]' -nbdkit -U - --filter=exportname sh exportname.sh \ +nbdkit --filter=exportname sh exportname.sh \ exportdesc=script:'echo $name$name' \ --run 'nbdinfo --json --list "$uri"' > exportname.out cat exportname.out @@ -159,12 +159,12 @@ test "$(jq -c "$query" exportname.out)" = \ '[["a","aa",1],["b","bb",2],["c","cc",3]]' # Test description modes with connections -nbdkit -U - -e c --filter=exportname sh exportname.sh exportdesc=fixed:hi \ +nbdkit -e c --filter=exportname sh exportname.sh exportdesc=fixed:hi \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[["c","hi",3]]' -nbdkit -U - -e c --filter=exportname sh exportname.sh \ +nbdkit -e c --filter=exportname sh exportname.sh \ exportdesc=script:'echo $name$name' \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out @@ -172,7 +172,7 @@ test "$(jq -c "$query" exportname.out)" = '[["c","cc",3]]' # Test strict mode. Tolerate nbdinfo 1.6.2 which gave invalid JSON but 0 status st=0 -nbdkit -U - --filter=exportname sh exportname.sh exportname-strict=true \ +nbdkit --filter=exportname sh exportname.sh exportname-strict=true \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out || st=$? cat exportname.out if test $? = 0; then @@ -180,7 +180,7 @@ if test $? = 0; then fi st=0 -nbdkit -U - --filter=exportname sh exportname.sh exportname-strict=true \ +nbdkit --filter=exportname sh exportname.sh exportname-strict=true \ exportname=a exportname=b exportname=c \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out || st=$? cat exportname.out @@ -188,13 +188,13 @@ if test $? = 0; then test -s exportname.out && jq -c "$query" exportname.out && fail=1 fi -nbdkit -U - --filter=exportname sh exportname.sh exportname-strict=true \ +nbdkit --filter=exportname sh exportname.sh exportname-strict=true \ exportname=a exportname=b exportname= default-export=a\ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out test "$(jq -c "$query" exportname.out)" = '[["a","1",1]]' -nbdkit -U - -e a --filter=exportname sh exportname.sh exportname-strict=true \ +nbdkit -e a --filter=exportname sh exportname.sh exportname-strict=true \ exportname=a exportname=b exportname=c \ --run 'nbdinfo --no-content --json "$uri"' > exportname.out cat exportname.out diff --git a/tests/test-extentlist.sh b/tests/test-extentlist.sh index 2e5aa93be..ed0d81622 100755 --- a/tests/test-extentlist.sh +++ b/tests/test-extentlist.sh @@ -51,7 +51,7 @@ cleanup_fn rm $files test () { nbdkit -v -D extentlist.lookup=1 \ - -r -U - \ + -r \ --filter=extentlist \ null size=$1 extentlist=$input \ --run 'qemu-img map -f raw --output=json $nbd' | diff --git a/tests/test-file-dir.sh b/tests/test-file-dir.sh index 98a5e77e1..39be82d4e 100755 --- a/tests/test-file-dir.sh +++ b/tests/test-file-dir.sh @@ -63,7 +63,7 @@ do_nbdkit_list () sort shift fi - nbdkit -U - -v file directory=file-dir \ + nbdkit -v file directory=file-dir \ --run 'nbdinfo --list --json "$uri"' >file-dir.out cat file-dir.out diff -u <(jq -c '[.exports[]."export-name"]'"$sort" file-dir.out) \ @@ -83,7 +83,7 @@ except nbd.Error: # Check that attempting to connect to export NAME fails do_nbdkit_fail () { - nbdkit -U - -v -e "$1" file dir=file-dir \ + nbdkit -v -e "$1" file dir=file-dir \ --run 'export uri; nbdsh -c "$nbdsh_connect_fail_script"' || fail=1 } @@ -91,7 +91,7 @@ do_nbdkit_fail () # Check that export NAME serves DATA as its first byte do_nbdkit_pass () { - out=$(nbdkit -U - -v -e "$1" file dir=file-dir \ + out=$(nbdkit -v -e "$1" file dir=file-dir \ --run 'nbdsh -u "$uri" -c "print(h.pread(1, 0).decode(\"utf-8\"))"') test "$out" = "$2" || fail=1 } diff --git a/tests/test-file-extents.sh b/tests/test-file-extents.sh index e3900b0a7..ec29717f6 100755 --- a/tests/test-file-extents.sh +++ b/tests/test-file-extents.sh @@ -61,7 +61,7 @@ qemu-img map -f raw --output=json disk > test-file-extents.tmp cat test-file-extents.tmp jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ < test-file-extents.tmp > test-file-extents.local -nbdkit -U - file disk --run 'qemu-img map -f raw --output=json $nbd' \ +nbdkit file disk --run 'qemu-img map -f raw --output=json $nbd' \ > test-file-extents.tmp cat test-file-extents.tmp jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ diff --git a/tests/test-ip-filter-anyunix.sh b/tests/test-ip-filter-anyunix.sh index 9b94dc969..b0926421c 100755 --- a/tests/test-ip-filter-anyunix.sh +++ b/tests/test-ip-filter-anyunix.sh @@ -45,11 +45,11 @@ if is_windows; then exit 77 fi -nbdkit -U - -v -D ip.rules=1 --filter=ip null allow=anyunix deny=all \ +nbdkit -v -D ip.rules=1 --filter=ip null allow=anyunix deny=all \ --run 'nbdinfo $nbd' # This is expected to fail. -if nbdkit -U - -v -D ip.rules=1 --filter=ip null deny=anyunix \ +if nbdkit -v -D ip.rules=1 --filter=ip null deny=anyunix \ --run 'nbdinfo $nbd'; then echo "$0: expected test to fail" exit 1 diff --git a/tests/test-ip-filter-gid.sh b/tests/test-ip-filter-gid.sh index 8d9ee1eb0..326ed396e 100755 --- a/tests/test-ip-filter-gid.sh +++ b/tests/test-ip-filter-gid.sh @@ -45,11 +45,11 @@ if is_windows; then exit 77 fi -nbdkit -U - -v -D ip.rules=1 --filter=ip null allow=gid:`id -g` deny=all \ +nbdkit -v -D ip.rules=1 --filter=ip null allow=gid:`id -g` deny=all \ --run 'nbdinfo $nbd' # This is expected to fail. -if nbdkit -U - -v -D ip.rules=1 --filter=ip null deny=gid:`id -g` \ +if nbdkit -v -D ip.rules=1 --filter=ip null deny=gid:`id -g` \ --run 'nbdinfo $nbd'; then echo "$0: expected test to fail" exit 1 diff --git a/tests/test-ip-filter-pid.sh b/tests/test-ip-filter-pid.sh index c97d04ded..957846450 100755 --- a/tests/test-ip-filter-pid.sh +++ b/tests/test-ip-filter-pid.sh @@ -44,14 +44,14 @@ requires_linux_kernel_version 2.6 # This is expected to fail because the shell ($$) is not connecting to # the server. -if nbdkit -U - -v -D ip.rules=1 --filter=ip null allow=pid:$$ deny=all \ +if nbdkit -v -D ip.rules=1 --filter=ip null allow=pid:$$ deny=all \ --run 'nbdinfo --size "$uri"'; then echo "$0: expected test to fail" exit 1 fi # This is expected to work because we can deny the shell. -nbdkit -U - -v -D ip.rules=1 --filter=ip null deny=pid:$$ \ +nbdkit -v -D ip.rules=1 --filter=ip null deny=pid:$$ \ --run 'nbdinfo --size "$uri"' # This is a better test using nbdsh and passing the PID of nbdsh diff --git a/tests/test-ip-filter-security.sh b/tests/test-ip-filter-security.sh index 8fa360f81..4600b984a 100755 --- a/tests/test-ip-filter-security.sh +++ b/tests/test-ip-filter-security.sh @@ -43,12 +43,12 @@ requires_run requires selinuxenabled # This is expected to succeed. -nbdkit -U - -v -D ip.rules=1 --filter=ip null \ +nbdkit -v -D ip.rules=1 --filter=ip null \ deny=security:notalabel \ --run 'nbdinfo $nbd' # This is expected to fail. -if nbdkit -U - -v -D ip.rules=1 --filter=ip null \ +if nbdkit -v -D ip.rules=1 --filter=ip null \ allow=security:notalabel deny=all \ --run 'nbdinfo $nbd'; then echo "$0: expected test to fail" diff --git a/tests/test-ip-filter-uid.sh b/tests/test-ip-filter-uid.sh index b942345a5..625d20919 100755 --- a/tests/test-ip-filter-uid.sh +++ b/tests/test-ip-filter-uid.sh @@ -45,11 +45,11 @@ if is_windows; then exit 77 fi -nbdkit -U - -v -D ip.rules=1 --filter=ip null allow=uid:`id -u` deny=all \ +nbdkit -v -D ip.rules=1 --filter=ip null allow=uid:`id -u` deny=all \ --run 'nbdinfo $nbd' # This is expected to fail. -if nbdkit -U - -v -D ip.rules=1 --filter=ip null deny=uid:`id -u` \ +if nbdkit -v -D ip.rules=1 --filter=ip null deny=uid:`id -u` \ --run 'nbdinfo $nbd'; then echo "$0: expected test to fail" exit 1 diff --git a/tests/test-linuxdisk-copy-out.sh b/tests/test-linuxdisk-copy-out.sh index 492b6d069..8c2f44bad 100755 --- a/tests/test-linuxdisk-copy-out.sh +++ b/tests/test-linuxdisk-copy-out.sh @@ -48,7 +48,7 @@ files="linuxdisk-copy-out.img rm -f $files cleanup_fn rm -f $files -nbdkit -f -v -U - \ +nbdkit -f -v \ --filter=partition \ linuxdisk $srcdir/../plugins/linuxdisk partition=1 label=ROOT \ --run 'nbdcopy "$uri" linuxdisk-copy-out.img' diff --git a/tests/test-log-script-info.sh b/tests/test-log-script-info.sh index 3baccb7e6..fa9b2ed32 100755 --- a/tests/test-log-script-info.sh +++ b/tests/test-log-script-info.sh @@ -47,7 +47,7 @@ log=log-script-info.log cleanup_fn rm -f $log rm -f $log -nbdkit -U - --filter=log data "@32768 1" size=64K \ +nbdkit --filter=log data "@32768 1" size=64K \ logscript=' if [ "$act" = "Extents" -a "$type" = "LEAVE" ]; then echo $act $type >>log-script-info.log diff --git a/tests/test-long-name.sh b/tests/test-long-name.sh index d5b573c88..40f4ab9da 100755 --- a/tests/test-long-name.sh +++ b/tests/test-long-name.sh @@ -51,12 +51,12 @@ name4k=$name1k$name1k$name1k$name1k almost4k=${name4k%8$name16} # Test that $exportname and $uri reflect the name -out=$(nbdkit -U - -e $name4k null --run 'echo $exportname') +out=$(nbdkit -e $name4k null --run 'echo $exportname') if test "$name4k" != "$out"; then echo "$0: \$exportname contains wrong contents" >&2 fail=1 fi -out=$(nbdkit -U - -e $name4k null --run 'echo "$uri"') +out=$(nbdkit -e $name4k null --run 'echo "$uri"') case $out in nbd+unix:///$name4k\?socket=*) ;; *) echo "$0: \$uri contains wrong contents" >&2 @@ -71,24 +71,24 @@ case $out in esac # Use largest possible export name, then oversize, with NBD_OPT_EXPORT_NAME. -nbdkit -U - --mask-handshake=0 null --run 'qemu-io -r -f raw -c quit \ +nbdkit --mask-handshake=0 null --run 'qemu-io -r -f raw -c quit \ nbd+unix:///'$name4k'\?socket=$unixsocket' || fail=1 # qemu 4.1 did not length check, letting it send an invalid NBD client # request which nbdkit must filter out. Later qemu might refuse to # send the request (like libnbd does), at which point this is no longer # testing nbdkit proper, so we may remove it later: -nbdkit -U - --mask-handshake=0 null --run 'qemu-io -r -f raw -c quit \ +nbdkit --mask-handshake=0 null --run 'qemu-io -r -f raw -c quit \ nbd+unix:///'a$name4k'\?socket=$unixsocket' && fail=1 # Repeat with NBD_OPT_GO. -nbdkit -U - null --run 'qemu-io -r -f raw -c quit \ +nbdkit null --run 'qemu-io -r -f raw -c quit \ nbd+unix:///'$name4k'\?socket=$unixsocket' || fail=1 # See above comment about whether this is testing nbdkit or qemu: -nbdkit -U - null --run 'qemu-io -r -f raw -c quit \ +nbdkit null --run 'qemu-io -r -f raw -c quit \ nbd+unix:///'a$name4k'\?socket=$unixsocket' && fail=1 # Use nbdsh to provoke an extremely large NBD_OPT_SET_META_CONTEXT. -nbdkit -U - -e $almost4k null --run 'export exportname uri +nbdkit -e $almost4k null --run 'export exportname uri nbdsh -c - <<\EOF import os long = os.environ["exportname"] diff --git a/tests/test-luks-copy-zero.sh b/tests/test-luks-copy-zero.sh index c8b5acfc9..9a1c9a9ee 100755 --- a/tests/test-luks-copy-zero.sh +++ b/tests/test-luks-copy-zero.sh @@ -64,7 +64,7 @@ $TRUNCATE -s 100M $zero_disk # Using nbdkit-luks-filter, write the zero disk into the encrypted # disk. nbdcopy will do this using NBD_CMD_ZERO operations. -nbdkit -U - -fv \ +nbdkit -fv \ file $encrypt_disk --filter=luks passphrase=123456 \ --run "nbdcopy -C 1 $zero_disk \$nbd" diff --git a/tests/test-luks-info.sh b/tests/test-luks-info.sh index 7827cdc7a..fe27f0a84 100755 --- a/tests/test-luks-info.sh +++ b/tests/test-luks-info.sh @@ -53,7 +53,7 @@ qemu-img create -f luks \ -o key-secret=sec0 \ $disk 1M -nbdkit -U - file $disk --filter=luks passphrase=123456 \ +nbdkit file $disk --filter=luks passphrase=123456 \ --run 'nbdinfo $uri' > $info cat $info diff --git a/tests/test-multi-conn-name.sh b/tests/test-multi-conn-name.sh index c3657d482..6a180db72 100755 --- a/tests/test-multi-conn-name.sh +++ b/tests/test-multi-conn-name.sh @@ -69,7 +69,7 @@ print(bytes(h["b1"].pread(1, 0))) ' # Without the knob we flush all exports -nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=multi-conn \ +nbdkit -vf sh test-multi-conn-plugin.sh --filter=multi-conn \ --run 'export uri; nbdsh -c "$script"' > test-multi-conn-name.out || fail=1 diff -u <(cat <<\EOF b'A' @@ -77,7 +77,7 @@ b'B' EOF ) test-multi-conn-name.out || fail=1 # But with the knob, our flush is specific to the correct export -nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=multi-conn \ +nbdkit -vf sh test-multi-conn-plugin.sh --filter=multi-conn \ multi-conn-exportname=true \ --run 'export uri; nbdsh -c "$script"' > test-multi-conn-name.out || fail=1 diff -u <(cat <<\EOF diff --git a/tests/test-multi-conn.sh b/tests/test-multi-conn.sh index 6ce863dfe..3383cd246 100755 --- a/tests/test-multi-conn.sh +++ b/tests/test-multi-conn.sh @@ -63,7 +63,7 @@ print(h[0].can_multi_conn()) # Demonstrate the caching present without use of filter for filter in '' '--filter=multi-conn multi-conn-mode=plugin'; do - nbdkit -vf -U - sh test-multi-conn-plugin.sh $filter \ + nbdkit -vf sh test-multi-conn-plugin.sh $filter \ --run 'handles=4 nbdsh -c "$preamble" -c " # Without flush, reads cache, and writes do not affect persistent data print(bytes(h[0].pread(4, 0))) @@ -109,7 +109,7 @@ done # Demonstrate specifics of FUA flag for filter in '' '--filter=multi-conn multi-conn-mode=plugin'; do - nbdkit -vf -U - sh test-multi-conn-plugin.sh $filter \ + nbdkit -vf sh test-multi-conn-plugin.sh $filter \ --run 'nbdsh -c "$preamble" -c " # Some servers let FUA flush all outstanding requests h[0].pwrite(b'\''hello '\'', 0) @@ -123,7 +123,7 @@ EOF ) test-multi-conn.out || fail=1 done for filter in '' '--filter=multi-conn multi-conn-mode=plugin'; do - nbdkit -vf -U - sh test-multi-conn-plugin.sh strictfua=1 $filter \ + nbdkit -vf sh test-multi-conn-plugin.sh strictfua=1 $filter \ --run 'nbdsh -c "$preamble" -c " # But it is also compliant for a server that only flushes the exact request h[0].pwrite(b'\''hello '\'', 0) @@ -155,7 +155,7 @@ done # mode is also able to supply multi-conn by a different technique. for filter in '--filter=multi-conn' 'strictfua=1 --filter=multi-conn' \ '--filter=multi-conn multi-conn-mode=plugin --filter=cache' ; do - nbdkit -vf -U - sh test-multi-conn-plugin.sh $filter \ + nbdkit -vf sh test-multi-conn-plugin.sh $filter \ --run 'nbdsh -c "$preamble" -c " # FUA writes are immediately visible on all connections h[0].cache(12, 0) @@ -175,7 +175,7 @@ EOF done # unsafe mode intentionally lacks consistency, use at your own risk -nbdkit -vf -U - sh test-multi-conn-plugin.sh \ +nbdkit -vf sh test-multi-conn-plugin.sh \ --filter=multi-conn multi-conn-mode=unsafe \ --run 'nbdsh -c "$preamble" -c " h[0].cache(12, 0) @@ -193,7 +193,7 @@ EOF ) test-multi-conn.out || fail=1 # auto mode devolves to multi-conn disable when connections are serialized -nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=noparallel \ +nbdkit -vf sh test-multi-conn-plugin.sh --filter=noparallel \ serialize=connections --filter=multi-conn --filter=cache \ --run 'handles=1 nbdsh -c "$preamble" ' > test-multi-conn.out || fail=1 @@ -208,7 +208,7 @@ for level in off connection fast; do plugin 'plugin --filter=cache'; do echo "setup: $level $mode" >> test-multi-conn.stat # Flush with no activity - nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=multi-conn \ + nbdkit -vf sh test-multi-conn-plugin.sh --filter=multi-conn \ --filter=stats statsfile=test-multi-conn.stat statsappend=true \ multi-conn-track-dirty=$level multi-conn-mode=$mode \ --run 'nbdsh -c "$preamble" -c " @@ -217,7 +217,7 @@ h[0].pread(1, 0) h[0].flush() "' > test-multi-conn.out || fail=1 # Client that flushes assuming multi-conn semantics - nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=multi-conn \ + nbdkit -vf sh test-multi-conn-plugin.sh --filter=multi-conn \ --filter=stats statsfile=test-multi-conn.stat statsappend=true \ multi-conn-track-dirty=$level multi-conn-mode=$mode \ --run 'handles=4 nbdsh -c "$preamble" -c " @@ -230,7 +230,7 @@ h[3].flush() h[3].flush() "' > test-multi-conn.out || fail=1 # Client that flushes assuming inconsistent semantics - nbdkit -vf -U - sh test-multi-conn-plugin.sh --filter=multi-conn \ + nbdkit -vf sh test-multi-conn-plugin.sh --filter=multi-conn \ --filter=stats statsfile=test-multi-conn.stat statsappend=true \ multi-conn-track-dirty=$level multi-conn-mode=$mode \ --run 'nbdsh -c "$preamble" -c " diff --git a/tests/test-nbd-block-size.sh b/tests/test-nbd-block-size.sh index c6971edf3..d0ebd4c4a 100755 --- a/tests/test-nbd-block-size.sh +++ b/tests/test-nbd-block-size.sh @@ -42,11 +42,11 @@ requires_nbdsh_uri # Create an nbdkit eval plugin which presents block size constraints. # Check the advertised block size constraints can be read. -nbdkit -U - eval \ +nbdkit eval \ block_size="echo 64K 128K 32M" \ get_size="echo 0" \ --run ' - nbdkit -U - nbd $uri --run " + nbdkit nbd $uri --run " nbdsh \ -u \$uri \ -c \"assert h.get_block_size(nbd.SIZE_MINIMUM) == 64 * 1024\" \ diff --git a/tests/test-nbd-extents.sh b/tests/test-nbd-extents.sh index e91f19b1c..f8145de1d 100755 --- a/tests/test-nbd-extents.sh +++ b/tests/test-nbd-extents.sh @@ -67,7 +67,7 @@ do_test () data "$1" size="$2" \ truncate="$3" # We use jq to normalize the output and convert it to plain text. - nbdkit -U - nbd socket="$sock" \ + nbdkit nbd socket="$sock" \ --run 'qemu-img map -f raw --output=json $nbd' | jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ > $out diff --git a/tests/test-nbd-vsock.sh b/tests/test-nbd-vsock.sh index 63fbedb93..765b4d3ea 100755 --- a/tests/test-nbd-vsock.sh +++ b/tests/test-nbd-vsock.sh @@ -63,7 +63,7 @@ cleanup_fn rm -f $files start_nbdkit -P nbd-vsock.pid --vsock --port $port memory 1M # Run a second nbdkit as a vsock->Unix bridge. -nbdkit -U - nbd vsock=1 port=$port --run 'nbdsh -u "$uri" -c " +nbdkit nbd vsock=1 port=$port --run 'nbdsh -u "$uri" -c " size = h.get_size() assert size == 1048576 "' diff --git a/tests/test-nbdkit-backend-debug.sh b/tests/test-nbdkit-backend-debug.sh index f3affe8a9..ec52690f1 100755 --- a/tests/test-nbdkit-backend-debug.sh +++ b/tests/test-nbdkit-backend-debug.sh @@ -43,7 +43,7 @@ files="$out $debug" rm -f $files cleanup_fn rm -f $files -nbdkit -U - \ +nbdkit \ -v \ --filter=noextents \ memory 10M \ @@ -55,7 +55,7 @@ grep '^nbdkit:.*debug: memory: open' $debug grep '^nbdkit:.*debug: noextents: pread' $debug grep '^nbdkit:.*debug: memory: pread' $debug -nbdkit -U - \ +nbdkit \ -v -D nbdkit.backend.controlpath=0 \ --filter=noextents \ memory 10M \ @@ -67,7 +67,7 @@ grep -v '^nbdkit:.*debug: memory: open' $debug grep '^nbdkit:.*debug: noextents: pread' $debug grep '^nbdkit:.*debug: memory: pread' $debug -nbdkit -U - \ +nbdkit \ -v -D nbdkit.backend.datapath=0 \ --filter=noextents \ memory 10M \ diff --git a/tests/test-nofilter.sh b/tests/test-nofilter.sh index d43e37692..edb20f990 100755 --- a/tests/test-nofilter.sh +++ b/tests/test-nofilter.sh @@ -41,5 +41,5 @@ files="nofilter.img" rm -f $files cleanup_fn rm -f $files -nbdkit -U - -v --filter=nofilter memory 10M \ +nbdkit -v --filter=nofilter memory 10M \ --run 'nbdcopy "$uri" nofilter.img' diff --git a/tests/test-nozero.sh b/tests/test-nozero.sh index 4cd834398..9ef567b51 100755 --- a/tests/test-nozero.sh +++ b/tests/test-nozero.sh @@ -87,7 +87,7 @@ for f in {1..5}; do done # Check that zero with trim results in a sparse image. -requires nbdkit -U - --filter=log file logfile=nozero1.log nozero1.img \ +requires nbdkit --filter=log file logfile=nozero1.log nozero1.img \ --run 'nbdsh -u "$uri" -c "h.zero(1024*1024, 0)"' if test "$($STAT -c %b nozero1.img)" = "${sizes[1]}"; then echo "$0: can't trim file by writing zeroes" diff --git a/tests/test-null-extents.sh b/tests/test-null-extents.sh index f5d47cb4f..dd32992c0 100755 --- a/tests/test-null-extents.sh +++ b/tests/test-null-extents.sh @@ -48,7 +48,7 @@ cleanup_fn rm -f $files do_test () { # We use jq to normalize the output and convert it to plain text. - nbdkit -U - \ + nbdkit \ null "$1" \ --run 'qemu-img map -f raw --output=json $nbd' | jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ diff --git a/tests/test-ocaml-fork.sh b/tests/test-ocaml-fork.sh index 49a6ef10a..3ffad1b8b 100755 --- a/tests/test-ocaml-fork.sh +++ b/tests/test-ocaml-fork.sh @@ -44,4 +44,4 @@ requires_run requires_nbdinfo # Using --run causes nbdkit to fork. -nbdkit -U - $plugin a=1 b=2 c=3 d=4 --run 'nbdinfo "$uri"' +nbdkit $plugin a=1 b=2 c=3 d=4 --run 'nbdinfo "$uri"' diff --git a/tests/test-ocaml-list-exports.sh b/tests/test-ocaml-list-exports.sh index 32b2e1c0a..96cc53779 100755 --- a/tests/test-ocaml-list-exports.sh +++ b/tests/test-ocaml-list-exports.sh @@ -51,7 +51,7 @@ cleanup_fn rm -f $out # Uses test_ocaml_plugin.ml. Note the parameters are required as they # are checked for another test. -nbdkit -U - $plugin a=1 b=2 c=3 d=4 \ +nbdkit $plugin a=1 b=2 c=3 d=4 \ --run 'nbdinfo --list --json "$uri"' > $out cat $out diff --git a/tests/test-offset-extents.sh b/tests/test-offset-extents.sh index f9e6af2f0..8c0ce98be 100755 --- a/tests/test-offset-extents.sh +++ b/tests/test-offset-extents.sh @@ -52,7 +52,7 @@ cleanup_fn rm -f $files do_test () { # We use jq to normalize the output and convert it to plain text. - nbdkit -U - \ + nbdkit \ --filter=offset \ data "$1" size="$2" \ offset=1024 range=65536 \ diff --git a/tests/test-offset-truncate.sh b/tests/test-offset-truncate.sh index b09c89e7f..113293337 100755 --- a/tests/test-offset-truncate.sh +++ b/tests/test-offset-truncate.sh @@ -43,13 +43,13 @@ requires_nbdsh_uri function do_test_info () { - nbdkit -U - --filter=offset --filter=truncate pattern size=1024 \ + nbdkit --filter=offset --filter=truncate pattern size=1024 \ "$@" --run 'nbdinfo $nbd' } function do_test_read512 () { - nbdkit -U - --filter=offset --filter=truncate pattern size=1024 \ + nbdkit --filter=offset --filter=truncate pattern size=1024 \ "$@" --run 'nbdsh -u "$uri" -c " try: h.pread(512, 0) @@ -60,7 +60,7 @@ except nbd.Error: function do_test_zero512 () { - nbdkit -U - --filter=offset --filter=truncate memory size=1024 \ + nbdkit --filter=offset --filter=truncate memory size=1024 \ "$@" --run 'nbdsh -u "$uri" -c " try: h.zero(512, 0) diff --git a/tests/test-old-plugins.sh b/tests/test-old-plugins.sh index fd593a17d..41f1951b6 100755 --- a/tests/test-old-plugins.sh +++ b/tests/test-old-plugins.sh @@ -70,7 +70,7 @@ cleanup_fn rm -f $files cp disk $disk -nbdkit -fv -U - $f file=$disk \ +nbdkit -fv $f file=$disk \ --run ' guestfish \ add "" protocol:nbd server:unix:$unixsocket : \ diff --git a/tests/test-ondemand-list.sh b/tests/test-ondemand-list.sh index bc264c7df..436e9be7b 100755 --- a/tests/test-ondemand-list.sh +++ b/tests/test-ondemand-list.sh @@ -57,7 +57,7 @@ touch $dir/export2 touch $dir/export3 export LANG=C -nbdkit -U - ondemand dir=$dir size=1M \ +nbdkit ondemand dir=$dir size=1M \ --run 'qemu-nbd -k $unixsocket -L' > $out cat $out diff --git a/tests/test-ones.sh b/tests/test-ones.sh index 8fb448ebb..cae63da90 100755 --- a/tests/test-ones.sh +++ b/tests/test-ones.sh @@ -40,15 +40,15 @@ requires_nbdinfo requires_run # Check the disk contains 0xff by default. -nbdkit -U - ones 1024 --run ' +nbdkit ones 1024 --run ' nbdsh -u "$uri" -c "assert (h.pread(1024,0) == b\"\\xff\"*1024)" ' # Change the byte. -nbdkit -U - ones 1024 byte=0x5a --run ' +nbdkit ones 1024 byte=0x5a --run ' nbdsh -u "$uri" -c "assert (h.pread(1024,0) == b\"\\x5a\"*1024)" ' # Check the disk is fully allocated. -nbdkit -U - ones 1G --run 'nbdinfo --map "$uri"' | \ +nbdkit ones 1G --run 'nbdinfo --map "$uri"' | \ grep -E '0[[:space:]]+1073741824[[:space:]]+0[[:space:]]+(data|allocated)' diff --git a/tests/test-parallel-file.sh b/tests/test-parallel-file.sh index 476a5f669..110193663 100755 --- a/tests/test-parallel-file.sh +++ b/tests/test-parallel-file.sh @@ -55,7 +55,7 @@ timeout 30s </dev/null qemu-io -f raw -c "aio_write -P 1 0 512" \ # tuning the delays may help. # With --threads=1, the write should complete first because it was issued first -nbdkit -v -t 1 -U - --filter=delay file test-parallel-file.data \ +nbdkit -v -t 1 --filter=delay file test-parallel-file.data \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out @@ -66,7 +66,7 @@ read 512/512 bytes at offset 0"; then fi # With default --threads, the faster read should complete first -nbdkit -v -U - --filter=delay file test-parallel-file.data \ +nbdkit -v --filter=delay file test-parallel-file.data \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out @@ -77,7 +77,7 @@ wrote 512/512 bytes at offset 512"; then fi # With --filter=noparallel, the write should complete first because it was issued first -nbdkit -v -U - --filter=noparallel --filter=delay file test-parallel-file.data \ +nbdkit -v --filter=noparallel --filter=delay file test-parallel-file.data \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out diff --git a/tests/test-parallel-nbd.sh b/tests/test-parallel-nbd.sh index c2055e80f..c0a6d8b4f 100755 --- a/tests/test-parallel-nbd.sh +++ b/tests/test-parallel-nbd.sh @@ -63,7 +63,7 @@ start_nbdkit -P test-parallel-nbd.pid \ file test-parallel-nbd.data wdelay=2 rdelay=1 # With --threads=1, the write should complete first because it was issued first -nbdkit -v -t 1 -U - nbd socket=$sock --run ' +nbdkit -v -t 1 nbd socket=$sock --run ' timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ -c aio_flush $nbd' | tee test-parallel-nbd.out @@ -74,7 +74,7 @@ read 512/512 bytes at offset 0"; then fi # With default --threads, the faster read should complete first -nbdkit -v -U - nbd socket=$sock --run ' +nbdkit -v nbd socket=$sock --run ' timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ -c aio_flush $nbd' | tee test-parallel-nbd.out diff --git a/tests/test-parallel-sh.sh b/tests/test-parallel-sh.sh index 08fd8a630..da18e41b3 100755 --- a/tests/test-parallel-sh.sh +++ b/tests/test-parallel-sh.sh @@ -110,7 +110,7 @@ EOF chmod +x test-parallel-sh.script # With --threads=1, the write should complete first because it was issued first -nbdkit -v -t 1 -U - --filter=delay sh test-parallel-sh.script \ +nbdkit -v -t 1 --filter=delay sh test-parallel-sh.script \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-sh.out @@ -121,7 +121,7 @@ read 512/512 bytes at offset 0"; then fi # With default --threads, the faster read should complete first -nbdkit -v -U - --filter=delay sh test-parallel-sh.script \ +nbdkit -v --filter=delay sh test-parallel-sh.script \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-sh.out @@ -133,7 +133,7 @@ fi # With --filter=noparallel, the write should complete first because it was # issued first. Also test that the log filter doesn't leak an fd -nbdkit -v -U - --filter=noparallel --filter=log --filter=delay \ +nbdkit -v --filter=noparallel --filter=log --filter=delay \ sh test-parallel-sh.script logfile=/dev/null \ wdelay=2 rdelay=1 --run 'timeout 60s </dev/null qemu-io -f raw \ -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" -c aio_flush $nbd' | diff --git a/tests/test-partition-4k-gpt.sh b/tests/test-partition-4k-gpt.sh index 836988a08..a0276b59d 100755 --- a/tests/test-partition-4k-gpt.sh +++ b/tests/test-partition-4k-gpt.sh @@ -66,7 +66,7 @@ w EOF # Run nbdkit with the partition filter. -nbdkit -f -v -U - \ +nbdkit -f -v \ --filter=partition file $disk partition-sectorsize=4k partition=1 \ --run "nbdcopy \$uri $out" diff --git a/tests/test-partition-4k-mbr.sh b/tests/test-partition-4k-mbr.sh index ed463b482..73664c219 100755 --- a/tests/test-partition-4k-mbr.sh +++ b/tests/test-partition-4k-mbr.sh @@ -65,7 +65,7 @@ w EOF # Run nbdkit with the partition filter. -nbdkit -f -v -U - \ +nbdkit -f -v \ --filter=partition file $disk partition-sectorsize=4k partition=1 \ --run "nbdcopy \$uri $out" diff --git a/tests/test-partition1.sh b/tests/test-partition1.sh index d4d6c1be3..5062288f4 100755 --- a/tests/test-partition1.sh +++ b/tests/test-partition1.sh @@ -67,7 +67,7 @@ do_test () # Run nbdkit on each partition, copying data in and out. for ((part=1; part <= $nrparts; ++part)); do if [ "$part" != "$ignored" ]; then - nbdkit -f -v -U - \ + nbdkit -f -v \ --filter=partition file $d/disk partition=$part \ --run "nbdcopy -C 1 $d/rand \$uri && nbdcopy -C 1 \$uri $d/out" truncate -s 512 $d/out diff --git a/tests/test-partition2.sh b/tests/test-partition2.sh index f195bc78e..24cd88b52 100755 --- a/tests/test-partition2.sh +++ b/tests/test-partition2.sh @@ -43,7 +43,7 @@ rm -f $files cleanup_fn rm -f $files # Select partition 3 from a 2 partition disk. -nbdkit -U - -r -f -v --filter=partition \ +nbdkit -r -f -v --filter=partition \ partitioning disk disk partition-type=mbr partition=3 \ --run 'nbdinfo $nbd' > partition2.log 2>&1 ||: @@ -55,7 +55,7 @@ grep "MBR partition 3 not found" partition2.log # the extended partition so it is skipped. This test is slightly # different from above as it invokes the code supporting logical # partitions. -nbdkit -U - -r -f -v --filter=partition \ +nbdkit -r -f -v --filter=partition \ partitioning disk disk disk disk disk disk disk disk disk \ partition-type=mbr partition=11 \ --run 'nbdinfo $nbd' > partition2.log 2>&1 ||: @@ -65,7 +65,7 @@ cat partition2.log grep "MBR partition 11 not found" partition2.log # It should be impossible to select an extended partition. -nbdkit -U - -r -f -v --filter=partition \ +nbdkit -r -f -v --filter=partition \ partitioning disk disk disk disk disk partition-type=mbr partition=4 \ --run 'nbdinfo $nbd' > partition2.log 2>&1 ||: @@ -75,7 +75,7 @@ grep "MBR partition 4 not found" partition2.log # Selecting a logical partition on a disk without an extended # partition gives a different error. -nbdkit -U - -r -f -v --filter=partition \ +nbdkit -r -f -v --filter=partition \ partitioning disk disk partition-type=mbr partition=5 \ --run 'nbdinfo $nbd' > partition2.log 2>&1 ||: diff --git a/tests/test-partitioning1.sh b/tests/test-partitioning1.sh index 0ece7e13c..d8dff5fa3 100755 --- a/tests/test-partitioning1.sh +++ b/tests/test-partitioning1.sh @@ -55,7 +55,7 @@ $TRUNCATE -s 1 partitioning1-p5 $TRUNCATE -s 511 partitioning1-p6 # Run nbdkit with partitioning plugin and partition filter. -nbdkit -f -v -D partitioning.regions=1 -U - \ +nbdkit -f -v -D partitioning.regions=1 \ --filter=partition \ partitioning \ mbr-id=0x83 alignment=512 \ @@ -75,7 +75,7 @@ cmp file-data partitioning1.out # Same test with > 4 MBR partitions. # Note we select partition 6 because partition 4 is the extended partition. -nbdkit -f -v -D partitioning.regions=1 -U - \ +nbdkit -f -v -D partitioning.regions=1 \ --filter=partition \ partitioning \ partitioning1-p1 \ @@ -92,7 +92,7 @@ nbdkit -f -v -D partitioning.regions=1 -U - \ cmp file-data partitioning1.out # Same test with GPT. -nbdkit -f -v -D partitioning.regions=1 -U - \ +nbdkit -f -v -D partitioning.regions=1 \ --filter=partition \ partitioning \ partitioning1-p1 \ diff --git a/tests/test-partitioning4.sh b/tests/test-partitioning4.sh index b8975c25b..37d464dc1 100755 --- a/tests/test-partitioning4.sh +++ b/tests/test-partitioning4.sh @@ -72,7 +72,7 @@ done $TRUNCATE -s 6144 $d/part.0250 # Run nbdkit. -nbdkit -f -v -D partitioning.regions=1 -U - \ +nbdkit -f -v -D partitioning.regions=1 \ --filter=partition \ partitioning \ $d/part.* \ diff --git a/tests/test-partitioning6.sh b/tests/test-partitioning6.sh index 96d0dbb3a..5654d0cbb 100755 --- a/tests/test-partitioning6.sh +++ b/tests/test-partitioning6.sh @@ -75,7 +75,7 @@ $TRUNCATE -s 6144 $d/part.0250 # # Note we select partition 251 (not 250) because partition 4 is the # extended partition and everything partition following moves up by 1. -nbdkit -f -v -D partitioning.regions=1 -U - \ +nbdkit -f -v -D partitioning.regions=1 \ --filter=partition \ partitioning \ $d/part.* \ diff --git a/tests/test-protect-ranges.sh b/tests/test-protect-ranges.sh index 61ba9d083..dfbe119b7 100755 --- a/tests/test-protect-ranges.sh +++ b/tests/test-protect-ranges.sh @@ -40,7 +40,7 @@ requires_run # access, simply that the code which coalesces ranges and turns them # into regions doesn't crash. -cmd="nbdkit -U - --filter=protect null size=1M --run true" +cmd="nbdkit --filter=protect null size=1M --run true" $cmd diff --git a/tests/test-qcow2dec-map.sh b/tests/test-qcow2dec-map.sh index dc451a02a..57d590d7b 100755 --- a/tests/test-qcow2dec-map.sh +++ b/tests/test-qcow2dec-map.sh @@ -60,7 +60,7 @@ nbdinfo --map -- [ qemu-nbd -r -f qcow2 $qcow2 ] > $map_expected cat $map_expected # Get the actual map from nbdkit qcow2dec filter. -nbdkit -U - file --filter=qcow2dec $qcow2 \ +nbdkit file --filter=qcow2dec $qcow2 \ --run 'nbdinfo --map "$uri"' > $map_actual cat $map_actual diff --git a/tests/test-qcow2dec.sh b/tests/test-qcow2dec.sh index 0c6a759f3..5db69126f 100755 --- a/tests/test-qcow2dec.sh +++ b/tests/test-qcow2dec.sh @@ -42,7 +42,7 @@ requires qemu-img --version requires cmp --version # Check nbdinfo supports the --is flag (not RHEL 8). -requires nbdkit -r -U - null --run 'nbdinfo --is readonly "$uri"' +requires nbdkit -r null --run 'nbdinfo --is readonly "$uri"' qcow2=qcow2dec-disk.qcow2 raw=qcow2dec-disk.raw diff --git a/tests/test-random-copy.sh b/tests/test-random-copy.sh index 1235644dd..eef823d8b 100755 --- a/tests/test-random-copy.sh +++ b/tests/test-random-copy.sh @@ -43,4 +43,4 @@ requires_nbdcopy requires_libnbd_version 1.5.9 # Copy from self to self which is what this plugin is intended for. -nbdkit -U - random size=100M --run 'nbdcopy "$uri" "$uri"' +nbdkit random size=100M --run 'nbdcopy "$uri" "$uri"' diff --git a/tests/test-random-sock.sh b/tests/test-random-sock.sh index 40060d1f2..29000ea70 100755 --- a/tests/test-random-sock.sh +++ b/tests/test-random-sock.sh @@ -30,7 +30,7 @@ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -# Test nbdkit -U - + captive nbdkit. +# Test nbdkit + captive nbdkit. source ./functions.sh set -e @@ -38,4 +38,4 @@ set -x requires_run -nbdkit -U - example1 --run 'sleep 5' +nbdkit example1 --run 'sleep 5' diff --git a/tests/test-rate-dynamic.sh b/tests/test-rate-dynamic.sh index dc6499528..6ba2a84d3 100755 --- a/tests/test-rate-dynamic.sh +++ b/tests/test-rate-dynamic.sh @@ -57,7 +57,7 @@ cleanup_fn rm -f $files echo 10M > rate-dynamic.txt start_t=$SECONDS -nbdkit -U - \ +nbdkit \ --filter=blocksize --filter=rate \ pattern 25M \ maxdata=65536 \ diff --git a/tests/test-rate.sh b/tests/test-rate.sh index 5e892b04c..93d7fc7cb 100755 --- a/tests/test-rate.sh +++ b/tests/test-rate.sh @@ -52,7 +52,7 @@ cleanup_fn rm -f $files # data requests up. start_t=$SECONDS -nbdkit -U - \ +nbdkit \ --filter=blocksize --filter=rate \ pattern 25M \ maxdata=65536 \ diff --git a/tests/test-readahead-copy.sh b/tests/test-readahead-copy.sh index dbdeacb50..0bc98fb3f 100755 --- a/tests/test-readahead-copy.sh +++ b/tests/test-readahead-copy.sh @@ -54,9 +54,9 @@ data=" 1 @0x87050300 8 @0x100000000 9 " -nbdkit -v -U - --filter=readahead data "$data" \ +nbdkit -v --filter=readahead data "$data" \ --run 'nbdcopy "$uri" readahead-copy1.img' -nbdkit -v -U - data "$data" \ +nbdkit -v data "$data" \ --run 'nbdcopy "$uri" readahead-copy2.img' # Check the output. diff --git a/tests/test-readahead.sh b/tests/test-readahead.sh index 267d7678d..7b2daf20d 100755 --- a/tests/test-readahead.sh +++ b/tests/test-readahead.sh @@ -43,7 +43,7 @@ files="readahead.out" rm -f $files cleanup_fn rm -f $files -nbdkit -fv -U - sh - \ +nbdkit -fv sh - \ --filter=readahead \ --run 'nbdsh --uri "$uri" -c " import time diff --git a/tests/test-retry-extents.sh b/tests/test-retry-extents.sh index 6df977fa4..63202eae7 100755 --- a/tests/test-retry-extents.sh +++ b/tests/test-retry-extents.sh @@ -47,7 +47,7 @@ touch retry-extents-count retry-extents-open-count start_t=$SECONDS # Create a custom plugin which will test retrying. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 \ --run 'nbdsh --base-allocation --uri "$uri" -c " diff --git a/tests/test-retry-open.sh b/tests/test-retry-open.sh index 4a74d5d42..09e5d12d1 100755 --- a/tests/test-retry-open.sh +++ b/tests/test-retry-open.sh @@ -48,7 +48,7 @@ echo 0 > retry-open2-count start_t=$SECONDS # Create a custom plugin which will test retrying open. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 \ --run 'qemu-io -f raw -c "r -P0 0 512" $nbd || :' <<'EOF' diff --git a/tests/test-retry-readonly.sh b/tests/test-retry-readonly.sh index 985ac8b92..f1626bc6d 100755 --- a/tests/test-retry-readonly.sh +++ b/tests/test-retry-readonly.sh @@ -46,7 +46,7 @@ touch retry-readonly-count retry-readonly-open-count start_t=$SECONDS # Create a custom plugin which will test retrying. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 retry-readonly=yes \ --run 'qemu-io -f raw -c "w 0 512" -c "w 0 512" $nbd || :' <<'EOF' diff --git a/tests/test-retry-reopen-fail.sh b/tests/test-retry-reopen-fail.sh index 65ecbdca7..3b214cc71 100755 --- a/tests/test-retry-reopen-fail.sh +++ b/tests/test-retry-reopen-fail.sh @@ -63,7 +63,7 @@ do_test () start_t=$SECONDS # Create a custom plugin which will test retrying. - nbdkit -v -U - \ + nbdkit -v \ sh - \ --filter=retry retry-delay=1 retries=$retries \ --run 'qemu-io -r -f raw $nbd -c "r 0 512" -c "r 0 512" diff --git a/tests/test-retry-request-open.sh b/tests/test-retry-request-open.sh index bb60374b1..363f6f227 100755 --- a/tests/test-retry-request-open.sh +++ b/tests/test-retry-request-open.sh @@ -47,7 +47,7 @@ touch retry-request-open-count start_t=$SECONDS # Create a custom plugin which will test retrying requests. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry-request retry-request-retries=3 retry-request-delay=1 \ --run 'nbdcopy --synchronous "$uri" retry-request-open.img' <<'EOF' diff --git a/tests/test-retry-request.sh b/tests/test-retry-request.sh index e821eebe6..20c0e1c8f 100755 --- a/tests/test-retry-request.sh +++ b/tests/test-retry-request.sh @@ -47,7 +47,7 @@ touch retry-request-count start_t=$SECONDS # Create a custom plugin which will test retrying requests. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry-request retry-request-retries=3 retry-request-delay=1 \ --run 'nbdcopy --synchronous "$uri" retry-request.img' <<'EOF' diff --git a/tests/test-retry-size.sh b/tests/test-retry-size.sh index e0d22a3d3..f5246f07a 100755 --- a/tests/test-retry-size.sh +++ b/tests/test-retry-size.sh @@ -50,7 +50,7 @@ start_t=$SECONDS # Create a custom plugin which will test retrying. st=0 -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 \ --run 'nbdsh -u "$uri" \ diff --git a/tests/test-retry-zero-flags.sh b/tests/test-retry-zero-flags.sh index eff60925b..3b079df2a 100755 --- a/tests/test-retry-zero-flags.sh +++ b/tests/test-retry-zero-flags.sh @@ -47,7 +47,7 @@ touch retry-zero-flags-count retry-zero-flags-open-count start_t=$SECONDS # Create a custom plugin which will test retrying. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 \ --run 'nbdsh --uri "$uri" -c " diff --git a/tests/test-retry.sh b/tests/test-retry.sh index 67708cf13..e124660e6 100755 --- a/tests/test-retry.sh +++ b/tests/test-retry.sh @@ -47,7 +47,7 @@ touch retry-count retry-open-count start_t=$SECONDS # Create a custom plugin which will test retrying. -nbdkit -v -U - \ +nbdkit -v \ sh - \ --filter=retry retry-delay=1 \ --run 'nbdcopy "$uri" retry.img' <<'EOF' diff --git a/tests/test-scan-copy.sh b/tests/test-scan-copy.sh index 95e8ee4bf..6baf904ea 100755 --- a/tests/test-scan-copy.sh +++ b/tests/test-scan-copy.sh @@ -39,5 +39,5 @@ requires_run requires_plugin sparse-random requires_filter scan -nbdkit -fv -U - sparse-random 1M --filter=scan --run 'nbdcopy "$uri" "$uri"' -nbdkit -fv -U - sparse-random 1G --filter=scan --run 'nbdcopy "$uri" "$uri"' +nbdkit -fv sparse-random 1M --filter=scan --run 'nbdcopy "$uri" "$uri"' +nbdkit -fv sparse-random 1G --filter=scan --run 'nbdcopy "$uri" "$uri"' diff --git a/tests/test-scan-info.sh b/tests/test-scan-info.sh index 557aab3a7..9aae70392 100755 --- a/tests/test-scan-info.sh +++ b/tests/test-scan-info.sh @@ -41,7 +41,7 @@ requires_filter scan # We're just testing that there are no problematic races with the # background thread. -nbdkit -fv -U - memory 1 --filter=scan --run 'nbdinfo $uri' -nbdkit -fv -U - memory 1M --filter=scan --run 'nbdinfo $uri' -nbdkit -fv -U - memory 1G --filter=scan --run 'nbdinfo $uri' -nbdkit -fv -U - memory 1G --filter=scan -e test --run 'nbdinfo $uri' +nbdkit -fv memory 1 --filter=scan --run 'nbdinfo $uri' +nbdkit -fv memory 1M --filter=scan --run 'nbdinfo $uri' +nbdkit -fv memory 1G --filter=scan --run 'nbdinfo $uri' +nbdkit -fv memory 1G --filter=scan -e test --run 'nbdinfo $uri' diff --git a/tests/test-sh-errors.sh b/tests/test-sh-errors.sh index 2b05c7baa..09d80981c 100755 --- a/tests/test-sh-errors.sh +++ b/tests/test-sh-errors.sh @@ -55,7 +55,7 @@ do_test () else cmd='qemu-io -r -f raw -c "r 0 1" $nbd' fi - nbdkit -v -U - sh - --run "$cmd"' && + nbdkit -v sh - --run "$cmd"' && echo qemu-io unexpectedly passed >> '$out'; :' >> $out if grep "qemu-io unexpectedly passed" $out || ! egrep "$1" $out; then diff --git a/tests/test-sh-extents.sh b/tests/test-sh-extents.sh index e6a15073b..10a56861c 100755 --- a/tests/test-sh-extents.sh +++ b/tests/test-sh-extents.sh @@ -49,7 +49,7 @@ cleanup_fn rm -f $files do_test () { # We use jq to normalize the output and convert it to plain text. - nbdkit -v -U - sh - --run 'qemu-img map -f raw --output=json $nbd' | + nbdkit -v sh - --run 'qemu-img map -f raw --output=json $nbd' | jq -c '.[] | {start:.start, length:.length, data:.data, zero:.zero}' \ > $out if ! cmp $out $expected; then diff --git a/tests/test-sh-tmpdir-leak.sh b/tests/test-sh-tmpdir-leak.sh index 7446df6ea..06765f517 100755 --- a/tests/test-sh-tmpdir-leak.sh +++ b/tests/test-sh-tmpdir-leak.sh @@ -41,12 +41,12 @@ requires_run requires_plugin sh unset tmpdir -nbdkit -U - sh - --run 'if test -n "$tmpdir"; then exit 1; fi' </dev/null +nbdkit sh - --run 'if test -n "$tmpdir"; then exit 1; fi' </dev/null # Meanwhile, the user CAN export $tmpdir for the sake of --run, but # the script still gets its own distinct location. -tmpdir=/nowhere nbdkit -U - -v sh - \ +tmpdir=/nowhere nbdkit -v sh - \ --run 'if test "$tmpdir" != /nowhere; then exit 1; fi' <<EOF if test "$tmpdir" = /nowhere; then echo "$0: unexpected tmpdir" 2>&1 diff --git a/tests/test-shebang-cc-ocaml.sh b/tests/test-shebang-cc-ocaml.sh index cb11ca4e1..52a5a74f6 100755 --- a/tests/test-shebang-cc-ocaml.sh +++ b/tests/test-shebang-cc-ocaml.sh @@ -47,7 +47,7 @@ export OCAML_PLUGIN_LIBRARIES # For unclear reasons linking the OCaml plugin fails on macOS. XXX requires_not test "$(uname)" = "Darwin" -$script -fv -U - \ +$script -fv \ EXTRA_CFLAGS="-I ../plugins/ocaml -I ../plugins/ocaml/.libs" \ size=512 \ --run ' diff --git a/tests/test-shebang-cc.sh b/tests/test-shebang-cc.sh index e1f1e9fbe..b25b789f7 100755 --- a/tests/test-shebang-cc.sh +++ b/tests/test-shebang-cc.sh @@ -45,7 +45,7 @@ requires_run requires_plugin cc requires guestfish --version -$script -fv -U - \ +$script -fv \ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \ --run ' guestfish \ diff --git a/tests/test-sparse-random-copy.sh b/tests/test-sparse-random-copy.sh index bd77c279b..2ff36b374 100755 --- a/tests/test-sparse-random-copy.sh +++ b/tests/test-sparse-random-copy.sh @@ -43,4 +43,4 @@ requires_nbdcopy requires_libnbd_version 1.5.9 # Copy from self to self which is what this plugin is intended for. -nbdkit -U - sparse-random size=10G --run 'nbdcopy "$uri" "$uri"' +nbdkit sparse-random size=10G --run 'nbdcopy "$uri" "$uri"' diff --git a/tests/test-sparse-random-info.sh b/tests/test-sparse-random-info.sh index a98f49a1a..cd014109a 100755 --- a/tests/test-sparse-random-info.sh +++ b/tests/test-sparse-random-info.sh @@ -43,4 +43,4 @@ if ! nbdinfo --help | grep -- --map ; then exit 77 fi -nbdkit -U - sparse-random size=10G --run 'nbdinfo --map "$uri"' +nbdkit sparse-random size=10G --run 'nbdinfo --map "$uri"' diff --git a/tests/test-split-extents.sh b/tests/test-split-extents.sh index 0387dd139..6dad0e5b2 100755 --- a/tests/test-split-extents.sh +++ b/tests/test-split-extents.sh @@ -57,7 +57,7 @@ printf %$((512*1024))d 1 >> test-split-extents.2 $TRUNCATE -s 1M test-split-extents.2 # Test the split plugin -nbdkit -v -U - split test-split-extents.1 test-split-extents.2 \ +nbdkit -v split test-split-extents.1 test-split-extents.2 \ --run 'nbdsh --base-allocation --uri "$uri" -c " entries = [] def f(metacontext, offset, e, err): diff --git a/tests/test-ssh.sh b/tests/test-ssh.sh index eccab1518..ef3d9537d 100755 --- a/tests/test-ssh.sh +++ b/tests/test-ssh.sh @@ -55,7 +55,7 @@ rm -f $files cleanup_fn rm -f $files # Copy 'disk' from the "remote" ssh server to local file 'ssh.img' -nbdkit -v -D ssh.log=2 -U - \ +nbdkit -v -D ssh.log=2 \ ssh host=localhost $PWD/disk \ --run 'nbdcopy "$uri" ssh.img' @@ -64,7 +64,7 @@ cmp disk ssh.img # Copy local file 'ssh.img' to newly created "remote" 'ssh2.img' size="$($STAT -c %s disk)" -nbdkit -v -D ssh.log=2 -U - \ +nbdkit -v -D ssh.log=2 \ ssh host=localhost $PWD/ssh2.img \ create=true create-size=$size \ --run 'nbdcopy ssh.img "$uri"' diff --git a/tests/test-stdio.sh b/tests/test-stdio.sh index b8c18a82a..eba9236a4 100755 --- a/tests/test-stdio.sh +++ b/tests/test-stdio.sh @@ -60,7 +60,7 @@ grep "input=string1" test-stdio.out grep "rest=string2" test-stdio.out # Test with --run. -nbdkit -U - -v $plugin one=1 --run 'printf cmd=; cat' \ +nbdkit -v $plugin one=1 --run 'printf cmd=; cat' \ < test-stdio.in > test-stdio.out cat test-stdio.out grep "one=string1" test-stdio.out diff --git a/tests/test-swab-16w.sh b/tests/test-swab-16w.sh index dd461a1f0..dda477ece 100755 --- a/tests/test-swab-16w.sh +++ b/tests/test-swab-16w.sh @@ -47,7 +47,7 @@ cleanup_fn rm -f $file $TRUNCATE -s 512 $file # Write to the file through the filter. -nbdkit -U - --filter=swab file $file --run ' +nbdkit --filter=swab file $file --run ' nbdsh --uri "$uri" -c "h.pwrite(b\"abcdefghijklmnop\", 256)" ' diff --git a/tests/test-swab-32w.sh b/tests/test-swab-32w.sh index ccaf64fca..f764d874b 100755 --- a/tests/test-swab-32w.sh +++ b/tests/test-swab-32w.sh @@ -47,7 +47,7 @@ cleanup_fn rm -f $file $TRUNCATE -s 512 $file # Write to the file through the filter. -nbdkit -U - --filter=swab file $file swab-bits=32 --run ' +nbdkit --filter=swab file $file swab-bits=32 --run ' nbdsh --uri "$uri" -c "h.pwrite(b\"abcdefghijklmnop\", 256)" ' diff --git a/tests/test-swab-64w.sh b/tests/test-swab-64w.sh index 2a908f657..3d32bb0b8 100755 --- a/tests/test-swab-64w.sh +++ b/tests/test-swab-64w.sh @@ -47,7 +47,7 @@ cleanup_fn rm -f $file $TRUNCATE -s 512 $file # Write to the file through the filter. -nbdkit -U - --filter=swab file $file swab-bits=64 --run ' +nbdkit --filter=swab file $file swab-bits=64 --run ' nbdsh --uri "$uri" -c "h.pwrite(b\"abcdefghijklmnop\", 256)" ' diff --git a/tests/test-swab-8.sh b/tests/test-swab-8.sh index 873ee686a..9da8c9643 100755 --- a/tests/test-swab-8.sh +++ b/tests/test-swab-8.sh @@ -43,9 +43,9 @@ files="swab-8.expected swab-8.actual" rm -f $files cleanup_fn rm -f $files -nbdkit -U - pattern size=$((128*1024)) \ +nbdkit pattern size=$((128*1024)) \ --run 'nbdcopy "$uri" swab-8.expected' -nbdkit -U - --filter=swab pattern size=$((128*1024)) swab-bits=8 \ +nbdkit --filter=swab pattern size=$((128*1024)) swab-bits=8 \ --run 'nbdcopy "$uri" swab-8.actual' cmp swab-8.expected swab-8.actual diff --git a/tests/test-swab-extents.sh b/tests/test-swab-extents.sh index 68fd3bdcb..cacac5e41 100755 --- a/tests/test-swab-extents.sh +++ b/tests/test-swab-extents.sh @@ -122,7 +122,7 @@ print(entries) # Now to test the combinations: for bits in 8 16 32 64; do for exts in "$all" "$one"; do - nbdkit -U - --filter=swab eval swab-bits=$bits \ + nbdkit --filter=swab eval swab-bits=$bits \ get_size='echo 48' pread='exit 1' extents="$exts" \ --run 'nbdsh --base-allocation -u "$uri" -c "$script"' \ > swab-extents.out || fail=1 diff --git a/tests/test-tar-info-xz-qcow2dec.sh b/tests/test-tar-info-xz-qcow2dec.sh index f8a4f54c7..005d6a704 100755 --- a/tests/test-tar-info-xz-qcow2dec.sh +++ b/tests/test-tar-info-xz-qcow2dec.sh @@ -62,7 +62,7 @@ tar cf $tar $disk xz --best --block-size=32768 $tar # Run nbdkit. -nbdkit -U - file $tar_xz \ +nbdkit file $tar_xz \ --filter=qcow2dec \ --filter=tar tar-entry=$disk \ --filter=xz \ @@ -79,7 +79,7 @@ test "$( jq -r -c '.["format"]' $out )" = "raw" # Use nbdcopy to copy the output to a new file, and compare it to the # original disk. export raw -nbdkit -U - file $tar_xz \ +nbdkit file $tar_xz \ --filter=qcow2dec \ --filter=tar tar-entry=$disk \ --filter=xz \ diff --git a/tests/test-tar-info-xz.sh b/tests/test-tar-info-xz.sh index 064ee8eba..d9c0915b7 100755 --- a/tests/test-tar-info-xz.sh +++ b/tests/test-tar-info-xz.sh @@ -59,7 +59,7 @@ tar cf $tar $disk xz --best --block-size=32768 $tar # Run nbdkit. -nbdkit -U - file $tar_xz \ +nbdkit file $tar_xz \ --filter=tar tar-entry=$disk \ --filter=xz \ --run 'qemu-img info --output=json $nbd' > $out diff --git a/tests/test-tar-info.sh b/tests/test-tar-info.sh index 3f98999db..0e9ce5bb4 100755 --- a/tests/test-tar-info.sh +++ b/tests/test-tar-info.sh @@ -56,7 +56,7 @@ qemu-img convert -f raw disk -O qcow2 $disk tar cf $tar $disk # Run nbdkit. -nbdkit -U - file $tar \ +nbdkit file $tar \ --filter=tar tar-entry=$disk \ --run 'qemu-img info --output=json $nbd' > $out cat $out diff --git a/tests/test-tar-limit.sh b/tests/test-tar-limit.sh index 168f2c497..ef9239a62 100755 --- a/tests/test-tar-limit.sh +++ b/tests/test-tar-limit.sh @@ -55,7 +55,7 @@ tar cf $tar_good disk tar cf $tar_bad $tar_filler disk # Check we can read the good disk and reject the bad disk. -cmd="nbdkit -U - file --filter=tar tar-entry=disk tar-limit=131072" +cmd="nbdkit file --filter=tar tar-entry=disk tar-limit=131072" $cmd $tar_good --run 'nbdinfo "$uri"' diff --git a/tests/test-tls.sh b/tests/test-tls.sh index cf570a9ec..1e284a421 100755 --- a/tests/test-tls.sh +++ b/tests/test-tls.sh @@ -49,7 +49,7 @@ if ! nbdkit --dump-config | grep -sq tls=yes; then fi # RHEL 7 GnuTLS did not support --tls-verify-peer. -requires nbdkit --tls-verify-peer -U - null --run 'exit 0' +requires nbdkit --tls-verify-peer null --run 'exit 0' # Did we create the PKI files? # Probably 'certtool' is missing. diff --git a/tests/test-tmpdisk-command.sh b/tests/test-tmpdisk-command.sh index 4254d20ce..55183d48c 100755 --- a/tests/test-tmpdisk-command.sh +++ b/tests/test-tmpdisk-command.sh @@ -41,7 +41,7 @@ requires_nbdsh_uri # - If multiple parameters appear, last one is used. # - Test quoting. # - size=0 because we ignore it in the command itself. -nbdkit -f -v -U - tmpdisk 0 a=2 a=1 b=1024 c="a ' b ' c" \ +nbdkit -f -v tmpdisk 0 a=2 a=1 b=1024 c="a ' b ' c" \ TRUNCATE="$TRUNCATE" \ command=' set -x diff --git a/tests/test-truncate-extents.sh b/tests/test-truncate-extents.sh index 85276c547..05120ce66 100755 --- a/tests/test-truncate-extents.sh +++ b/tests/test-truncate-extents.sh @@ -52,7 +52,7 @@ cleanup_fn rm -f $files do_test () { # We use jq to normalize the output and convert it to plain text. - nbdkit -U - \ + nbdkit \ --filter=truncate \ data "$1" size="$2" \ truncate="$3" \ diff --git a/tests/test-vddk-password-fd.sh b/tests/test-vddk-password-fd.sh index 1ccaee070..34302e6dd 100755 --- a/tests/test-vddk-password-fd.sh +++ b/tests/test-vddk-password-fd.sh @@ -54,7 +54,7 @@ export DUMMY_VDDK_PRINT_PASSWORD=1 # Password -FD. echo 123 > $f exec 3< $f -nbdkit -fv -U - vddk \ +nbdkit -fv vddk \ libdir=.libs \ server=noserver.example.com thumbprint=ab \ vm=novm /nofile \ @@ -69,7 +69,7 @@ grep "password=123$" $out # Password -FD, zero length. : > $f exec 3< $f -nbdkit -fv -U - vddk \ +nbdkit -fv vddk \ libdir=.libs \ server=noserver.example.com thumbprint=ab \ vm=novm /nofile \ diff --git a/tests/test-vddk-password-interactive.sh b/tests/test-vddk-password-interactive.sh index f9173da7b..5bc740582 100755 --- a/tests/test-vddk-password-interactive.sh +++ b/tests/test-vddk-password-interactive.sh @@ -54,7 +54,7 @@ export DUMMY_VDDK_PRINT_PASSWORD=1 export out expect -f - <<'EOF' spawn sh -c " - nbdkit -fv -U - \ + nbdkit -fv \ vddk \ libdir=.libs \ server=noserver.example.com thumbprint=ab \ diff --git a/tests/test-vddk-real-create.sh b/tests/test-vddk-real-create.sh index 422bbcec8..841b1d223 100755 --- a/tests/test-vddk-real-create.sh +++ b/tests/test-vddk-real-create.sh @@ -56,7 +56,7 @@ cleanup_fn rm -f $files size="$($STAT -c %s disk)" -nbdkit -fv -U - vddk libdir="$vddkdir" $vmdk \ +nbdkit -fv vddk libdir="$vddkdir" $vmdk \ create=true create-size=$size \ --run 'nbdcopy disk $uri' diff --git a/tests/test-vddk-real.sh b/tests/test-vddk-real.sh index 667b6fc20..8b06d6722 100755 --- a/tests/test-vddk-real.sh +++ b/tests/test-vddk-real.sh @@ -71,7 +71,7 @@ qemu-img create -f vmdk $vmdk 10M # Check first that the VDDK library can be fully loaded. We have to # check the log file for missing modules since they may not show up as # errors. -nbdkit -fv -U - vddk libdir="$vddkdir" $vmdk --run 'nbdinfo "$uri"' 2>&1 | +nbdkit -fv vddk libdir="$vddkdir" $vmdk --run 'nbdinfo "$uri"' 2>&1 | tee $log # Check the log for missing modules diff --git a/tests/test-vddk-reexec.sh b/tests/test-vddk-reexec.sh index 939bf1fb3..54a4ec02d 100755 --- a/tests/test-vddk-reexec.sh +++ b/tests/test-vddk-reexec.sh @@ -42,10 +42,10 @@ requires_run # uninstalled, our wrapper nbdkit also modifies LD_LIBRARY_PATH, so we # need to capture an expected value from what leaks through an # innocuous plugin. -expect_LD_LIBRARY_PATH=$(nbdkit -U - zero --run 'echo "$LD_LIBRARY_PATH"') +expect_LD_LIBRARY_PATH=$(nbdkit zero --run 'echo "$LD_LIBRARY_PATH"') export expect_LD_LIBRARY_PATH -nbdkit -U - vddk libdir=.libs /dev/null \ +nbdkit vddk libdir=.libs /dev/null \ --run 'echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" echo "expect_LD_LIBRARY_PATH=$expect_LD_LIBRARY_PATH" test "$LD_LIBRARY_PATH" = "$expect_LD_LIBRARY_PATH"' diff --git a/tests/test-vddk-run.sh b/tests/test-vddk-run.sh index 260c94bef..7901e7efa 100755 --- a/tests/test-vddk-run.sh +++ b/tests/test-vddk-run.sh @@ -44,7 +44,7 @@ out=test-vddk-run.out rm -f $out cleanup_fn rm -f $out -nbdkit -U - vddk libdir=.libs /dev/null --run 'nbdinfo $nbd' > $out +nbdkit vddk libdir=.libs /dev/null --run 'nbdinfo $nbd' > $out cat $out grep -E 'export-size: 524288\b' $out diff --git a/tests/test-zero.sh b/tests/test-zero.sh index 6bd79f80a..78865c9ed 100755 --- a/tests/test-zero.sh +++ b/tests/test-zero.sh @@ -41,7 +41,7 @@ files="test-zero.out" rm -f $files cleanup_fn rm -f $files -nbdkit -U - zero --run 'nbdcopy "$uri" test-zero.out' +nbdkit zero --run 'nbdcopy "$uri" test-zero.out' # Resulting file should be zero-sized. test -f test-zero.out -- 2.41.0
Richard W.M. Jones
2023-Sep-09 13:57 UTC
[Libguestfs] [PATCH nbdkit 10/10] XXX docs: Remove references to -U - when it is implicit
XXX NOTE XXX I would not apply this patch immediately, since online documentation will get updated as soon as I do that. Best to wait until after 1.36 is released at least. XXX END NOTE XXX --- docs/nbdkit-captive.pod | 6 +++--- filters/cacheextents/nbdkit-cacheextents-filter.pod | 2 +- filters/checkwrite/nbdkit-checkwrite-filter.pod | 6 +++--- filters/pause/nbdkit-pause-filter.pod | 2 +- filters/retry/nbdkit-retry-filter.pod | 2 +- plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod | 4 ++-- plugins/nbd/nbdkit-nbd-plugin.pod | 2 +- plugins/random/nbdkit-random-plugin.pod | 2 +- plugins/sparse-random/nbdkit-sparse-random-plugin.pod | 2 +- plugins/torrent/nbdkit-torrent-plugin.pod | 6 +++--- plugins/vddk/nbdkit-vddk-plugin.pod | 4 ++-- BENCHMARKING | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/nbdkit-captive.pod b/docs/nbdkit-captive.pod index 248f9df28..4f9740bc9 100644 --- a/docs/nbdkit-captive.pod +++ b/docs/nbdkit-captive.pod @@ -46,7 +46,7 @@ When guestfish exits, nbdkit is killed. Running nbdkit captive under nbdsh for unit testing: - nbdkit -U - memory 1 --run 'nbdsh -u "$uri" -c "print(h.pread(1, 0))"' + nbdkit memory 1 --run 'nbdsh -u "$uri" -c "print(h.pread(1, 0))"' The following shell variables are available in the I<--run> argument: @@ -104,7 +104,7 @@ Captive nbdkit + L<qemu-img(1)> can be used to copy data into and out of nbdkit plugins. For example L<nbdkit-example1-plugin(1)> contains an embedded disk image. To copy it out: - nbdkit -U - example1 --run 'qemu-img convert $nbd disk.img' + nbdkit example1 --run 'qemu-img convert $nbd disk.img' If the source suffers from temporary network failures L<nbdkit-retry-filter(1)> or L<nbdkit-retry-request-filter(1)> may @@ -114,7 +114,7 @@ To overwrite a file inside an uncompressed tar file (the file being overwritten must be the same size), use L<nbdkit-tar-filter(1)> like this: - nbdkit -U - file data.tar --filter=tar tar-entry=disk.img \ + nbdkit file data.tar --filter=tar tar-entry=disk.img \ --run 'qemu-img convert -n disk.img $nbd' =head1 EXIT WITH PARENT diff --git a/filters/cacheextents/nbdkit-cacheextents-filter.pod b/filters/cacheextents/nbdkit-cacheextents-filter.pod index 77dc680c8..a2b2aa519 100644 --- a/filters/cacheextents/nbdkit-cacheextents-filter.pod +++ b/filters/cacheextents/nbdkit-cacheextents-filter.pod @@ -17,7 +17,7 @@ only one extent at a time (such as S<C<qemu-img convert>>), but where the plugin can provide multiple extents for the same high latency as a single extent (such as L<nbdkit-vddk-plugin(1)>). For example: - nbdkit -U - --filter=cacheextents --run 'qemu-img map $nbd' vddk ... + nbdkit --filter=cacheextents --run 'qemu-img map $nbd' vddk ... For files with big extents (when it is unlikely for one extents() call to return multiple different extents) this does not slow down the diff --git a/filters/checkwrite/nbdkit-checkwrite-filter.pod b/filters/checkwrite/nbdkit-checkwrite-filter.pod index 67a466f87..6855d7988 100644 --- a/filters/checkwrite/nbdkit-checkwrite-filter.pod +++ b/filters/checkwrite/nbdkit-checkwrite-filter.pod @@ -28,17 +28,17 @@ You can check that a copying tool is copying data correctly by creating an nbdkit instance containing some test data, overlaying this filter, and copying from and to nbdkit at the same time: - nbdkit -U - --filter=checkwrite data "@32768 1" \ + nbdkit --filter=checkwrite data "@32768 1" \ --run 'nbdcopy "$uri" "$uri"' =for paragraph - nbdkit -U - --filter=checkwrite file disk.img \ + nbdkit --filter=checkwrite file disk.img \ --run 'nbdcopy "$uri" "$uri"' =for paragraph - nbdkit -U - --filter=checkwrite linuxdisk testdir/ \ + nbdkit --filter=checkwrite linuxdisk testdir/ \ --run 'qemu-img convert -n "$uri" "$uri"' If the copying program is buggy then you will see EIO errors and (if diff --git a/filters/pause/nbdkit-pause-filter.pod b/filters/pause/nbdkit-pause-filter.pod index 1bc083ddc..708e0b3ea 100644 --- a/filters/pause/nbdkit-pause-filter.pod +++ b/filters/pause/nbdkit-pause-filter.pod @@ -39,7 +39,7 @@ Any unknown commands are ignored. The filter responds with C<'X'>. Pick a large file, disk image or ISO, serve it over NBD, and start copying it: - nbdkit -U - --filter=pause --filter=rate \ + nbdkit --filter=pause --filter=rate \ file BIG_FILE.ISO rate=10M pause-control=sock \ --run 'qemu-img convert -p $nbd /var/tmp/out' diff --git a/filters/retry/nbdkit-retry-filter.pod b/filters/retry/nbdkit-retry-filter.pod index 6eba3d4ff..6179a507d 100644 --- a/filters/retry/nbdkit-retry-filter.pod +++ b/filters/retry/nbdkit-retry-filter.pod @@ -50,7 +50,7 @@ waiting in total about 1 minute before we give up. In this example we copy and convert a large file using L<nbdkit-ssh-plugin(1)>, L<qemu-img(1)> and L<nbdkit-captive(1)>. - nbdkit -U - \ + nbdkit \ ssh host=remote.example.com /var/tmp/test.iso \ --filter=retry \ --run 'qemu-img convert -p -f raw $nbd -O qcow2 test.qcow2' diff --git a/plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod b/plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod index 179923518..9f78367ad 100644 --- a/plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod +++ b/plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod @@ -57,7 +57,7 @@ Instead of serving a partitioned disk image, serve just the "naked" filesystem (ie. the first partition, see L<nbdkit-partition-filter(1)>). -=item nbdkit -U - linuxdisk /path/to/directory +=item nbdkit linuxdisk /path/to/directory --run 'nbdcopy "$uri" ext2fs.img' This serves nothing. Instead it turns a directory into a disk image, @@ -77,7 +77,7 @@ have that. ln root/sbin/busybox root/sbin/init ln root/sbin/busybox root/bin/ls ln root/sbin/busybox root/bin/sh - nbdkit -U - linuxdisk root --run ' + nbdkit linuxdisk root --run ' qemu-kvm -display none -kernel /boot/vmlinuz -drive file=nbd:unix:$unixsocket,snapshot=on -append "console=ttyS0 root=/dev/sda1 rw" -serial stdio ' diff --git a/plugins/nbd/nbdkit-nbd-plugin.pod b/plugins/nbd/nbdkit-nbd-plugin.pod index fc89b9c56..96d2f289d 100644 --- a/plugins/nbd/nbdkit-nbd-plugin.pod +++ b/plugins/nbd/nbdkit-nbd-plugin.pod @@ -298,7 +298,7 @@ style. Use I<--run> to clean up nbdkit at the time the client exits. In general, note that it is best to keep the plaintext connection limited to a Unix socket on the local machine. - nbdkit -U - -o --tls=off nbd hostname=example.com export=foo tls=require \ + nbdkit -o --tls=off nbd hostname=example.com export=foo tls=require \ --run '/path/to/oldclient --socket=$unixsocket' =for paragraph diff --git a/plugins/random/nbdkit-random-plugin.pod b/plugins/random/nbdkit-random-plugin.pod index 0d6da8d5f..cd0a37df7 100644 --- a/plugins/random/nbdkit-random-plugin.pod +++ b/plugins/random/nbdkit-random-plugin.pod @@ -27,7 +27,7 @@ same offset (if not, it returns EIO error). You can use this to test copying programs by making the source and destination NBD URIs be the same: - nbdkit -U - random size=100M --run 'nbdcopy "$uri" "$uri"' + nbdkit random size=100M --run 'nbdcopy "$uri" "$uri"' C<qemu-img convert> could be used in place of nbdcopy. See also L<nbdkit-checkwrite-filter(1)>. diff --git a/plugins/sparse-random/nbdkit-sparse-random-plugin.pod b/plugins/sparse-random/nbdkit-sparse-random-plugin.pod index 5636e76c4..8a6fbf42a 100644 --- a/plugins/sparse-random/nbdkit-sparse-random-plugin.pod +++ b/plugins/sparse-random/nbdkit-sparse-random-plugin.pod @@ -42,7 +42,7 @@ Writes to the disk verify that the data written is the same as the data read (if not, returning EIO). Thus when testing copies you can use a single instance of this plugin for both read and write: - nbdkit -U - sparse-random size=1T --run 'nbdcopy "$uri" "$uri"' + nbdkit sparse-random size=1T --run 'nbdcopy "$uri" "$uri"' C<qemu-img convert> could be used in place of nbdcopy. See also L<nbdkit-checkwrite-filter(1)>. diff --git a/plugins/torrent/nbdkit-torrent-plugin.pod b/plugins/torrent/nbdkit-torrent-plugin.pod index b29990f51..744db124d 100644 --- a/plugins/torrent/nbdkit-torrent-plugin.pod +++ b/plugins/torrent/nbdkit-torrent-plugin.pod @@ -47,7 +47,7 @@ Choose the right URL from L<https://torrent.fedoraproject.org/>: url=https://torrent.fedoraproject.org/torrents/Fedora-Server-dvd-x86_64-32.torrent wget $url - nbdkit -U - torrent Fedora-Server-*.torrent \ + nbdkit torrent Fedora-Server-*.torrent \ --run 'qemu-system-x86_64 -m 2048 -cdrom $nbd -boot d' =head2 Boot the Debian installer @@ -56,7 +56,7 @@ Choose the right URL from L<https://www.debian.org/CD/torrent-cd/>: url=https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-10.4.0-amd64-DVD-1.iso.torrent wget $url - nbdkit -U - torrent debian-*.torrent \ + nbdkit torrent debian-*.torrent \ --run 'qemu-system-x86_64 -m 2048 -cdrom $nbd -boot d' =head1 PARAMETERS @@ -99,7 +99,7 @@ torrent, so if the torrent contains subdirectories you may need to use a path like C<file=SUBDIR/DISK>. To list all the files within the torrent try running: - $ nbdkit -fv -U - torrent file.torrent + $ nbdkit -fv torrent file.torrent and examining the debug output. As an alternative you can use standard BitTorrent tools, eg: diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod index 704ff63c7..49010db2d 100644 --- a/plugins/vddk/nbdkit-vddk-plugin.pod +++ b/plugins/vddk/nbdkit-vddk-plugin.pod @@ -53,7 +53,7 @@ of a disk image. Note the C<create-size> parameter is the virtual size of the final VMDK disk image and must be at least as large as the input disk: - nbdkit -U - vddk \ + nbdkit vddk \ /absolute/path/to/output.vmdk \ create=true create-size=100M \ --run 'qemu-img convert input.qcow2 $uri' @@ -456,7 +456,7 @@ using this command: Another way to get the thumbprint of a server is to connect to the server using a bogus thumbprint with debugging enabled: - nbdkit -U - -fv vddk server=esxi.example.com [...] thumbprint=12 \ + nbdkit -fv vddk server=esxi.example.com [...] thumbprint=12 \ --run 'qemu-img info "$uri"' The nbdkit process will try to connect (and fail because the diff --git a/BENCHMARKING b/BENCHMARKING index 462266642..195cd732b 100644 --- a/BENCHMARKING +++ b/BENCHMARKING @@ -128,9 +128,9 @@ the qemu client support sparseness detection and efficient zeroing. To test copying speed you can use ?qemu-img convert?, to or from nbdkit: - nbdkit -U - memory 1G --run 'qemu-img convert file.qcow2 -O raw $nbd' + nbdkit memory 1G --run 'qemu-img convert file.qcow2 -O raw $nbd' - nbdkit -U - memory 1G --run 'qemu-img convert $nbd -O qcow2 file.qcow2' + nbdkit memory 1G --run 'qemu-img convert $nbd -O qcow2 file.qcow2' Notes: -- 2.41.0
On Sat, Sep 09, 2023 at 02:57:48PM +0100, Richard W.M. Jones wrote:> Should have done this a long time ago. I feel it is about time we > change the default of nbdkit --run to imply -U -, rather than opening > a public port. > > Patch series turned out to be a little bit more complicated than I > anticipated, but it contains some nice clean ups.Indeed, just from the summary it sounds like a good idea. nbdkit can take advantage of it immediately, but libnbd will need to continue to explicitly use -U - for a while longer (as long as older nbdkit tends to be the version still installed on various CI platforms).> > Last patch updating the documentation wouldn't be applied any time > soon, so that the old docs stay around on the website.Also a good idea. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org