Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
f797b322
Commit
f797b322
authored
Oct 28, 2016
by
Philip ABBET
Browse files
Add a test for the C++ backend
parent
c729b7db
Pipeline
#5140
failed with stage
in 3 minutes and 38 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
beat/core/schema/common/1.json
View file @
f797b322
...
...
@@ -49,7 +49,7 @@
"enum"
:
[
"unknown"
,
"python"
,
"
binary
"
,
"
cxx
"
,
"matlab"
,
"r"
]
...
...
beat/core/test/prefix/algorithms/user/cxx_integers_echo/1.json
0 → 100644
View file @
f797b322
{
"language"
:
"cxx"
,
"splittable"
:
true
,
"groups"
:
[
{
"name"
:
"main"
,
"inputs"
:
{
"in_data"
:
{
"type"
:
"user/single_integer/1"
}
},
"outputs"
:
{
"out_data"
:
{
"type"
:
"user/single_integer/1"
}
}
}
]
}
beat/core/test/prefix/algorithms/user/cxx_integers_echo/CMakeLists.txt
0 → 100644
View file @
f797b322
cmake_minimum_required
(
VERSION 3.0
)
project
(
BEAT_CORE_CXX_INTEGERS_ECHO
)
set
(
BEAT_BACKEND_CXX_DIR
"/usr/local/beat"
)
# CMake setup
include
(
CheckCXXCompilerFlag
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
if
(
COMPILER_SUPPORTS_CXX11
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
elseif
(
COMPILER_SUPPORTS_CXX0X
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++0x"
)
else
()
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has no C++11 support. Please use a different C++ compiler."
)
endif
()
# Retrieve the dependencies
find_package
(
Boost REQUIRED
)
# Setup the search paths
include_directories
(
"
${
BEAT_BACKEND_CXX_DIR
}
/include"
"
${
Boost_INCLUDE_DIRS
}
"
)
link_directories
(
"
${
BEAT_BACKEND_CXX_DIR
}
/bin"
)
# List the source files
set
(
HEADERS
"algorithm.h"
"beat_setup.h"
"user_single_integer_1.h"
)
set
(
SRCS
"algorithm.cpp"
"beat_setup.cpp"
"user_single_integer_1.cpp"
)
# Create and link the library
add_library
(
cxx_integers_echo SHARED
${
SRCS
}
${
HEADERS
}
)
target_link_libraries
(
cxx_integers_echo beat_backend_cxx
)
set_target_properties
(
cxx_integers_echo PROPERTIES
COMPILE_FLAGS
"-fPIC"
OUTPUT_NAME
"1"
PREFIX
""
LIBRARY_OUTPUT_DIRECTORY
"
${
BEAT_CORE_CXX_INTEGERS_ECHO_SOURCE_DIR
}
"
)
beat/core/test/prefix/algorithms/user/cxx_integers_echo/algorithm.cpp
0 → 100644
View file @
f797b322
// NOTE: This file implements the algorithm declared in the file
// 'user/cxx_integers_echo/1.json'
#include
"algorithm.h"
#include
"user_single_integer_1.h"
using
namespace
beat
::
backend
::
cxx
;
Algorithm
::
Algorithm
()
{
}
//---------------------------------------------------------
Algorithm
::~
Algorithm
()
{
}
//---------------------------------------------------------
bool
Algorithm
::
setup
(
const
json
&
parameters
)
{
return
true
;
}
//---------------------------------------------------------
bool
Algorithm
::
process
(
const
InputList
&
inputs
,
const
OutputList
&
outputs
)
{
auto
data
=
inputs
[
"in_data"
]
->
data
<
user
::
single_integer_1
>
();
outputs
[
"out_data"
]
->
write
(
data
);
return
true
;
}
//---------------------------------------------------------
IAlgorithm
*
create_algorithm
()
{
return
new
Algorithm
();
}
beat/core/test/prefix/algorithms/user/cxx_integers_echo/algorithm.h
0 → 100644
View file @
f797b322
// NOTE: This file implements the algorithm declared in the file
// 'user/cxx_integers_echo/1.json'
#ifndef _BEAT_GENERATED_ALGORITHM_H_
#define _BEAT_GENERATED_ALGORITHM_H_
#include
<beat.backend.cxx/algorithm.h>
class
Algorithm
:
public
beat
::
backend
::
cxx
::
IAlgorithm
{
public:
Algorithm
();
virtual
~
Algorithm
();
virtual
bool
setup
(
const
json
&
parameters
);
virtual
bool
process
(
const
beat
::
backend
::
cxx
::
InputList
&
inputs
,
const
beat
::
backend
::
cxx
::
OutputList
&
outputs
);
};
extern
"C"
{
beat
::
backend
::
cxx
::
IAlgorithm
*
create_algorithm
();
}
#endif
beat/core/test/prefix/algorithms/user/cxx_integers_echo/beat_setup.cpp
0 → 100644
View file @
f797b322
// NOTE: This file was automatically generated from the algorithm declaration file
// 'user/cxx_integers_echo/1.json'
#include
<beat.backend.cxx/dataformatfactory.h>
#include
"beat_setup.h"
#include
"user_single_integer_1.h"
using
namespace
beat
::
backend
::
cxx
;
void
setup_beat_cxx_module
()
{
DataFormatFactory
*
factory
=
DataFormatFactory
::
getInstance
();
factory
->
registerDataFormat
(
"user/single_integer/1"
,
&
user
::
single_integer_1
::
create
);
}
beat/core/test/prefix/algorithms/user/cxx_integers_echo/beat_setup.h
0 → 100644
View file @
f797b322
// NOTE: This file was automatically generated from the algorithm declaration file
// 'user/cxx_integers_echo/1.json'
#ifndef _BEAT_SETUP_H_
#define _BEAT_SETUP_H_
extern
"C"
{
void
setup_beat_cxx_module
();
}
#endif
beat/core/test/prefix/algorithms/user/cxx_integers_echo/user_single_integer_1.cpp
0 → 100644
View file @
f797b322
// NOTE: This file was automatically generated from the dataformat declaration file
// 'user/single_integer/1.json'
#include
"user_single_integer_1.h"
#include
<beat.backend.cxx/dataformatfactory.h>
using
namespace
beat
::
backend
::
cxx
;
user
::
single_integer_1
::
single_integer_1
()
{
}
//---------------------------------------------------------
size_t
user
::
single_integer_1
::
size
()
const
{
return
sizeof
(
int32_t
);
}
//---------------------------------------------------------
void
user
::
single_integer_1
::
pack
(
uint8_t
**
buffer
)
const
{
beat
::
backend
::
cxx
::
pack
(
value
,
buffer
);
}
//---------------------------------------------------------
void
user
::
single_integer_1
::
unpack
(
uint8_t
**
buffer
)
{
value
=
beat
::
backend
::
cxx
::
unpack_scalar
<
int32_t
>
(
buffer
);
}
//---------------------------------------------------------
Data
*
user
::
single_integer_1
::
create
()
{
return
new
user
::
single_integer_1
();
}
beat/core/test/prefix/algorithms/user/cxx_integers_echo/user_single_integer_1.h
0 → 100644
View file @
f797b322
// NOTE: This file was automatically generated from the dataformat declaration file
// 'user/single_integer/1.json'
#ifndef _BEAT_GENERATED_user_single_integer_1_H_
#define _BEAT_GENERATED_user_single_integer_1_H_
#include
<beat.backend.cxx/data.h>
namespace
user
{
class
single_integer_1
:
public
beat
::
backend
::
cxx
::
Data
{
public:
single_integer_1
();
virtual
size_t
size
()
const
;
virtual
void
pack
(
uint8_t
**
buffer
)
const
;
virtual
void
unpack
(
uint8_t
**
buffer
);
static
Data
*
create
();
public:
int32_t
value
;
};
}
#endif
beat/core/test/prefix/experiments/user/user/double/1/cxx_double.json
0 → 100644
View file @
f797b322
{
"analyzers"
:
{
"analysis"
:
{
"algorithm"
:
"user/integers_echo_analyzer/1"
,
"inputs"
:
{
"in_data"
:
"in"
}
}
},
"blocks"
:
{
"echo1"
:
{
"algorithm"
:
"user/cxx_integers_echo/1"
,
"inputs"
:
{
"in_data"
:
"in"
},
"outputs"
:
{
"out_data"
:
"out"
},
"environment"
:
{
"name"
:
"cxx_environment"
,
"version"
:
"1"
}
},
"echo2"
:
{
"algorithm"
:
"user/cxx_integers_echo/1"
,
"inputs"
:
{
"in_data"
:
"in"
},
"outputs"
:
{
"out_data"
:
"out"
},
"environment"
:
{
"name"
:
"cxx_environment"
,
"version"
:
"1"
}
}
},
"datasets"
:
{
"set"
:
{
"database"
:
"simple/1"
,
"protocol"
:
"protocol"
,
"set"
:
"set"
}
},
"globals"
:
{
"queue"
:
"queue"
,
"environment"
:
{
"name"
:
"environment"
,
"version"
:
"1"
}
}
}
beat/core/test/test_docker.py
View file @
f797b322
...
...
@@ -55,7 +55,7 @@ class AsyncTest(unittest.TestCase):
@
classmethod
def
setUpClass
(
cls
):
cls
.
host
=
Host
()
cls
.
host
=
Host
(
use_machine
=
'default'
)
cls
.
host
.
setup
()
...
...
beat/core/test/test_execution.py
View file @
f797b322
...
...
@@ -59,7 +59,7 @@ class TestExecution(unittest.TestCase):
@
classmethod
def
setUpClass
(
cls
):
cls
.
host
=
Host
()
cls
.
host
=
Host
(
use_machine
=
'default'
)
cls
.
host
.
setup
()
...
...
@@ -210,3 +210,6 @@ class TestExecution(unittest.TestCase):
def
test_double_triangle_1
(
self
):
assert
self
.
execute
(
'user/user/double_triangle/1/double_triangle'
,
[{
'out_data'
:
42
}])
is
None
def
test_cxx_double_1
(
self
):
assert
self
.
execute
(
'user/user/double/1/cxx_double'
,
[{
'out_data'
:
42
}])
is
None
beat/core/utils.py
View file @
f797b322
...
...
@@ -93,7 +93,7 @@ def extension_for_language(language):
return
dict
(
unknown
=
''
,
binary
=
'.
bin
'
,
cxx
=
'.
so
'
,
matlab
=
'.m'
,
python
=
'.py'
,
r
=
'.r'
,
...
...
buildout.cfg
View file @
f797b322
[buildout]
parts = scripts cpulimit
index = https://pypi.org/simple
parts = scripts cpulimit cxx_integers_echo_algorithm
extensions = mr.developer
auto-checkout = *
develop = .
...
...
@@ -23,3 +24,20 @@ on_update = true
[scripts]
recipe = bob.buildout:scripts
[cxx_integers_echo_algorithm]
recipe = collective.recipe.cmd
cmds = cd beat/core/test/prefix/algorithms/user/
tar -cf cxx_integers_echo.tar cxx_integers_echo/
docker run -dti --name build beats/cxx_dev:0.1.2 > /dev/null
docker cp cxx_integers_echo.tar build:/tmp/cxx_integers_echo.tar
docker exec build bash -c 'cd /tmp ; tar -xf /tmp/cxx_integers_echo.tar'
docker exec build bash -c 'cd /tmp/cxx_integers_echo ; mkdir build ; cd build ; cmake .. ; make'
docker cp build:/tmp/cxx_integers_echo/1.so cxx_integers_echo/.
docker stop build > /dev/null
docker rm build > /dev/null
rm cxx_integers_echo.tar
cd ../../../../../..
uninstall_cmds = rm -f beat/core/test/prefix/algorithms/user/cxx_integers_echo/1.so
on_install = true
on_update = true
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment