summaryrefslogtreecommitdiff
path: root/modules/getlogin-tests
Commit message (Collapse)AuthorAgeFilesLines
* getlogin, getlogin_r: Rename LIB_GETLOGIN to GETLOGIN_LIB.Bruno Haible2023-01-071-1/+1
| | | | | | * m4/getlogin.m4: Rename LIB_GETLOGIN to GETLOGIN_LIB. All uses changed. * NEWS: Mention the change.
* getlogin, getlogin_r tests: Avoid test failure in specific environments.Bruno Haible2022-06-061-0/+1
| | | | | | | | | | | Reported by Letu Ren <fantasquex@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2022-06/msg00001.html>. * modules/getlogin-tests (Depends-on): Add stdbool. * modules/getlogin_r-tests (Depends-on): Likewise. * tests/test-getlogin.h: Include stdbool.h. (test_getlogin_result): On Linux, skip the test if /proc/self/loginuid contains "-1".
* getlogin tests: Avoid #ifdefs when sharing code between modules.Bruno Haible2017-07-111-1/+1
| | | | | | | | | | * modules/getlogin_r-tests (Files): Add tests/test-getlogin.h. * modules/getlogin-tests (Files): Likewise. Remove tests/test-getlogin_r.c. * tests/test-getlogin.h: Extracted from tests/test-getlogin_r.c. * tests/test-getlogin.c: Extracted from tests/test-getlogin_r.c. * tests/test-getlogin_r.c: Include test-getlogin.h. Omit code that tests getlogin().
* getlogin: don’t assume one name per uidPaul Eggert2017-07-101-1/+1
| | | | | | | | | | | | | | Problem reported by Wolfgang F. Muthmann (Bug#27640). * modules/getlogin-tests (Files): Add tests/test-getlogin_r.c. (ttyname): Remove test. * modules/getlogin_r-tests (ttyname): Remove test. * tests/test-getlogin.c: Replace this near-clone of test-getlogin_r.c with ‘#define TEST_LOGIN’ followed by ‘#include "test-getlogin_r.c"’. * tests/test-getlogin_r.c: If TEST_GETLOGIN is defined, test getlogin rather than getlogin_r. This avoids code duplication. (main): Use isatty and fstat rather than ttyname and stat. Use getpwnam instead of getpwuid, to be portable to test platforms that have multiple login names for the same uid.
* getlogin, getlogin_r: Fix link errors on MSVC.Bruno Haible2016-12-181-0/+1
| | | | | | | | | | | | * m4/getlogin.m4 (gl_LIB_GETLOGIN): New macro. * modules/getlogin (configure.ac): Require gl_LIB_GETLOGIN. (Link): New section. * modules/getlogin_r (Files): Add m4/getlogin.m4. (configure.ac): Require gl_LIB_GETLOGIN. (Link): New section. * NEWS: Mention the new link requirements. * modules/getlogin-tests (test_getlogin_LDADD): New variable. * modules/getlogin_r-tests (test_getlogin_r_LDADD): New variable.
* getlogin-tests: avoid false failure under sudo/ssh etc.Guilherme de Almeida Suckevicz2014-05-141-0/+1
| | | | | | | | * modules/getlogin-tests (configure.ac): Check for ttyname(). * tests/test-getlogin.c (main): Don't depend on environment variables to correlate with getlogin(), since sudo and ssh etc. can tamper with the LOGNAME and USER env vars. Instead lookup the name from the uid associated with the stdin tty.
* Tests for module 'getlogin'.Bruno Haible2010-01-091-0/+12