Commit Graph

90 Commits

Author SHA1 Message Date
Guillem Jover
736e12e8d8 test: Handle libtool executable names in getprogname() unit test
Sometimes libtool will prefix the test programs with "lt-", we should
handle these and strip the prefix.

Fixes: https://bugs.debian.org/865090
2017-06-24 16:05:50 +02:00
Guillem Jover
cdbb9d0555 test: Add new strnstr() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
0365d0efda test: Add new setprogname() and getprogname() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
10b1328570 test: Add new setmode() and getmode() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
922eff5c5e test: Add new nlist() unit test 2017-06-19 03:17:21 +02:00
Guillem Jover
7938619254 Update .gitignore for headers generator 2017-06-19 03:17:21 +02:00
Guillem Jover
f1dd5f2e71 test: Add unit test for strlcpy() and strlcat() 2017-06-09 05:47:07 +02:00
Guillem Jover
f3b566bd7c test: Add a unit test for md5 2016-03-27 12:31:58 +02:00
Hanno Boeck
008316aa29 test: Add missing <sys/stat.h> include
The test in test/strmode.c can fail to compile depending on the
optimization flags used.

The constants that are used in this file (S_IFREG etc.) come from the
<sys/stat.h> include file. It seems gcc ignores this error if one
compiles with "-O2" (default), but if one uses no optimization it fails.

Add the missing include and it works all the time.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93880
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2016-01-27 15:24:39 +01:00
Guillem Jover
e4ab2c62cd test: Fix success return code for arc4random unit test 2016-01-11 02:35:34 +01:00
Lukas Fleischer
bf5573f86c test: Fix race condition in headers-*.sh
When running tests in parallel (e.g. using `make -j4 check`), the header
tests currently fail due to headers-overlay.sh and headers-system.sh
both generating headers-gen.c simultaneously, resulting in garbled
output. Fix this by using separate C files for the tests.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2016-01-10 17:36:34 +01:00
Guillem Jover
f84004baf2 test: Add new unit tests for individual headers usage 2015-12-14 03:34:40 +01:00
Guillem Jover
da137a0921 Add missing copyright and license headers 2015-12-07 01:56:25 +01:00
Guillem Jover
877732ef4d test: Check asprintf() return code 2015-11-30 23:48:50 +01:00
Guillem Jover
02bccb0a01 test: Add unit test for strmode() 2015-11-30 23:02:23 +01:00
Guillem Jover
58bef83f41 test: Add unit test for arc4random() 2015-11-30 23:02:23 +01:00
Guillem Jover
02c33d5022 build: Move proctitle_LDFLAGS inside BUILD_LIBBSD_CTOR conditional 2015-11-30 04:10:23 +01:00
Guillem Jover
45443583df Add explicit_bzero() function from OpenBSD 2015-09-24 05:47:58 +02:00
Guillem Jover
151bc71d64 Add compile and link-time deprecation warnings for fgetln()
Although the current implementation in libbsd is probably one of the
safest ones around, it still poses some problems when used with many
file streams. This function has now a replacement, that is both more
standard and portable. Ask users to switch to getline(3) instead.
2015-09-23 07:59:34 +02:00
Guillem Jover
f50b197ea5 test: Add fparseln() unit test 2015-09-23 07:59:34 +02:00
Guillem Jover
54f153414a test: Refactor stream testing functions into a new module 2015-09-23 07:59:34 +02:00
Guillem Jover
32388fe59f Use reallocarray() instead of malloc() or realloc() 2015-09-23 07:59:34 +02:00
Guillem Jover
3a3d87d730 test: Add closefrom() unit test 2015-09-23 07:59:34 +02:00
Guillem Jover
d62f7d8fac test: Add test case for fpurge(NULL) 2015-09-23 07:59:34 +02:00
Guillem Jover
cfb4d462a9 test: Move and activate fpurge() test case from module to a dedicated file 2015-09-23 07:59:34 +02:00
Guillem Jover
205827a2dd build: Centralize testsuite LDADD setting in a single variable 2015-09-23 07:59:34 +02:00
Guillem Jover
e8d3d04177 build: Remove hard requirement for GNU .init_array section support
In case the support is not available, just stop building the
libbsd-ctor.a library, which is a nice to have thing, but should not
have been a hard requirement from the start. This should allow to
build libbsd on non-glibc based systems using another libc.
2014-07-20 02:09:20 +02:00
Guillem Jover
f41fdcf186 Add funopen() function
This is a wrapper over the glibc fopencookie() function.

We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,
because seekfn() there wrongly uses fpos_t, assuming it's an integral
type, and any code using that on a system where fpos_t is a struct
(such as GNU-based systems or NetBSD) will fail to build. In which case,
as the code has to be modified anyway, we might just as well use the
correct declaration.
2013-10-21 05:35:44 +02:00
Guillem Jover
61b2dbb8f5 Fix dehumanize_number() to correctly detect overflows
Do not allow numbers greated than INT64_MAX and smaller than INT64_MIN.
Clarify the positive sign value by prefixing it with an explicit +.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66909
2013-10-21 05:29:37 +02:00
Guillem Jover
c5b9590287 Move setproctitle() automatic initialization to its own library
The automatic initialization cannot be part of the main shared library,
because there is no thread-safe way to change the environ global
variable. This is not a problem if the initializaion happens just at
program load time, but becomes one if the shared library is directly or
indirectly dlopen()ed during the execution of the program, which could
have either kept references to the old environ or could change it in
some other thread. This has been observed for example on systems using
Samba NSS modules.

To avoid any other possible fallout, the constructor is split into a
new static library that needs to be linked explicitly into programs
using setproctitle(). As an additional safety measure the pkg-config
linker flags will mark the program as not allowing to be dlopen()ed
so that we avoid the problem described above.

Reported-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66679
2013-07-14 13:32:11 +02:00
Guillem Jover
367e036537 test: Try setting and getting an environment variable after setproctitle() 2013-06-08 18:08:58 +02:00
Guillem Jover
df5aebd7e1 test: Mark a literal integer as long long
This fixes build failures on 32-bit architectures.
2013-05-27 06:51:15 +02:00
Guillem Jover
330b569fe3 test: Add new humanize unit test 2013-05-27 03:41:48 +02:00
Guillem Jover
8c26c40ad2 test: Add setproctitle() unit test 2013-05-27 03:24:23 +02:00
Guillem Jover
7196b4dcca test: Add new fgetln() and fgetwln() unit test 2013-05-27 02:49:28 +02:00
Guillem Jover
14524b545d build: Set default compiler variables from configure
This centralizes the setting so there's no duplication anymore,
makes sure the user supplied variables are never overridden, and
are only set when using gcc.

Reported-by: Samuli Suominen <ssuominen@gentoo.org>
2012-06-03 07:46:00 +02:00
Guillem Jover
34bf1068a2 test: Add a unit test for endian encoder/decoder 2012-05-29 04:51:16 +02:00
Guillem Jover
786d143920 test: Add new overlay unit test 2012-05-29 04:51:04 +02:00
Guillem Jover
abf14c3940 test: Add new headers unit test 2012-05-29 04:36:23 +02:00
Guillem Jover
23973e2221 build: Add a test suite infrastructure 2012-05-29 04:36:23 +02:00