Commit 51527d34 authored by Sonja Happ's avatar Sonja Happ

merge remote version, accept all changes of remote version

parents a8872646 df29094a
......@@ -8,10 +8,8 @@ variables:
DOCKER_TAG: ${CI_COMMIT_REF_NAME}
DOCKER_IMAGE: villas/node
DOCKER_IMAGE_DEV: villas/node-dev
MAKE_OPTS: -j 16
LD_PRELOAD: /usr/lib64/libSegFault.so
SEGFAULT_SIGNALS: all
SEGFAULT_SIGNALS: bus abrt
MAKE_OPTS: -j32
RELEASEVER: 29
stages:
- prepare
......@@ -31,18 +29,18 @@ before_script:
prepare:fedora:docker-dev:
stage: prepare
script:
- docker build
- docker build ${DOCKER_OPTS}
--file ${DOCKER_FILE}
--tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG} .
tags:
- shell
- linux
#prepare:raspbian:docker-dev:
# extends: prepare:fedora:docker-dev
# variables:
# DOCKER_FILE: packaging/docker/Dockerfile.dev-raspbian
# DOCKER_IMAGE_DEV: villas/node-dev-raspbian
prepare:raspbian:docker-dev:
extends: prepare:fedora:docker-dev
variables:
DOCKER_FILE: packaging/docker/Dockerfile.dev-raspbian
DOCKER_IMAGE_DEV: villas/node-dev-raspbian
prepare:ubuntu:docker-dev:
extends: prepare:fedora:docker-dev
......@@ -50,11 +48,24 @@ prepare:ubuntu:docker-dev:
DOCKER_FILE: packaging/docker/Dockerfile.dev-ubuntu
DOCKER_IMAGE_DEV: villas/node-dev-ubuntu
prepare:debian-armhf:docker-dev:
extends: prepare:fedora:docker-dev
variables:
DOCKER_FILE: packaging/docker/Dockerfile.dev-debian-multiarch
DOCKER_IMAGE_DEV: villas/node-dev-debian-armhf
DOCKER_OPTS: --build-arg ARCH=armhf --build-arg TRIPLET=arm-linux-gnueabihf
prepare:debian-arm64:docker-dev:
extends: prepare:fedora:docker-dev
variables:
DOCKER_FILE: packaging/docker/Dockerfile.dev-debian-multiarch
DOCKER_IMAGE_DEV: villas/node-dev-debian-arm64
DOCKER_OPTS: --build-arg ARCH=arm64 --build-arg TRIPLET=aarch64-linux-gnu
# Stage: build
##############################################################################
build:fedora:x86_64:
build:base:
stage: build
script:
- mkdir -p build && cd build
......@@ -68,22 +79,38 @@ build:fedora:x86_64:
tags:
- docker
build:fedora:x86_64:
extends: build:base
build:fedora-minimal:x86_64:
extends: build:fedora:x86_64
extends: build:base
variables:
CMAKE_OPTS: -DWITH_HOOKS=OFF -DWITH_WEB=OFF -DWITH_API=OFF -DWITH_CONFIG=OFF -DWITH_SRC=OFF -DWITH_TOOLS=OFF -DWITH_TESTS=OFF -DWITH_PLUGINS=OFF -DWITH_CLIENTS=OFF -DWITH_DOC=OFF
build:ubuntu:x86_64:
extends: build:fedora:x86_64
extends: build:base
variables:
LD_PRELOAD: /lib/x86_64-linux-gnu/libSegFault.so
DOCKER_IMAGE_DEV: villas/node-dev-ubuntu
CMAKE_OPTS: -DCMAKE_MODULE_PATH=/usr/local/lib64/cmake -DCMAKE_PREFIX_PATH=/usr/local
build:raspbian:armv6l:
extends: build:base
variables:
DOCKER_IMAGE_DEV: villas/node-dev-raspbian
CMAKE_OPTS: -DWITH_NODE_INFINIBAND=OFF
when: manual
build:debian-multiarch:armhf:
extends: build:base
variables:
DOCKER_IMAGE_DEV: villas/node-dev-debian-armhf
CMAKE_OPTS: -DCMAKE_TOOLCHAIN_FILE=/debian-armhf.cmake -DCMAKE_INSTALL_LIBDIR=/usr/lib/arm-linux-gnueabihf
#build:raspbian:armv6l:
# extends: build:fedora:x86_64
# variables:
# LD_PRELOAD: /lib/arm-linux-gnueabihf/libSegFault.so
# DOCKER_IMAGE_DEV: villas/node-dev-raspbian
build:debian-multiarch:arm64:
extends: build:base
variables:
DOCKER_IMAGE_DEV: villas/node-dev-debian-arm64
CMAKE_OPTS: -DCMAKE_TOOLCHAIN_FILE=/debian-arm64.cmake -DCMAKE_INSTALL_LIBDIR=/usr/lib/aarch64-linux-gnu
build:docs:
stage: build
......@@ -98,9 +125,6 @@ build:docs:
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
tags:
- docker
only:
- tags
- master
# Stage: test
......@@ -110,6 +134,10 @@ test:unit:
stage: test
dependencies:
- build:fedora:x86_64
variables:
LD_PRELOAD: /usr/lib64/libSegFault.so
SEGFAULT_SIGNALS: all
SEGFAULT_SIGNALS: bus abrt
script:
- mkdir -p build && cd build
- cmake .. && make ${MAKE_OPTS} unit-tests
......@@ -122,6 +150,10 @@ test:integration:
stage: test
dependencies:
- build:fedora:x86_64
variables:
LD_PRELOAD: /usr/lib64/libSegFault.so
SEGFAULT_SIGNALS: all
SEGFAULT_SIGNALS: bus abrt
script:
- mkdir -p build && cd build
- cmake ..
......@@ -132,6 +164,7 @@ test:integration:
paths:
- build/tests/integration/
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
allow_failure: true
tags:
- docker
......@@ -154,10 +187,11 @@ packaging:docker:
packaging:rpm:
stage: packaging
dependencies:
- build:docs
- build:fedora:x86_64
script:
- mkdir -p build && cd build
- cmake ..
- make ${MAKE_OPTS} doc
- make ${MAKE_OPTS} package
artifacts:
expire_in: 1 week
......@@ -168,9 +202,6 @@ packaging:rpm:
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
tags:
- docker
only:
- tags
- master
# Stage: deploy
##############################################################################
......@@ -188,16 +219,24 @@ deploy:web:
tags:
- villas-deploy
deploy:packages:
.deploy:packages: &deploy_packages
stage: deploy
script:
- ssh ${DEPLOY_USER}@${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}/{dist,../packages}
- rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/../packages/x86_64/
- rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/dist/
- ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo ${DEPLOY_PATH}/../packages
- ssh ${DEPLOY_USER}@${DEPLOY_HOST} mkdir -p $${DEPLOY_PATH_PACKAGES}/{fedora/x86_64,dist}
- rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH_PACKAGES}/dist/
- rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH_PACKAGES}/fedora/${RELEASEVER}/x86_64
- ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo ${DEPLOY_PATH_PACKAGES}/fedora/${RELEASEVER}/x86_64
dependencies:
- packaging:rpm
tags:
- villas-deploy
deploy:packages:manual:
<<: *deploy_packages
when: manual
deploy:packages:tags:
<<: *deploy_packages
only:
- tags
# Only on version tags
- "/^v\\d+(\\.\\d+)+$/"
......@@ -129,6 +129,7 @@ cmake_dependent_option(WITH_DOC "Build documentation"
cmake_dependent_option(WITH_NODE_AMQP "Build with amqp node-type" ON "RABBITMQ_C_FOUND" OFF)
cmake_dependent_option(WITH_NODE_COMEDI "Build with comedi node-type" ON "COMEDILIB_FOUND" OFF)
cmake_dependent_option(WITH_NODE_FILE "Build with file node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_EXEC "Build with exec node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_IEC61850 "Build with iec61850 node-types" ON "LIBIEC61850_FOUND" OFF)
cmake_dependent_option(WITH_NODE_INFINIBAND "Build with infiniband node-type" ON "IBVERBS_FOUND; RDMACM_FOUND" OFF)
cmake_dependent_option(WITH_NODE_INFLUXDB "Build with influxdb node-type" ON "" OFF)
......
......@@ -568,9 +568,9 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned reserved1 : 2; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned reserved1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else
......@@ -730,7 +730,8 @@ struct sockaddr_in rec_addr;
msg->version = MSG_VERSION;
msg->type = MSG_TYPE_DATA;
msg->rsvd1 = 0;
msg->reserved1 = 0;
msg->reserved2 = 0;
msg->id = 0;
msg->length = NO_SEND_DATA;
msg->sequence = sequence++;
......
......@@ -66,9 +66,9 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned reserved1 : 2; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned reserved1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else
......
......@@ -118,7 +118,8 @@ static void * SendToIPPort(void *arg)
msg->version = MSG_VERSION;
msg->type = MSG_TYPE_DATA;
msg->rsvd1 = 0;
msg->reserved1 = 0;
msg->reserved2 = 0;
msg->id = SendID;
msg->length = cnt;
msg->sequence = Sequence++;
......
......@@ -63,7 +63,7 @@ int msg_verify(struct msg *m)
return -1;
else if (m->type != MSG_TYPE_DATA)
return -2;
else if (m->rsvd1 != 0)
else if (m->reserved1 != 0)
return -3;
else
return 0;
......
......@@ -23,108 +23,122 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include <string.h>
#include <iostream>
#include <atomic>
#include <villas/node/config.h>
#include <villas/log.hpp>
#include <villas/node/exceptions.hpp>
#include <villas/node.h>
#include <villas/pool.h>
#include <villas/sample.h>
#include <villas/shmem.h>
#include <villas/colors.hpp>
#include <villas/tool.hpp>
#include <villas/log.hpp>
#include <villas/utils.hpp>
#include <villas/copyright.hpp>
#include <villas/node/exceptions.hpp>
using namespace villas;
namespace villas {
namespace node {
namespace tools {
static std::atomic<bool> stop(false);
class Shmem : public Tool {
static void usage()
{
std::cout << "Usage: villas-test-shmem WNAME VECTORIZE" << std::endl
<< " WNAME name of the shared memory object for the output queue" << std::endl
<< " RNAME name of the shared memory object for the input queue" << std::endl
<< " VECTORIZE maximum number of samples to read/write at a time" << std::endl;
public:
Shmem(int argc, char *argv[]) :
Tool(argc, argv, "shmem"),
stop(false)
{ }
print_copyright();
}
protected:
std::atomic<bool> stop;
void quit(int, siginfo_t*, void*)
{
stop = true;
}
void usage()
{
std::cout << "Usage: villas-test-shmem WNAME VECTORIZE" << std::endl
<< " WNAME name of the shared memory object for the output queue" << std::endl
<< " RNAME name of the shared memory object for the input queue" << std::endl
<< " VECTORIZE maximum number of samples to read/write at a time" << std::endl;
int main(int argc, char* argv[])
{
int ret, readcnt, writecnt, avail;
printCopyright();
}
Logger logger = logging.get("test-shmem");
void handler(int, siginfo_t *, void *)
{
stop = true;
}
struct shmem_int shm;
struct shmem_conf conf = {
.polling = 0,
.queuelen = DEFAULT_SHMEM_QUEUELEN,
.samplelen = DEFAULT_SHMEM_SAMPLELEN
};
int main()
{
int ret, readcnt, writecnt, avail;
if (argc != 4) {
usage();
return 1;
}
struct shmem_int shm;
struct shmem_conf conf = {
.polling = 0,
.queuelen = DEFAULT_SHMEM_QUEUELEN,
.samplelen = DEFAULT_SHMEM_SAMPLELEN
};
ret = utils::signals_init(quit);
if (ret)
throw RuntimeError("Failed to initialize signals");
if (argc != 4) {
usage();
return 1;
}
char *wname = argv[1];
char *rname = argv[2];
int vectorize = atoi(argv[3]);
std::string wname = argv[1];
std::string rname = argv[2];
int vectorize = atoi(argv[3]);
ret = shmem_int_open(wname, rname, &shm, &conf);
if (ret < 0)
throw RuntimeError("Failed to open shared-memory interface");
ret = shmem_int_open(wname.c_str(), rname.c_str(), &shm, &conf);
if (ret < 0)
throw RuntimeError("Failed to open shared-memory interface");
struct sample *insmps[vectorize], *outsmps[vectorize];
struct sample *insmps[vectorize], *outsmps[vectorize];
while (!stop) {
readcnt = shmem_int_read(&shm, insmps, vectorize);
if (readcnt == -1) {
logger->info("Node stopped, exiting");
break;
}
while (!stop) {
readcnt = shmem_int_read(&shm, insmps, vectorize);
if (readcnt == -1) {
logger->info("Node stopped, exiting");
break;
}
avail = shmem_int_alloc(&shm, outsmps, readcnt);
if (avail < readcnt)
logger->warn("Pool underrun: %d / %d\n", avail, readcnt);
avail = shmem_int_alloc(&shm, outsmps, readcnt);
if (avail < readcnt)
logger->warn("Pool underrun: %d / %d\n", avail, readcnt);
for (int i = 0; i < avail; i++) {
outsmps[i]->sequence = insmps[i]->sequence;
outsmps[i]->ts = insmps[i]->ts;
for (int i = 0; i < avail; i++) {
outsmps[i]->sequence = insmps[i]->sequence;
outsmps[i]->ts = insmps[i]->ts;
int len = MIN(insmps[i]->length, outsmps[i]->capacity);
memcpy(outsmps[i]->data, insmps[i]->data, SAMPLE_DATA_LENGTH(len));
int len = MIN(insmps[i]->length, outsmps[i]->capacity);
memcpy(outsmps[i]->data, insmps[i]->data, SAMPLE_DATA_LENGTH(len));
outsmps[i]->length = len;
}
outsmps[i]->length = len;
}
for (int i = 0; i < readcnt; i++)
sample_decref(insmps[i]);
for (int i = 0; i < readcnt; i++)
sample_decref(insmps[i]);
writecnt = shmem_int_write(&shm, outsmps, avail);
if (writecnt < avail)
logger->warn("Short write");
writecnt = shmem_int_write(&shm, outsmps, avail);
if (writecnt < avail)
logger->warn("Short write");
logger->info("Read / Write: {}/{}", readcnt, writecnt);
logger->info("Read / Write: {}/{}", readcnt, writecnt);
}
ret = shmem_int_close(&shm);
if (ret)
throw RuntimeError("Failed to close shared-memory interface");
return 0;
}
};
ret = shmem_int_close(&shm);
if (ret)
throw RuntimeError("Failed to close shared-memory interface");
} // namespace tools
} // namespace node
} // namespace villas
logger->info(CLR_GRN("Goodbye!"));
int main(int argc, char *argv[])
{
villas::node::tools::Shmem t(argc, argv);
return 0;
return t.run();
}
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(TRIPLET "aarch64-linux-gnu")
# specify the cross compiler
SET(CMAKE_C_COMPILER "/usr/bin/${TRIPLET}-gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/${TRIPLET}-g++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
set(CMAKE_EXE_LINKER_FLAGS " ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
set(CMAKE_LIBRARY_PATH "/usr/lib/${TRIPLET}")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(TRIPLET "arm-linux-gnueabihf")
# specify the cross compiler
SET(CMAKE_C_COMPILER "/usr/bin/${TRIPLET}-gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/${TRIPLET}-g++")
set(CMAKE_C_FLAGS "-mfloat-abi=hard ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS")
set(CMAKE_CXX_FLAGS "-mfloat-abi=hard ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
set(CMAKE_EXE_LINKER_FLAGS " ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
set(CMAKE_LIBRARY_PATH "/usr/lib/${TRIPLET}")
Subproject commit 907e81d81b466126c09a91e3cd2b93d138cb6b96
Subproject commit 43fd33c9c77db22b93f65c92a1acb25c141d42a3
@include "hook-nodes.conf"
paths = (
{
in = "signal_node"
out = "file_node"
hooks = (
{
type = "gate"
signal = "square"
mode = "above"
threshold = 0.5
# Once triggered, keep active for:
duration = 5 # in seconds
samples = 100 # in number of samples
}
)
}
)
@include "hook-nodes.conf"
paths = (
{
in = "signal_node"
out = "file_node"
hooks = (
{
type = "scale"
signal = "sine"
scale = 5.5
offset = 1.2
}
)
}
)
nodes = {
exec_node = {
type = "exec"
format = "villas.human"
flush = true
exec = "tee test"
shell = true
working_directory = "/tmp"
environment = {
MYVAR = "TESTVAL"
}
}
}
......@@ -54,7 +54,7 @@ class Api {
protected:
Logger logger;
enum state state;
enum State state;
std::thread thread;
std::atomic<bool> running; /**< Atomic flag for signalizing thread termination. */
......
......@@ -51,7 +51,7 @@ class Socket;
class Server {
protected:
enum state state;
enum State state;
Api *api;
Logger logger;
......
......@@ -23,7 +23,6 @@
#pragma once
#include <stdbool.h>
#include <jansson.h>
#include <villas/queue.h>
......
......@@ -23,7 +23,7 @@
#pragma once
#include <stdio.h>
#include <cstdio>
/* Forward declarations */
struct sample;
......
......@@ -23,7 +23,7 @@
#pragma once
#include <stdlib.h>
#include <cstdlib>
/* Forward declarations. */
struct io;
......
......@@ -23,7 +23,7 @@
#pragma once
#include <stdint.h>
#include <cstdint>
/** The current version number for the message format */
#define MSG_VERSION 2
......@@ -43,10 +43,9 @@
#define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data))
/** The timestamp of a message in struct timespec format */
#define MSG_TS(msg) (struct timespec) { \
.tv_sec = (msg)->ts.sec, \
.tv_nsec = (msg)->ts.nsec \
}
#define MSG_TS(msg, i) \
i.tv_sec = (msg)->ts.sec; \
i.tv_nsec = (msg)->ts.nsec;
/** This message format is used by all clients
*
......@@ -57,16 +56,16 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN