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

Merge branch 'distro-compatability' into 'develop'

Distro compatability

See merge request !24
This commit is contained in:
Steffen Vogel 2017-06-17 07:20:17 +02:00
commit fd25468d9a
18 changed files with 144 additions and 33 deletions

View file

@ -28,7 +28,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
FROM fedora:latest
FROM fedora:25
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# Toolchain
@ -37,7 +37,7 @@ RUN dnf -y install \
pkgconfig make cmake \
autoconf automake autogen libtool \
flex bison \
texinfo git
texinfo git curl tar
# Several tools only needed for developement and testing
RUN dnf -y install \
@ -70,11 +70,9 @@ RUN dnf -y install \
libnl3-devel \
libcurl-devel \
jansson-devel \
libsodium-devel \
libwebsockets-devel \
zeromq-devel \
nanomsg-devel \
openpgm-devel \
libxil-devel
# Build & Install Criterion

100
Dockerfile.dev-ubuntu Normal file
View file

@ -0,0 +1,100 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
# You can choose between Debian and Ubuntu here
FROM ubuntu:xenial
#FROM debian:jessie
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# Toolchain
RUN apt-get update && apt-get install -y \
gcc g++ \
pkg-config make cmake \
autoconf automake autogen libtool \
flex bison \
texinfo git curl tar
# Several tools only needed for developement and testing
RUN apt-get update && apt-get install -y \
doxygen dia graphviz \
openssh-client \
jq \
iproute \
python-pip \
valgrind gdb \
xmlto asciidoctor
# 32bit versions of some standard libraries for RT-LAB code
RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install -y \
libc6:i386 \
libstdc++6:i386 \
uuid-dev:i386 \
libssl-dev:i386
# Tools for debugging, coverage, profiling
RUN pip install \
gcovr
# Some of the dependencies are only available in our own repo
ADD https://villas.fein-aachen.org/packages/villas.repo /etc/yum.repos.d/
# Dependencies
RUN apt-get update && apt-get install -y \
libssl-dev \
libconfig-dev \
libnl-3-dev libnl-route-3-dev \
libcurl4-openssl-dev \
libjansson-dev \
libzmq3-dev \
libnanomsg-dev
# Build & Install Criterion
COPY thirdparty/criterion /tmp/criterion
RUN mkdir -p /tmp/criterion/build && cd /tmp/criterion/build && cmake .. && make install && rm -rf /tmp/*
# Build & Install libxil
COPY thirdparty/libxil /tmp/libxil
RUN mkdir -p /tmp/libxil/build && cd /tmp/libxil/build && cmake .. && make install && rm -rf /tmp/*
# Build & Install libxil
COPY thirdparty/libwebsockets /tmp/libwebsockets
RUN mkdir -p /tmp/libwebsockets/build && cd /tmp/libwebsockets/build && cmake -DLWS_IPV6=1 -DLWS_WITH_STATIC=0 -DLWS_WITHOUT_TESTAPPS=1 -DLWS_WITH_HTTP2=1 .. && make install && rm -rf /tmp/*
# Expose ports for HTTP and WebSocket frontend
EXPOSE 80
EXPOSE 443
ENV LD_LIBRARY_PATH /usr/local/lib:/usr/local/lib64
ENTRYPOINT villas
WORKDIR /villas
ENTRYPOINT bash

View file

@ -52,6 +52,7 @@ LDFLAGS += -L$(BUILDDIR)
# Some tools
PKGCONFIG := PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:$(PKG_CONFIG_PATH) pkg-config
SHELL := bash
# We must compile without optimizations for gcov!
ifdef DEBUG

View file

@ -119,18 +119,15 @@ int shmem_int_read(struct shmem_int *shm, struct sample *smps[], unsigned cnt);
*/
int shmem_int_write(struct shmem_int *shm, struct sample *smps[], unsigned cnt);
/** Allocate samples to be written to the interface. The writing process must
/** Allocate samples to be written to the interface.
*
* not free the samples; only the receiving process should free them using
* sample_put after use.
* The writing process must not free the samples; only the receiving process should free them using sample_put after use.
* @param shm The shared memory interface.
* @param smps Array where pointers to newly allocated samples will be returned.
* @param cnt Number of samples to allocate.
* @returns Number of samples that were successfully allocated (may be less then cnt).
* @return Number of samples that were successfully allocated (may be less then cnt).
*/
inline int shmem_int_alloc(struct shmem_int *shm, struct sample *smps[], unsigned cnt) {
return sample_alloc(&shm->write.shared->pool, smps, cnt);
}
int shmem_int_alloc(struct shmem_int *shm, struct sample *smps[], unsigned cnt);
/** Returns the total size of the shared memory region with the given size of
* the input/output queues (in elements) and the given number of data elements

View file

@ -56,6 +56,9 @@ ifndef WITHOUT_NANOMSG
ifeq ($(shell $(PKGCONFIG) nanomsg; echo $$?),0)
LIB_SRCS += lib/nodes/nanomsg.c
LIB_PKGS += nanomsg
else ifeq ($(shell $(PKGCONFIG) libnanomsg; echo $$?),0)
LIB_SRCS += lib/nodes/nanomsg.c
LIB_PKGS += libnanomsg
endif
endif
@ -95,17 +98,17 @@ endif
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
ifdef WITH_OPAL
ifneq ($(wildcard thirdparty/opal/include/AsyncApi.h),)
ifneq ($(wildcard thirdparty/libopal/include/opal/AsyncApi.h),)
LIB_OBJS += opal.o
LIB_CFLAGS += -I thirdparty/opal/include
LIB_LDFLAGS += -L/lib/i386-linux-gnu/ -L/usr/lib/i386-linux-gnu/ -Lthirdparty/opal/lib/redhawk/
LIB_CFLAGS += -I thirdparty/libopal/include/opal/
LIB_LDFLAGS += -L/lib/i386-linux-gnu/ -L/usr/lib/i386-linux-gnu/ -Lthirdparty/libopal/
LIB_LDLIBS += -lOpalAsyncApiCore -lOpalCore -lOpalUtils -lirc
# libOpalAsyncApi is a 32bit library. So we need to build everything in 32bit
CFLAGS += -m32
LDFLAGS += -m32
BUILDDIR := $(BUILDDIR)32
BUILDDIR := $(BUILDDIR)
endif
endif

View file

@ -182,7 +182,7 @@ void hist_plot(struct hist *h)
for (int i = 0; i < bar; i++)
buf = strcatf(&buf, "\u2588");
stats(buf);
stats("%s", buf);
free(buf);
}

View file

@ -24,6 +24,8 @@
* @{
*/
#include <inttypes.h>
#include "hook.h"
#include "plugin.h"
#include "timing.h"
@ -73,7 +75,7 @@ int hook_jitter_ts(struct hook *h, struct sample *smps[], size_t *cnt)
*/
jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE] = jitter_val[curr_count] + (abs(curr_delay_us) - jitter_val[curr_count])/16;
info("jitter %ld usec, moving average %ld usec, moving variance %ld usec\n", jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE], moving_avg[curr_count], moving_var[curr_count]);
stats("%s: jitter=%" PRId64 " usec, moving average=%" PRId64 " usec, moving variance=%" PRId64 " usec", __FUNCTION__, jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE], moving_avg[curr_count], moving_var[curr_count]);
curr_count++;
if(curr_count >= GPS_NTP_DELAY_WIN_SIZE)

View file

@ -22,6 +22,7 @@
#include <unistd.h>
#include <string.h>
#include <inttypes.h>
#include "nodes/file.h"
#include "utils.h"
@ -335,7 +336,7 @@ retry: values = sample_io_villas_fscan(f->read.handle->file, s, &flags); /* Get
if (ex == 0)
serror("Failed to wait for timer");
else if (ex != 1)
warn("Overrun: %lu", ex - 1);
warn("Overrun: %" PRIu64, ex - 1);
}
return 1;

View file

@ -159,7 +159,7 @@ static void websocket_connection_close(struct websocket_connection *c, struct lw
msg = strcatf(&msg, ": status=%u, reason=%s", status, reason);
warn(msg);
warn("%s", msg);
free(msg);
}
@ -552,7 +552,7 @@ int websocket_parse(struct node *n, config_setting_t *cfg)
d.info.ietf_version_or_minus_one = -1;
d.info.protocol = "live";
asprintf((char **) &d.info.path, "/%s", path);
ret = asprintf((char **) &d.info.path, "/%s", path);
list_push(&w->destinations, memdup(&d, sizeof(d)));
}

View file

@ -21,6 +21,7 @@
*********************************************************************************/
#include <zmq.h>
#include <zmq_utils.h>
#include "nodes/zeromq.h"
#include "utils.h"

View file

@ -169,3 +169,8 @@ int shmem_int_write(struct shmem_int *shm, struct sample *smps[], unsigned cnt)
return shm->write.shared->polling ? queue_push_many(&shm->write.shared->queue.q, (void **) smps, cnt)
: queue_signalled_push_many(&shm->write.shared->queue.qs, (void **) smps, cnt);
}
int shmem_int_alloc(struct shmem_int *shm, struct sample *smps[], unsigned cnt)
{
return sample_alloc(&shm->write.shared->pool, smps, cnt);
}

View file

@ -53,7 +53,7 @@ static int hook_parse_cli(struct hook *h, char *params[], int paramlen)
/* Concat all params */
str = NULL;
for (int i = 0; i < paramlen; i++)
str = strcatf(&str, params[i]);
str = strcatf(&str, "%s", params[i]);
config_set_auto_convert(&cfg, 1);

View file

@ -38,7 +38,7 @@ $(BUILDDIR)/tests/unit/%.o: tests/unit/%.c $(BUILDDIR)/defines | $$(dir $$@)
# Link
$(BUILDDIR)/unit-tests: $(TEST_OBJS) $(LIB)
$(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@
$(CC) $(TEST_LDFLAGS) $^ $(TEST_LDLIBS) -o $@
ifdef COVERAGE
-include tests/unit/Makefile.gcov.inc

View file

@ -36,14 +36,16 @@ Test(advio, local)
{
AFILE *af;
int ret;
char buf[32];
char *buf = NULL;
size_t buflen = 0;
af = afopen("/proc/version", "r");
/* We open this file and check the first line */
af = afopen(__FILE__, "r");
cr_assert(af, "Failed to open local file");
ret = fscanf(af->file, "%32s", buf);
cr_assert_eq(ret, 1);
cr_assert_str_eq(buf, "Linux");
ret = getline(&buf, &buflen, af->file);
cr_assert_gt(ret, 1);
cr_assert_str_eq(buf, "/** Unit tests for advio\n");
}
Test(advio, download)

View file

@ -74,7 +74,7 @@ Test(kernel, version)
cr_assert_gt(ret, 0);
}
Test(kernel, module)
Test(kernel, module, .disabled = true)
{
int ret;

View file

@ -129,9 +129,9 @@ Test(list, basics)
list_push(&l, (void *) i);
}
cr_assert_eq(list_at(&l, 555), NULL);
cr_assert_eq(list_at_safe(&l, 555), NULL);
cr_assert_eq(list_last(&l), (void *) 99);
cr_assert_eq(list_first(&l), NULL);
cr_assert_eq(list_first(&l), (void *) 0);
for (size_t j = 0, i = 0; j < list_length(&l); j++) {
void *k = list_at(&l, j);
@ -144,7 +144,7 @@ Test(list, basics)
for (size_t j = 0, i = 99; j < list_length(&l); j++) {
void *k = list_at(&l, j);
cr_assert_eq(k, (void *) i, "Is %p, expected %p", i, k);
cr_assert_eq(k, (void *) i, "Is %#zx, expected %p", i, k);
i--;
}

2
thirdparty/libxil vendored

@ -1 +1 @@
Subproject commit f679cd2c3793d6e9ecda718ff64f1fad63eb63cc
Subproject commit 1e9ba6ce5568b2712fef60f8a1923aeb3979bda7

View file

@ -30,6 +30,7 @@
#include <stdlib.h>
#include <assert.h>
#include <zmq.h>
#include <zmq_utils.h>
int main (int argc, char *argv[])
{