1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

several fixes to compile VILLASnode on Ubuntu 16.04

This commit is contained in:
Steffen Vogel 2017-10-20 11:37:25 +02:00
parent 37f5bfe24c
commit 792cf1853a
9 changed files with 39 additions and 14 deletions

View file

@ -23,6 +23,7 @@
#include <string.h>
#include "compat.h"
#include "buffer.h"
#include "common.h"
@ -33,9 +34,9 @@ int buffer_init(struct buffer *b, size_t size)
b->buf = malloc(size);
if (!b->buf)
return -1;
b->state = STATE_INITIALIZED;
return 0;
}
@ -43,9 +44,9 @@ int buffer_destroy(struct buffer *b)
{
if (b->buf)
free(b->buf);
b->state = STATE_DESTROYED;
return 0;
}
@ -66,7 +67,7 @@ int buffer_append(struct buffer *b, const char *data, size_t len)
memcpy(b->buf + b->len, data, len);
b->len += len;
return 0;
}
@ -75,7 +76,7 @@ int buffer_parse_json(struct buffer *b, json_t **j)
*j = json_loadb(b->buf, b->len, 0, NULL);
if (!*j)
return -1;
return 0;
}

View file

@ -280,14 +280,13 @@ json_t * json_load_cli(int argc, char *argv[])
int json_object_extend(json_t *obj, json_t *merge)
{
const char *key;
void *tmp;
int ret;
json_t *merge_value, *obj_value;
if (!json_is_object(obj) || !json_is_object(merge))
return -1;
json_object_foreach_safe(merge, tmp, key, merge_value) {
json_object_foreach(merge, key, merge_value) {
obj_value = json_object_get(obj, key);
if (obj_value && json_is_object(obj_value))
ret = json_object_extend(obj_value, merge_value);

View file

@ -21,6 +21,7 @@
*********************************************************************************/
#include "plugin.h"
#include "compat.h"
#include "io/json.h"
int json_pack_sample(json_t **j, struct sample *smp, int flags)

View file

@ -100,8 +100,12 @@ int cbuilder_read(struct node *n, struct sample *smps[], unsigned cnt)
struct sample *smp = smps[0];
uint64_t cntr;
ssize_t bytes;
bytes = read(cb->eventfd, &cntr, sizeof(cntr));
if (bytes != sizeof(cntr))
return -1;
read(cb->eventfd, &cntr, sizeof(cntr));
/* Wait for completion of step */
pthread_mutex_lock(&cb->mtx);
@ -138,10 +142,15 @@ int cbuilder_write(struct node *n, struct sample *smps[], unsigned cnt)
cb->step++;
uint64_t incr = 1;
write(cb->eventfd, &incr, sizeof(incr));
ssize_t bytes;
bytes = write(cb->eventfd, &incr, sizeof(incr));
pthread_mutex_unlock(&cb->mtx);
if (bytes != sizeof(incr))
return -1;
return 1;
}

View file

@ -187,7 +187,11 @@ int test_rtt_parse(struct node *n, json_t *cfg)
else
c->limit = 1000; /* default value */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
asprintf(&c->filename, "%s/%s_%d_%.0f.log", t->output, t->prefix, c->values, c->rate);
#pragma GCC diagnostic pop
list_push(&t->cases, c);
}

View file

@ -115,13 +115,16 @@ Test(advio, download_large)
Test(advio, resume)
{
int ret;
char *retp;
AFILE *af1, *af2;
char *fn, dir[] = "/tmp/temp.XXXXXX";
char line1[32];
char *line2 = NULL;
size_t linelen = 0;
mkdtemp(dir);
retp = mkdtemp(dir);
cr_assert_not_null(retp);
ret = asprintf(&fn, "%s/file", dir);
cr_assert_gt(ret, 0);
@ -141,7 +144,9 @@ Test(advio, resume)
aupload(af1, 1);
adownload(af2, 1);
agetline(&line2, &linelen, af2);
ret = agetline(&line2, &linelen, af2);
cr_assert_gt(ret, 0);
cr_assert_str_eq(line1, line2);
}

View file

@ -4,6 +4,8 @@
* @copyright 2017, Steffen Vogel
*********************************************************************************/
#ifdef WITH_FPGA
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
@ -398,3 +400,5 @@ Test(fpga, rtds_rtt, .description = "RTDS: tight rtt")
ret = dma_free(ip, &buf);
cr_assert_eq(ret, 0, "Failed to release DMA memory");
}
#endif /* WITH_FPGA */

View file

@ -193,6 +193,7 @@ ParameterizedTestParameters(io, highlevel)
ParameterizedTest(char *fmt, io, highlevel)
{
int ret, cnt;
char *retp;
struct io io;
struct io_format *f;
@ -210,7 +211,9 @@ ParameterizedTest(char *fmt, io, highlevel)
char *fn, dir[64];
strncpy(dir, "/tmp/villas.XXXXXX", sizeof(dir));
mkdtemp(dir);
retp = mkdtemp(dir);
cr_assert_not_null(retp);
// ret = asprintf(&fn, "file://%s/file", dir);
ret = asprintf(&fn, "%s/file", dir);
cr_assert_gt(ret, 0);

View file

@ -46,7 +46,6 @@ $(DEPS_AUTOCONF): | $(BUILDDIR)/thirdparty/$$@/
# Install & compile CMake based projects
$(DEPS_CMAKE): | $(BUILDDIR)/thirdparty/$$@/
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) \
-DCMAKE_INSTALL_LIBDIR=lib64 -DLIB_SUFFIX=64 \
-H$(SRCDIR)/thirdparty/$@ \
-B$(BUILDDIR)/thirdparty/$@ $(CMAKE_OPTS)
make -C$(BUILDDIR)/thirdparty/$@