summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2021-04-08 15:36:04 +0200
committerŁukasz Stelmach <l.stelmach@samsung.com>2021-04-19 09:59:45 +0200
commit0a469e5517163682407cce48f5ec24a5a6f5eeef (patch)
treeb17b08cde929fd91b00cf51174a4ff37c0eb7bd6
parentd642bbb9a7bd6121ef750f090177c091f32538b8 (diff)
downloadlinux-rpi3-submit/tizen/20210420.014641.tar.gz
linux-rpi3-submit/tizen/20210420.014641.tar.bz2
linux-rpi3-submit/tizen/20210420.014641.zip
Send enough data to logger to fill the whole ring buffer. Test assembly of large messages without newline characters. Check return value from write(2). Remove some dead code. Change-Id: I165458f5c7831bd925164aa087f28fd319c9872f Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
-rw-r--r--tools/testing/selftests/logger/logger.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/testing/selftests/logger/logger.c b/tools/testing/selftests/logger/logger.c
index 18a3ea7085dc..c3e428115537 100644
--- a/tools/testing/selftests/logger/logger.c
+++ b/tools/testing/selftests/logger/logger.c
@@ -1,9 +1,9 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
-#include <linux/const.h>
#include <linux/logger.h>
#include <pthread.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -75,12 +75,6 @@ int main(int ac, char *av[]) {
setlinebuf(stdout);
fd = open(device, O_WRONLY);
- if (ac >= 2) {
- }
-
- if (ac == 3) {
- }
-
if (test_mask & BIT(0)) {
vec[0].iov_base = &prio;
vec[0].iov_len = 1;
@@ -103,8 +97,10 @@ int main(int ac, char *av[]) {
ioctl(fd, LOGGER_SET_TAG, &struct_tag);
if (test_mask & BIT(2)) {
-
- write(fd, "The Foo From STDIO\n", 19);
+ int count;
+ count = write(fd, "The Foo From STDIO\n", 19);
+ if (count != 19)
+ printf("count != 19\n");
write(fd, "LINE #1\nLINE #2", 15);
write(fd, " CONTINUED\nONCE", 15);
@@ -117,12 +113,21 @@ int main(int ac, char *av[]) {
return 1;
for (int i = 0; i < 8000; i++)
- msg[i] = ' ' + (i % 96);
+ msg[i] = '!' + (i % 95);
msg[7999] = '\n';
write(fd, msg, 8000);
+
+ for (int i = 0; (test_mask & BIT(4)) && i < 40; i++)
+ write(fd, msg, 8000);
+
+ for (int i = 0; (test_mask & BIT(5)) && i < 8000; i++)
+ write(fd, &msg[i], 1);
+
+ free(msg);
+ msg = NULL;
}
- if (test_mask & BIT(4)) {
+ if (test_mask & BIT(6)) {
child = fork();
if (child < 0) {
return -1;
@@ -140,7 +145,7 @@ int main(int ac, char *av[]) {
wait(&s);
}
- if (test_mask & BIT(5)) {
+ if (test_mask & BIT(7)) {
s = pthread_create(&tid, NULL, &tstart, &fd);
if (s != 0)
handle_error_en(s, "pthread_create");