{"thread":{"id":"45816","subject":"Question re testing configuration","startedAt":"2017-04-27T03:57:10Z","lastAt":"2017-04-27T05:20:00Z","messageCount":2,"participants":["Samuel Lijin","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318035","messageId":"CAJZjrdWPezo6=JHcp9mp8C5Pm1uJodSj3Mbgn7ix78MAqpUUXw@mail.gmail.com","threadId":"45816","inReplyTo":null,"subject":"Question re testing configuration","fromName":"Samuel Lijin","fromEmail":"sxlijin@gmail.com","sentAt":"2017-04-27T03:56:23Z","receivedAt":"2017-04-27T03:57:10Z","isPatch":false,"sender":{"key":"sxlijin@gmail.com","avatar":"https://gravatar.com/avatar/01777bf1eae64e2b4dca97dcac182a6abbcf6fd8cb4d5b8fa33edf9f8cc21746?d=mp&s=160"},"body":"Hi all,\n\nI'm a new developer trying to get my feet wet and I'm running into an\nissue with the tests that I can't figure out at this point.\n\nI *know* that the changes I'm working on are causing the tests to\nfail, but I can't figure out how to induce the failure manually (so\nthat I can throw gdb at the problem).\n\nSpecifically I'm seeing t5000-tar-tree.sh fail (as a result of adding\nextra diff_populate_filespec() calls before the estimate_similarity()\nloop in diffcore_rename()) on #52 \"set up repository with huge blob\"\nand #55 \"set up repository with far-future commit\".\n\nIf I run the commands fed into test_expect_success in t5000, though\n(in an empty repo initialized with git init), making sure to use the\nbinary compiled with the breaking changes, the command doesn't fail,\nso I'm clearly missing something in the testing environment setup when\nI try to manually reproduce it.\n\nCan someone point me in the right direction? I've spent some time now\ngoing through t/test-lib.sh and I haven't figured it out yet.\n\nThanks,\nSam\n"},{"id":"318043","messageId":"20170427051850.kb77hy64ttsr46cs@sigill.intra.peff.net","threadId":"45816","inReplyTo":"CAJZjrdWPezo6=JHcp9mp8C5Pm1uJodSj3Mbgn7ix78MAqpUUXw@mail.gmail.com","subject":"Re: Question re testing configuration","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-04-27T05:18:51Z","receivedAt":"2017-04-27T05:20:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 26, 2017 at 10:56:23PM -0500, Samuel Lijin wrote:\n\n> I *know* that the changes I'm working on are causing the tests to\n> fail, but I can't figure out how to induce the failure manually (so\n> that I can throw gdb at the problem).\n> \n> Specifically I'm seeing t5000-tar-tree.sh fail (as a result of adding\n> extra diff_populate_filespec() calls before the estimate_similarity()\n> loop in diffcore_rename()) on #52 \"set up repository with huge blob\"\n> and #55 \"set up repository with far-future commit\".\n> \n> If I run the commands fed into test_expect_success in t5000, though\n> (in an empty repo initialized with git init), making sure to use the\n> binary compiled with the breaking changes, the command doesn't fail,\n> so I'm clearly missing something in the testing environment setup when\n> I try to manually reproduce it.\n> \n> Can someone point me in the right direction? I've spent some time now\n> going through t/test-lib.sh and I haven't figured it out yet.\n\nI'd usually start by stopping the script at the failed test, going into\nthe repository directory, and then running from there. Like:\n\n  $ cd t\n  $ ./t5000-tar-tree.sh -v -i -x\n  $ cd trash\\ directory.t5000-tar-tree\n  $ gdb --args ../../git whatever-failed\n\nThat's usually enough to re-create the broken state. Sometimes there are\nthings in the environment, or the test is impacted by your user-level\nconfig (test-lib resets $HOME, so it should have no user config). But\nit's usually easier to just stick a \"gdb\" temporarily into the test.\nNote there are some tricks there with redirections and the bin-wrappers\nscript; see the debug() helper in test-lib-functions.sh.\n\n-Peff\n"}]}