summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2023-06-23 00:28:01 +0200
committerjvoisin2023-06-23 00:28:01 +0200
commit5827cef597d2b9b87b950c9b50023d11b1363c04 (patch)
treee3797ed1feedda57bc15e8aac39c1cae43759025
parent44a71e36ed37781fa850662f479734cce1c354ce (diff)
Add a test for fgets
-rw-r--r--tests/Makefile4
-rw-r--r--tests/test_fgets.c15
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 0e415a5..ee43a93 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,7 +2,9 @@ CC=../x86_64-linux-musl-native/bin/gcc
2GCOV=../x86_64-linux-musl-native/bin/gcov 2GCOV=../x86_64-linux-musl-native/bin/gcov
3CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 3CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2
4 4
5TARGETS=test_memcpy_static_write \ 5TARGETS= \
6 test_fgets \
7 test_memcpy_static_write \
6 test_memcpy_dynamic_write \ 8 test_memcpy_dynamic_write \
7 test_memcpy_static_read \ 9 test_memcpy_static_read \
8 test_memcpy_dynamic_read \ 10 test_memcpy_dynamic_read \
diff --git a/tests/test_fgets.c b/tests/test_fgets.c
new file mode 100644
index 0000000..f01d7c6
--- /dev/null
+++ b/tests/test_fgets.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <poll.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 CHK_FAIL_START
10 fgets(buffer, 14, NULL);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}