On Tue, Aug 18, 2020 at 8:23 AM Gopal Yadav <gopunop@xxxxxxxxx> wrote: > I am new to git and have submitted a microproject to get familiar with > the process of submitting patches. Would further like to work on > resolving this issue https://github.com/gitgitgadget/git/issues/353 > > Some questions regarding that: > What is meant by skipping evaluation of lazy prereq? If, in order to run successfully, a test requires a certain facility or resource which may or may not be present on a particular system, it can signal that requirement like this: test_expect_success PERL 'test title' ' test body ' where PERL is the prerequisite. If Perl is not available on the platform, then the test won't be run at all. Determining whether a prerequisite is met can be done actively or lazily. If actively, then the determination is done unconditionally for either all test scripts or all tests in a script, which penalizes tests which don't even care about a particular prerequisite. If done lazily, then the determination is done only the first time some particular test needs to know the answer. Issue #353 is saying that if we know that we are skipping a test anyhow due to --run= or GIT_SKIP_TESTS, then there is no point checking the test's prerequisites (lazy or not). The fact that the prerequisites are being checked even for tests which we know will be skipped is wasteful. > Does it mean that test_lazy_prereq() and test_run_lazy_prereq() > functions should be skipped in tests which are instructed to be > skipped by --run? > > So for example if we run $sh t0001-init.sh --run='1-33' > Then current behaviour allows test_lazy_prereq() at line 319 to execute. > But since we are not running tests past the 33rd test we don't want > test_lazy_prereq() to be executed. > Is this the problem statement? No. test_lazy_prereq() is merely the function which defines how a lazy prerequisites should be determined when the answer about the prerequisite is actually needed. What #353 is saying is to not perform the actual determination if a test which requires it isn't going to be run. Fixing the issue might be as simple as moving the test_verify_prereq() call (and related "export") inside the 'if ! test_skip "$@"' conditional in the test_expect_success() and test_expect_failure() functions. > I know the issue talks about something related to chains but I am > thinking of starting by resolving the lazy prereq task first. I took a look at the &&-chain logic and, as far as I can tell by both direct inspection and by experimentation, the detection of broken &&-chains is _not_ performed for tests which are being skipped. So, I think that portion of #353 is just wrong.