From 41ae48ad5843cce2b5f76ac2638aa7eed6fc3ecf Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 18 Oct 2017 14:43:09 +0200 Subject: [PATCH] test_rtt: create missing output directory --- lib/nodes/test_rtt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/nodes/test_rtt.c b/lib/nodes/test_rtt.c index e46bbc9f5..5e2768cb6 100644 --- a/lib/nodes/test_rtt.c +++ b/lib/nodes/test_rtt.c @@ -21,6 +21,7 @@ *********************************************************************************/ #include +#include #include "node.h" #include "sample.h" @@ -235,9 +236,18 @@ char * test_rtt_print(struct node *n) int test_rtt_start(struct node *n) { int ret; + struct stat st; struct test_rtt *t = n->_vd; struct test_rtt_case *c = list_first(&t->cases); + /* Create folder for results if not present */ + ret = stat(t->output, &st); + if (ret || !S_ISDIR(st.st_mode)) { + ret = mkdir(t->output, 0777); + if (ret) + return ret; + } + ret = io_init(&t->io, t->format, SAMPLE_HAS_ALL & ~SAMPLE_HAS_VALUES); if (ret) return ret;