[LTP] [PATCH 1/2] Refactor setresgit01 test

Petr Vorel pvorel@suse.cz
Fri Jan 3 12:01:56 CET 2025


Hi Andrea,

> Simplify general structure, using struct passwd only when it's strictly
> needed and use new LTP API.

Rewrite LGTM, but there is a problem with 16-bit version.

Old version when compiled for 64bit it quits with TCONF:

# ./setresgid01_16
...
TCONF  :  utils/compat_16.h:146: 16-bit version of setresgid() is not supported on your platform
TCONF  :  utils/compat_16.h:146: Remaining cases not appropriate for configuration

But when running your patchset it runs the test:
# ./setresgid01_16
...
setresgid01.c:67: TPASS: *tc->exp_rgid == cur_rgid (0)

This was caused by using SAFE_SETRESGID(...) instead of original SETRESGID(),
which is needed to employ the check for 16-bit support.

Therefore I merged with this change:

-       SAFE_SETRESGID(*tc->rgid, *tc->egid, *tc->sgid);
+       TST_EXP_PASS(SETRESGID(*tc->rgid, *tc->egid, *tc->sgid));
+       if (!TST_PASS)
+               return;

Besides using SAFE_SETRESGID() would in failure resulted in TBROK instead of
TFAIL (usually subject of testing should result in TFAIL, not TBROK).

Thanks for your work!

Kind regards,
Petr


More information about the ltp mailing list