Subject: Re: [PATCH v3 10/34] t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Fri, 02 Jul 2021 00:41:22 +0200

On Thu, Jul 01 2021, Jeff Hostetler via GitGitGadget wrote:

> From: Jeff Hostetler <[email-masked]>
>
> Create an IPC client to send query and flush commands to the daemon.
>
> Signed-off-by: Jeff Hostetler <[email-masked]>
> ---
>  Makefile                         |   1 +
>  t/helper/test-fsmonitor-client.c | 121 +++++++++++++++++++++++++++++++
>  t/helper/test-tool.c             |   1 +
>  t/helper/test-tool.h             |   1 +
>  4 files changed, 124 insertions(+)
>  create mode 100644 t/helper/test-fsmonitor-client.c
>
> diff --git a/Makefile b/Makefile
> index 8fe1e42a435..c45caacf2c3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -709,6 +709,7 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
>  TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
>  TEST_BUILTINS_OBJS += test-example-decorate.o
>  TEST_BUILTINS_OBJS += test-fast-rebase.o
> +TEST_BUILTINS_OBJS += test-fsmonitor-client.o
>  TEST_BUILTINS_OBJS += test-genrandom.o
>  TEST_BUILTINS_OBJS += test-genzeros.o
>  TEST_BUILTINS_OBJS += test-hash-speed.o
> diff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c
> new file mode 100644
> index 00000000000..f7a5b3a32fa
> --- /dev/null
> +++ b/t/helper/test-fsmonitor-client.c
> @@ -0,0 +1,121 @@
> +/*
> + * test-fsmonitor-client.c: client code to send commands/requests to
> + * a `git fsmonitor--daemon` daemon.
> + */
> +
> +#include "test-tool.h"
> +#include "cache.h"
> +#include "parse-options.h"
> +#include "fsmonitor-ipc.h"
> +
> +#ifndef HAVE_FSMONITOR_DAEMON_BACKEND
> +int cmd__fsmonitor_client(int argc, const char **argv)
> +{
> +	die("fsmonitor--daemon not available on this platform");
> +}
> +#else

Re my earlier comments on excessive ifdefs: In this case don't we just
want to not compile test-fsmonitor-client at all unless
HAVE_FSMONITOR_DAEMON_BACKEND is true.

You'll get the same error as though you ran "helper/test-tool
does-not-exist", but the tests check for the prerequisite earlier
anyway, so why get this far on an unsupported platform for a pure test
helper?