aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/posix/dprintf.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 18:24:51 -0500
commitf5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch)
tree93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/tests/posix/dprintf.c
parentbd5969fc876a10b18613302db7087ef3c40f18e1 (diff)
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/tests/posix/dprintf.c')
-rw-r--r--lib/mlibc/tests/posix/dprintf.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/mlibc/tests/posix/dprintf.c b/lib/mlibc/tests/posix/dprintf.c
deleted file mode 100644
index 4746edb..0000000
--- a/lib/mlibc/tests/posix/dprintf.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-
-#ifdef USE_HOST_LIBC
-#define TEST_FILE "dprintf-host-libc.tmp"
-#else
-#define TEST_FILE "dprintf.tmp"
-#endif
-
-int main() {
- int fd = open(TEST_FILE, O_RDWR | O_CREAT, 0666);
- assert(fd > -1);
-
- int ret = dprintf(fd, "aaa");
- assert(ret == 3);
-
- // Check if we can read back the same things.
- // Also checks to see if the fd is still open,
- // which is issue #199.
-
- off_t seek = lseek(fd, 0, SEEK_SET);
- assert(seek == 0);
-
- char buf[3];
- ssize_t num_read = read(fd, buf, 3);
-
- assert(num_read == 3);
- assert(buf[0] == 'a'
- && buf[1] == 'a'
- && buf[2] == 'a');
-
- // All the tests pass, now we can unlink the file.
- ret = unlink(TEST_FILE);
- assert(ret == 0);
- return 0;
-}