From: Patrick Steinhardt <ps@pks.im>
To: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Cc: git@vger.kernel.org,
Christian Couder <christian.couder@gmail.com>,
Phillip Wood <phillip.wood123@gmail.com>,
Christian Couder <chriscool@tuxfamily.org>,
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Subject: Re: [GSoC][PATCH] t: migrate helper/test-urlmatch-normalization to unit tests
Date: Wed, 24 Jul 2024 07:19:36 +0200 [thread overview]
Message-ID: <ZqCO6JTQqdxD73Wq@tanuki> (raw)
In-Reply-To: <D2XCB5UYIB5B.1L3U95DQSWJ2@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]
On Wed, Jul 24, 2024 at 05:54:33AM +0530, Ghanshyam Thakkar wrote:
> Patrick Steinhardt <ps@pks.im> wrote:
> > On Fri, Jun 28, 2024 at 06:26:24PM +0530, Ghanshyam Thakkar wrote:
> > > + free(url1_norm);
> > > + free(url2_norm);
> > > +}
> > > +
> > > +static void check_normalized_url_from_file(const char *file, const char *expect)
> > > +{
> > > + struct strbuf content = STRBUF_INIT, path = STRBUF_INIT;
> > > +
> > > + strbuf_getcwd(&path);
> > > + strbuf_strip_suffix(&path, "/unit-tests/bin"); /* because 'unit-tests-test-tool' is run from 'bin' directory */
> >
> > Curious: is this a new requirement or do other tests have the same
> > requirement? I was under the impression that I could execude the
> > resulting unit test binaries from whatever directory I wanted to, but
> > didn't verify.
>
> I am not aware of any requirements, but if we want to interact with
> other files like in this case (and where we potentially have to
> interact with a test repository), we'd need to have some requirement
> to construct the path to these data files (and the test repository),
> similar to end-to-end tests where they can be run in only t/
> directory. Do you think calling `setup_git_directory()` and then using
> `the_repository->worktree` to get the root of the worktree of Git source
> and then construct the path relative to that, would be useful? That way
> we can atleast call the binaries from anywhere within the tree.
Instead of using the working directory, you can also use the `__FILE__`
preprocessor macro to access the files relative to the directory of the
original source file. That at least makes it possible to execute the
result from all directories, but still obviously ties us to the location
of the source directory.
Whether that's ultimately much better.. dunno. But I guess this should
at least be discussed in the commit message.
> (P.S. I know we want to avoid using `the_repository`, but I don't know
> any other way yet.)
You can use e.g. "t/helper/test-repository.c" as an example, where we
use `repo_init()` to initialize a local repository variable.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-07-24 5:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 12:56 [GSoC][PATCH] t: migrate helper/test-urlmatch-normalization to unit tests Ghanshyam Thakkar
2024-07-09 0:42 ` Ghanshyam Thakkar
2024-07-22 12:53 ` Karthik Nayak
2024-07-22 12:54 ` Ghanshyam Thakkar
2024-07-23 8:26 ` Karthik Nayak
2024-07-23 14:00 ` Patrick Steinhardt
2024-07-24 0:24 ` Ghanshyam Thakkar
2024-07-24 5:19 ` Patrick Steinhardt [this message]
2024-07-24 7:06 ` Ghanshyam Thakkar
2024-07-24 7:45 ` Patrick Steinhardt
2024-08-13 17:24 ` [GSoC][PATCH v2] t: migrate t0110-urlmatch-normalization to the new framework Ghanshyam Thakkar
2024-08-13 19:22 ` Junio C Hamano
2024-08-14 1:35 ` Kaartic Sivaraam
2024-08-14 4:58 ` Junio C Hamano
2024-08-14 14:24 ` Ghanshyam Thakkar
2024-08-14 5:17 ` Kaartic Sivaraam
2024-08-14 14:20 ` [GSoC][PATCH v3] " Ghanshyam Thakkar
2024-08-14 16:52 ` Junio C Hamano
2024-08-19 12:46 ` Christian Couder
2024-08-20 15:19 ` [GSoC][PATCH v4] " Ghanshyam Thakkar
2024-08-20 15:24 ` Ghanshyam Thakkar
2024-08-21 10:06 ` Christian Couder
2024-08-21 16:08 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZqCO6JTQqdxD73Wq@tanuki \
--to=ps@pks.im \
--cc=chriscool@tuxfamily.org \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=kaartic.sivaraam@gmail.com \
--cc=phillip.wood123@gmail.com \
--cc=shyamthakkar001@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox