git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 01/11] t: add tool to translate hash-related values

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Aug 19, 2018, 23:56 UTC
Message-ID
<20180819235603.GK70480@genre.crustytoothpaste.net>
In-Reply-To
<CAPig+cRSUDAdE2ECcH+b8h4urJySaS_VybQdHNv24rad_kFEag@mail.gmail.com>
On Sun, Aug 19, 2018 at 07:06:14PM -0400, Eric Sunshine wrote:
Show 11 quoted lines
> On Sun, Aug 19, 2018 at 5:50 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > I think what I'd like to do instead is store in a variable and make
> > test_oid return unsuccessfully if the value doesn't exist.  I think
> > that's better for writing tests overall and will accomplish the same
> > goal.
> 
> My knee-jerk reaction is that could get clunky in practice, but
> perhaps I'm not seeing the full picture.
> 
> An alternative would be to return a distinguished error value.

We already do it in several other places in the testsuite when we want to check the exit status of a command substitution, so I think it will end up being fine. I'd like to try it and see.

I think that we need to fix the return code either way, though.
Show 14 quoted lines
> > Putting them in a separate directory makes it possible to do something
> > like this:
> >
> >    (cd t && ./t0002-* --verbose)
> >
> > and then use shell editing to change the command line.  If we put them
> > in the same directory as the tests, we make developers' lives a bit
> > harder.
> 
> Perhaps I'm missing something obvious, but I'm not following what
> you're trying to convey.
> 
> Okay, thinking upon this further, I guess you mean people who type
> your example directly rather than using "./t0002-*.sh" or something.
Right.  It also makes completion nicer (in Vim at least).
Show 12 quoted lines
> I'm still open to the idea of supporting experimentation with other
> hash algorithms and I see how lumping all the OID tables into a single
> directory can make it easy to locate everything that will require
> adjustment for a new algorithm. But, this information can also be
> gleaned via a simple grep for "test_oid_cache", so I'm not sure the
> lumped-directory approach buys much.
> 
> Also, my gut feeling is that such experimentation will be very rare,
> whereas the addition of new tests which have some sort of
> OID-dependency will likely be a more frequent occurrence. And, the
> locality of an OID-table plopped down right next to the test which
> requires it seems a win (in my mind).
Okay.  I'll do that, and we'll see how it works.
Show 10 quoted lines
> However, I'm sympathetic to the ugliness each caller having to specify
> "$TEST_DIRECTORY/...". In my review of 2/11, I suggested the idea of a
> test_oid_init() function which could load those common OID tables for
> scripts which need them, thus hiding that ugliness. Another idea which
> has some appeal is to define an $OIDDB variable (or some such name)
> with value "$TEST_DIRECTORY/oid-info", which lets callers use:
> 
>     test_oid_cache <"$OIDDB/bloop"
> 
> which isn't so bad.

I'll stuff in a test_oid_init function. I think I like that approach the best.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Eric SunshineNext: brian m. carlson
Message 6 of 24 in “Hash-independent tests (part 3)”
  1. 00/11 Hash-independent tests (part 3)brian m. carlson, Aug 19, 2018
  2. 01/11 t: add tool to translate hash-related valuesbrian m. carlson, Aug 19, 2018
  3. Eric SunshineAug 19, 2018
  4. brian m. carlsonAug 19, 2018
  5. Eric SunshineAug 19, 2018
  6. brian m. carlsonAug 19, 2018
  7. 02/11 t0000: use hash translation tablebrian m. carlson, Aug 19, 2018
  8. Eric SunshineAug 19, 2018
  9. 03/11 t0000: update tests for SHA-256brian m. carlson, Aug 19, 2018
  10. Eric SunshineAug 19, 2018
  11. brian m. carlsonAug 19, 2018
  12. 04/11 t0002: abstract away SHA-1 specific constantsbrian m. carlson, Aug 19, 2018
  13. Eric SunshineAug 19, 2018
  14. 05/11 t0027: make hash size independentbrian m. carlson, Aug 19, 2018
  15. Eric SunshineAug 19, 2018
  16. brian m. carlsonAug 19, 2018
  17. Eric SunshineAug 19, 2018
  18. Torsten BögershausenAug 20, 2018
  19. 06/11 t0064: make hash size independentbrian m. carlson, Aug 19, 2018
  20. 07/11 t1006: make hash size independentbrian m. carlson, Aug 19, 2018
  21. 08/11 t1400: switch hard-coded object ID to variablebrian m. carlson, Aug 19, 2018
  22. 09/11 t1405: make hash size independentbrian m. carlson, Aug 19, 2018
  23. 10/11 t1406: make hash-size independentbrian m. carlson, Aug 19, 2018
  24. 11/11 t1407: make hash size independentbrian m. carlson, Aug 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.