Web lists-archives.com

Re: [PATCH 4/6] fsmonitor: Make output of test-dump-fsmonitor more concise






On 1/4/2018 5:33 PM, Johannes Schindelin wrote:
Hi Alex,

On Tue, 2 Jan 2018, Alex Vandiver wrote:

Rather than display one very long line, summarize the contents of that
line.  The tests do not currently rely on any content except the first
line ("no fsmonitor" / "fsmonitor last update").

The more interesting part would be the entries with outdated ("invalid")
information. I thought that this information was pretty useful for
debugging. Maybe we could still keep at least that part, or at least
trigger outputting it via a command-line flag?


During the development and testing of fsmonitor, I found the '+-' to be helpful (especially since it is in index order). I could touch a file and verify that it showed up as invalid and that it was the file I expected by its placement in the index.

I'd hate to have to add options to a test program for more/less output. I do like your additions of the time since updated and the final counts. I prefer more information rather than less in my test tools - how about this?


diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index 5d61b0d621..8503da288d 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -20,11 +20,13 @@ int cmd_main(int ac, const char **av)
               (uintmax_t)istate->fsmonitor_last_update,
               (now - istate->fsmonitor_last_update)/1.0e9);

-       for (i = 0; i < istate->cache_nr; i++)
+       for (i = 0; i < istate->cache_nr; i++) {
+ printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-");
                if (istate->cache[i]->ce_flags & CE_FSMONITOR_VALID)
                        valid++;
+       }

-       printf("  valid: %d\n", valid);
+       printf("\n  valid: %d\n", valid);
        printf("  invalid: %d\n", istate->cache_nr - valid);

        return 0;


Ciao,
Johannes