[LTP] [PATCH v2] getcwd01: Implement .test_variants
Petr Vorel
pvorel@suse.cz
Wed Dec 27 15:48:39 CET 2023
Hi Li, Cyril,
...
> > +static inline void
> > +tst_getcwd(char *buf, size_t size, int exp_err, int exp_err2)
> And here as well: this should be on single line.
> > +{
> > + switch (tst_variant) {
> Please, do not use switch for 2 variants, if is much readable in this case.
> > + case 0:
> > + TST_EXP_FAIL2(tst_syscall(__NR_getcwd, buf, size), exp_err);
> > + break;
> > + case 1:
> > +#ifdef __GLIBC__
> #1084 [1] reported problem on MUSL only. Your original patch [2] to fix #1084
> skipped only 2 of tests, which used NULL buffer. Why now skip everything? Please
> skip only these two and put comment about musl and #1084 to be obvious why you
> do that. You could also add note to the git commit message. Not documenting this
> will raise questions in the future.
> Also, looking that into bionic [3], it's compatible with glibc and uclibc{,-ng}
> (I'll verify it with Edward Liaw from Google), thus I would check like in
> run(unsigned int n):
> static void run(unsigned int n)
> {
> struct t_case *tc = &tcases[n];
> /* https://github.com/linux-test-project/ltp/issues/1084 */
> #if !defined(__GLIBC__) && !defined(__ANDROID__)
> if (tst_variant && !tc->buf) {
> tst_res(TCONF, "NULL buffer test skipped on MUSL due different implementation");
> return;
> }
> #endif
@Li @Cyril: are you ok to test libc getcwd() wrapper implementations on NULL
buffer in getcwd01.c? Or we just skip NULL buffer test on all libc?
I would be ok to test it, because change in the implementation can influence
lots of user space software, although glibc or any other libc can obviously
change it's behavior.
Kind regards,
Petr
> tst_getcwd(tc->buf, tc->size, tc->exp_err, tc->exp_err2);
> }
> Or we could skip NULL buffer test on all libc.
> [1] https://github.com/linux-test-project/ltp/issues/1084
> [2] https://lore.kernel.org/ltp/20230928010808.15862-1-wegao@suse.com/
> [3] https://android.googlesource.com/platform/bionic.git/+/refs/tags/android-14.0.0_r18/libc/bionic/getcwd.cpp
...
More information about the ltp
mailing list