summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2018-09-14 14:21:39 +0300
committerPetri Latvala <petri.latvala@intel.com>2018-09-17 13:14:38 +0300
commit03b90a39ed12a568c9da752466ea708d6348e110 (patch)
treec967d63977516028bf7638bbdd9b2b1305583abf /runner
parent0b59bb3231ab481959528c5c7b3a98762772e1b0 (diff)
runner: Increase buffer size for reading outputs
The law of chosen magic numbers: The number selected is wrong. Chose another magic number for the size of the buffer used to read test outputs and kernel log records. It's now 2048, up from 256. Also added a warning print if that's still not enough for kernel logs. The lesson to learn here is that the /dev/kmsg interface does not give you a truncated log record as initially thought, but reports an undocumented EINVAL instead. Subsequent reads give the next record, so the failsafe added will make sure any future EINVALs will only drop the record that is too long instead of everything from that point onwards. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/runner/executor.c b/runner/executor.c
index 36117af6..701ca80d 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -242,7 +242,7 @@ static void dump_dmesg(int kmsgfd, int outfd)
unsigned flags;
unsigned long long seq, cmpseq, usec;
char cont;
- char buf[256];
+ char buf[2048];
ssize_t r;
if (comparefd < 0)
@@ -323,7 +323,7 @@ static int monitor_output(pid_t child,
struct settings *settings)
{
fd_set set;
- char buf[256];
+ char buf[2048];
char *outbuf = NULL;
size_t outbufsize = 0;
char current_subtest[256] = {};
@@ -539,11 +539,13 @@ static int monitor_output(pid_t child,
if (kmsgfd >= 0 && FD_ISSET(kmsgfd, &set)) {
s = read(kmsgfd, buf, sizeof(buf));
if (s < 0) {
- if (errno != EPIPE) {
+ if (errno != EPIPE && errno != EINVAL) {
fprintf(stderr, "Error reading from kmsg, stopping monitoring: %s\n",
strerror(errno));
close(kmsgfd);
kmsgfd = -1;
+ } else if (errno == EINVAL) {
+ fprintf(stderr, "Warning: Buffer too small for kernel log record, record lost.\n");
}
} else {
write(outputs[_F_DMESG], buf, s);