{"thread":{"id":"32090","subject":"splitting off shell test framework","startedAt":"2012-11-12T16:37:44Z","lastAt":"2017-08-24T14:23:19Z","messageCount":9,"participants":["Adam Spiers","Felipe Contreras","Pyeron, Jason J CTR (US)","Drew Northup","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202959","messageId":"CAOkDyE8KxFvM4CJhC4U=Jb95D6HQ-4qQBtKAgBMyHH15UOhvqg@mail.gmail.com","threadId":"32090","inReplyTo":null,"subject":"splitting off shell test framework","fromName":"Adam Spiers","fromEmail":"git@adamspiers.org","sentAt":"2012-11-12T16:37:44Z","receivedAt":"2012-11-12T16:37:44Z","isPatch":false,"sender":{"key":"git@adamspiers.org","avatar":"https://avatars.githubusercontent.com/u/100738?v=4"},"body":"Hi all,\n\nI've been pretty impressed with git's test framework, and I'm not\naware of many other (decent) shell-based test frameworks out there.\n(One that springs to mind is the one used by rvm, but last time I\nlooked - admittedly a while ago now - it had limitations).\n\nRecently a situation arose where I craved the ability to test\nsomething via shell.  I did a quick proof of concept and successfully\nextracted out the non-git-specific bits of git's test framework to be\nused to test something entirely unrelated to git:\n\n    https://github.com/aspiers/shell-env/tree/master/t\n\nAs it turned out to be fairly easy, I was wondering if there would be\nany interest in doing this more formally, i.e. splitting off the\nframework so that it could be used and improved outside the scope of\ngit development?  Of course this would pose the question how git would\nconsume this new project without any risk of destabilisation.  I'm\nguessing that simply using a git submodule would solve the problem,\nbut ICBW ...\n\nJust an idea.  Interesting, or terrible? :)\n\nRegards,\nAdam\n"},{"id":"202961","messageId":"CAMP44s2n56c=k4o6wup81Hb3WNzuDLkL30GpMdivQixJX_YOsw@mail.gmail.com","threadId":"32090","inReplyTo":"CAOkDyE8KxFvM4CJhC4U=Jb95D6HQ-4qQBtKAgBMyHH15UOhvqg@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-11-12T16:44:11Z","receivedAt":"2012-11-12T16:44:11Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Nov 12, 2012 at 5:37 PM, Adam Spiers <git@adamspiers.org> wrote:\n\n> I've been pretty impressed with git's test framework, and I'm not\n> aware of many other (decent) shell-based test frameworks out there.\n> (One that springs to mind is the one used by rvm, but last time I\n> looked - admittedly a while ago now - it had limitations).\n>\n> Recently a situation arose where I craved the ability to test\n> something via shell.  I did a quick proof of concept and successfully\n> extracted out the non-git-specific bits of git's test framework to be\n> used to test something entirely unrelated to git:\n>\n>     https://github.com/aspiers/shell-env/tree/master/t\n>\n> As it turned out to be fairly easy, I was wondering if there would be\n> any interest in doing this more formally, i.e. splitting off the\n> framework so that it could be used and improved outside the scope of\n> git development?  Of course this would pose the question how git would\n> consume this new project without any risk of destabilisation.  I'm\n> guessing that simply using a git submodule would solve the problem,\n> but ICBW ...\n\nFWIW, the notmuch project seems to be doing the same; extracting and\nusing git's test framework.\n\n> Just an idea.  Interesting, or terrible? :)\n\nThat I don't know :)\n\n-- \nFelipe Contreras\n"},{"id":"202962","messageId":"871B6C10EBEFE342A772D1159D13208537AA3D5D@umechphj.easf.csd.disa.mil","threadId":"32090","inReplyTo":"CAMP44s2n56c=k4o6wup81Hb3WNzuDLkL30GpMdivQixJX_YOsw@mail.gmail.com","subject":"RE: splitting off shell test framework","fromName":"Pyeron, Jason J CTR (US)","fromEmail":"jason.j.pyeron.ctr@mail.mil","sentAt":"2012-11-12T16:57:46Z","receivedAt":"2012-11-12T16:57:46Z","isPatch":false,"sender":{"key":"jason.j.pyeron.ctr@mail.mil","avatar":null},"body":"> -----Original Message-----\n> From: Felipe Contreras\n> Sent: Monday, November 12, 2012 11:44 AM\n> \n> On Mon, Nov 12, 2012 at 5:37 PM, Adam Spiers <git@adamspiers.org>\n> wrote:\n> \n> > I've been pretty impressed with git's test framework, and I'm not\n> > aware of many other (decent) shell-based test frameworks out there.\n> > (One that springs to mind is the one used by rvm, but last time I\n> > looked - admittedly a while ago now - it had limitations).\n> >\n> > Recently a situation arose where I craved the ability to test\n> > something via shell.  I did a quick proof of concept and successfully\n> > extracted out the non-git-specific bits of git's test framework to be\n> > used to test something entirely unrelated to git:\n> >\n> >     https://github.com/aspiers/shell-env/tree/master/t\n> >\n> > As it turned out to be fairly easy, I was wondering if there would be\n> > any interest in doing this more formally, i.e. splitting off the\n> > framework so that it could be used and improved outside the scope of\n> > git development?  Of course this would pose the question how git\n> would\n> > consume this new project without any risk of destabilisation.  I'm\n> > guessing that simply using a git submodule would solve the problem,\n> > but ICBW ...\n> \n> FWIW, the notmuch project seems to be doing the same; extracting and\n> using git's test framework.\n\n\nThe Apache Maven project is migrating to GIT right now and they just covered a long discussion on the pros and cons of this (sort of). It might be a bit of a read [1] but I can also provide some perspective. The question is asked in reverse in [2] since Maven had them separate and some suggested to merge them.\n\n1: http://mail-archives.apache.org/mod_mbox/maven-dev/201210.mbox/%3cA5D13406-474A-43E6-9708-D5D4DE9BE64C@tesla.io%3e\n2: http://mail-archives.apache.org/mod_mbox/maven-dev/201210.mbox/%3c1349937687.79626.YahooMailNeo@web28903.mail.ir2.yahoo.com%3e \n\n\n\n\n"},{"id":"202981","messageId":"CAM9Z-n=ypt_fyFcPjYD28NNoxnJ2ZSovd1TbERdA8RJY1Va=kA@mail.gmail.com","threadId":"32090","inReplyTo":"CAOkDyE8KxFvM4CJhC4U=Jb95D6HQ-4qQBtKAgBMyHH15UOhvqg@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Drew Northup","fromEmail":"n1xim.email@gmail.com","sentAt":"2012-11-12T18:18:53Z","receivedAt":"2012-11-12T18:18:53Z","isPatch":false,"sender":{"key":"n1xim.email@gmail.com","avatar":null},"body":"On Mon, Nov 12, 2012 at 11:37 AM, Adam Spiers <git@adamspiers.org> wrote:\n> Hi all,\n>\n> I've been pretty impressed with git's test framework, and I'm not\n> aware of many other (decent) shell-based test frameworks out there.\n> (One that springs to mind is the one used by rvm, but last time I\n> looked - admittedly a while ago now - it had limitations).\n>\n> Recently a situation arose where I craved the ability to test\n> something via shell.  I did a quick proof of concept and successfully\n> extracted out the non-git-specific bits of git's test framework to be\n> used to test something entirely unrelated to git:\n>\n>     https://github.com/aspiers/shell-env/tree/master/t\n>\n> As it turned out to be fairly easy, I was wondering if there would be\n> any interest in doing this more formally, i.e. splitting off the\n> framework so that it could be used and improved outside the scope of\n> git development?  Of course this would pose the question how git would\n> consume this new project without any risk of destabilisation.  I'm\n> guessing that simply using a git submodule would solve the problem,\n> but ICBW ...\n>\n> Just an idea.  Interesting, or terrible? :)\n\nDone at least once already:\n\nhttp://comments.gmane.org/gmane.comp.version-control.git/201591\n\n-- \n-Drew Northup\n--------------------------------------------------------------\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"},{"id":"203015","messageId":"CAOkDyE9phgZ4ToWTWa2GYgfVkDknCqWr+KEyqVoHg0RVrVVk9A@mail.gmail.com","threadId":"32090","inReplyTo":"CAM9Z-n=ypt_fyFcPjYD28NNoxnJ2ZSovd1TbERdA8RJY1Va=kA@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Adam Spiers","fromEmail":"git@adamspiers.org","sentAt":"2012-11-12T23:09:56Z","receivedAt":"2012-11-12T23:09:56Z","isPatch":false,"sender":{"key":"git@adamspiers.org","avatar":"https://avatars.githubusercontent.com/u/100738?v=4"},"body":"On Mon, Nov 12, 2012 at 6:18 PM, Drew Northup <n1xim.email@gmail.com> wrote:\n> On Mon, Nov 12, 2012 at 11:37 AM, Adam Spiers <git@adamspiers.org> wrote:\n>> As it turned out to be fairly easy, I was wondering if there would be\n>> any interest in doing this more formally, i.e. splitting off the\n>> framework so that it could be used and improved outside the scope of\n>> git development?  Of course this would pose the question how git would\n>> consume this new project without any risk of destabilisation.  I'm\n>> guessing that simply using a git submodule would solve the problem,\n>> but ICBW ...\n>>\n>> Just an idea.  Interesting, or terrible? :)\n>\n> Done at least once already:\n>\n> http://comments.gmane.org/gmane.comp.version-control.git/201591\n\nNice!  So hopefully someone will submit patches to build a two-way bridge\nvia git subtree.  Having them diverge would be sad.\n"},{"id":"327041","messageId":"CAOkDyE_VhGUzn=PmAVsbaTe1ZeBwBVGpF4Muz5MBckMAB6cf=g@mail.gmail.com","threadId":"32090","inReplyTo":"CAOkDyE9phgZ4ToWTWa2GYgfVkDknCqWr+KEyqVoHg0RVrVVk9A@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Adam Spiers","fromEmail":"git@adamspiers.org","sentAt":"2017-08-23T13:46:30Z","receivedAt":"2017-08-23T13:46:39Z","isPatch":false,"sender":{"key":"git@adamspiers.org","avatar":"https://avatars.githubusercontent.com/u/100738?v=4"},"body":"I got a helpful response to the following question almost 5 years ago:\n\nOn 12 November 2012 at 23:09, Adam Spiers <git@adamspiers.org> wrote:\n> On Mon, Nov 12, 2012 at 6:18 PM, Drew Northup <n1xim.email@gmail.com> wrote:\n>> On Mon, Nov 12, 2012 at 11:37 AM, Adam Spiers <git@adamspiers.org> wrote:\n>>> As it turned out to be fairly easy, I was wondering if there would be\n>>> any interest in doing this more formally, i.e. splitting off the\n>>> framework so that it could be used and improved outside the scope of\n>>> git development?  Of course this would pose the question how git would\n>>> consume this new project without any risk of destabilisation.  I'm\n>>> guessing that simply using a git submodule would solve the problem,\n>>> but ICBW ...\n>>>\n>>> Just an idea.  Interesting, or terrible? :)\n>>\n>> Done at least once already:\n>>\n>> http://comments.gmane.org/gmane.comp.version-control.git/201591\n>\n> Nice!  So hopefully someone will submit patches to build a two-way bridge\n> via git subtree.  Having them diverge would be sad.\n\nbut sadly since then gmane has shuffled off its mortal coil and I can't\nremember / find what this URL referred to.  Please could someone\npoint me at a working link?\n\nMany thanks!\nAdam\n"},{"id":"327046","messageId":"20170823154747.vxtyy2v2ofkxwrkx@sigill.intra.peff.net","threadId":"32090","inReplyTo":"CAOkDyE_VhGUzn=PmAVsbaTe1ZeBwBVGpF4Muz5MBckMAB6cf=g@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-08-23T15:47:47Z","receivedAt":"2017-08-23T15:47:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 23, 2017 at 02:46:30PM +0100, Adam Spiers wrote:\n\n> >> Done at least once already:\n> >>\n> >> http://comments.gmane.org/gmane.comp.version-control.git/201591\n> [...]\n> \n> but sadly since then gmane has shuffled off its mortal coil and I can't\n> remember / find what this URL referred to.  Please could someone\n> point me at a working link?\n\nTry:\n\n  https://public-inbox.org/git/?q=gmane:201591\n\nPublic-inbox uses message-ids as its primary key, but keeps a static\nmapping of gmane articles to message-ids. But the corpus of gmane ids\nisn't growing anymore, and public-inbox URLs can be trivially converted\nto other systems which index on the message id[1].\n\n-Peff\n\n[1] I actually keep a local archive and convert public-inbox URLs into\n    local requests that I view in mutt.\n"},{"id":"327103","messageId":"CAOkDyE9pWFLRQ0cZO03bc3Q9r=AzLHMUQ0kxb4bdsTJowcLz=g@mail.gmail.com","threadId":"32090","inReplyTo":"20170823154747.vxtyy2v2ofkxwrkx@sigill.intra.peff.net","subject":"Re: splitting off shell test framework","fromName":"Adam Spiers","fromEmail":"git@adamspiers.org","sentAt":"2017-08-23T23:23:05Z","receivedAt":"2017-08-23T23:23:12Z","isPatch":false,"sender":{"key":"git@adamspiers.org","avatar":"https://avatars.githubusercontent.com/u/100738?v=4"},"body":"On 23 August 2017 at 16:47, Jeff King <peff@peff.net> wrote:\n> On Wed, Aug 23, 2017 at 02:46:30PM +0100, Adam Spiers wrote:\n>> >> Done at least once already:\n>> >>\n>> >> http://comments.gmane.org/gmane.comp.version-control.git/201591\n>> [...]\n>>\n>> but sadly since then gmane has shuffled off its mortal coil and I can't\n>> remember / find what this URL referred to.  Please could someone\n>> point me at a working link?\n>\n> Try:\n>\n>   https://public-inbox.org/git/?q=gmane:201591\n>\n> Public-inbox uses message-ids as its primary key, but keeps a static\n> mapping of gmane articles to message-ids. But the corpus of gmane ids\n> isn't growing anymore, and public-inbox URLs can be trivially converted\n> to other systems which index on the message id[1].\n\nThanks a lot; that's super helpful!\n\n> [1] I actually keep a local archive and convert public-inbox URLs into\n>     local requests that I view in mutt.\n\nSounds like a neat trick - any scripts / config worth sharing?\n"},{"id":"327131","messageId":"20170824142307.3osmt2uweb3azskl@sigill.intra.peff.net","threadId":"32090","inReplyTo":"CAOkDyE9pWFLRQ0cZO03bc3Q9r=AzLHMUQ0kxb4bdsTJowcLz=g@mail.gmail.com","subject":"Re: splitting off shell test framework","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-08-24T14:23:08Z","receivedAt":"2017-08-24T14:23:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 24, 2017 at 12:23:05AM +0100, Adam Spiers wrote:\n\n> > [1] I actually keep a local archive and convert public-inbox URLs into\n> >     local requests that I view in mutt.\n> \n> Sounds like a neat trick - any scripts / config worth sharing?\n\nIt's probably too specific to my setup, but here it is anyway.\n\nI keep the archive in a normal maildir, which I index with the mairix\ntool (you could do the same thing with maildir-utils or notmuch). New\nmessages get put into the maildir by mutt's auto-move feature after I've\nread them.\n\nThen I have a few keys bound in mutt:\n\n  macro pager,index M '<pipe-message>gmane<enter>'\n  macro pager,index B '<pipe-message>rmairix-gmane<enter>'\n\n(you can tell from the names that these predate public-inbox entirely).\n\nThe \"gmane\" script just opens a browser pointing to the current message\nin the archive, from which I then 'y'ank the URL into the clipboard or\npasting. The network round-trip was necessary for gmane, since the\narticle ids were not predictable. For public-inbox, it's not necessary,\nbut old habits die hard (and it's a nice cross-check that the link\nyou're sending out isn't broken).\n\nHere's that script:\n\n-- >8 --\n#!/bin/sh\n\nmid() {\n  exec webview \"http://public-inbox.org/git/$1\"\n}\n\narticle() {\n  exec webview \"http://public-inbox.org/git/?q=gmane:$1\"\n}\n\nfind_mid() {\n  perl -ne 'if(/^message-id:\\s*<([^>]+)>/i) { print $1, \"\\n\"; exit 0 }'\n}\n\ncase \"$#\" in\n  0) id=`find_mid`\n     case \"$id\" in\n       \"\") echo >&2 \"fatal: unable to extract message-id from stdin\"; exit 1 ;;\n        *) mid \"$id\" ;;\n     esac\n     ;;\n  1) case \"$1\" in\n       *@*) mid \"$1\" ;;\n         *) article \"$1\" ;;\n     esac\n     ;;\n  *) echo >&2 \"fatal: don't know how to handle $# arguments\"; exit 100 ;;\nesac\n-- 8< --\n\nThe \"webview\" command is just a personal wrapper that decides which\nbrowser to use. You could replace it with \"firefox\" or \"chromium\" or\nwhatever.\n\nThe \"rmairix-gmane\" script picks out gmane/public-inbox references and\nre-opens them in mutt. It looks like this:\n\n-- >8 --\n#!/usr/bin/env perl\nuse URI;\nuse URI::Escape;\n\nif (@ARGV) {\n  show_gmane_article($_) foreach @ARGV;\n}\nelse {\n  while(<>) {\n    if (m{http://[^/]*gmane.org/[-\\w/.]+}) {\n      show_gmane_url($&);\n    }\n    if (m{https?://public-inbox.org/git/([^/]+)}) {\n      show_mid(uri_unescape($1));\n    }\n  }\n}\nexit 0;\n\nsub show_mid {\n  system(\"rmairix -t m:\" . quotemeta(shift) . \" </dev/tty\");\n}\n\nsub show_gmane_url {\n  my ($group, $article) = extract_article(shift);\n  show_gmane_article($article);\n}\n\nsub show_gmane_article {\n  my $article = shift;\n  my $mid = gmane_to_mid($article);\n  show_mid($mid) if defined $mid;\n}\n\nsub gmane_to_mid {\n  my $want = shift;\n\n  open(my $map, \"-|\", qw(gunzip -c), \"$ENV{HOME}/.gmane-to-mid.gz\");\n  while (<$map>) {\n    chomp;\n    my ($nr, $mid) = split / /, $_, 2;\n    return $mid if $nr == $want;\n  }\n}\n\nsub extract_article {\n  my @path = URI->new(shift)->path_segments;\n\n  # first one is always empty in absolute URL\n  shift @path unless length($path[0]);\n\n  # group is always next\n  my $group = shift @path;\n\n  # and then look for numbers starting from the back. E.g.,\n  # focus=N for threads, or just \"N\" for articles\n  while (@path) {\n    local $_ = pop @path;\n    return ($group, $&) if /\\d+/;\n  }\n\n  return ($group, undef);\n}\n-- 8< --\n\nThe two extra bits you'd need are:\n\n  - the ~/.gmane-to-mid.gz mapping. I don't remember if I made this\n    myself or stole it from one that Eric posted. I'm happy to share if\n    anybody wants it.\n\n  - rmairix is a personal wrapper around mairix that ssh's to my imap\n    server to do the search and then starts mutt on the result.\n\n    Naturally I also use it for general queries like\n\n      rmairix -t f:peff sanitize thread\n\nI hope that helps.  I suspect it may be more useful to people as\ninspiration and not as running code. I'm happy to answer any questions\nor give any guidance I can.\n\n-Peff\n"}]}