Skip to content
Snippets Groups Projects
Commit d9aa1395 authored by Millian Poquet's avatar Millian Poquet
Browse files

unit tests++

parent da0a4ed0
No related branches found
No related tags found
No related merge requests found
Pipeline #4503 passed
......@@ -11,7 +11,10 @@ debian:
script:
# Get various dependencies
- apt update -y
- apt install -y g++ libsimgrid-dev libzmq3-dev libprotobuf-dev protobuf-compiler libgtest-dev meson ninja-build pkg-config python3 python3-pip
- apt install -y g++ libsimgrid-dev libzmq3-dev libprotobuf-dev protobuf-compiler libgtest-dev meson ninja-build pkg-config python3 python3-pip python3-pytest
# Put pip-installed binaries in PATH
- export PATH="${PATH}:/usr/local/bin"
# Build protocol (c++)
- (cd protocol && meson setup build --prefix=/usr && ninja -C build && meson install -C build)
......@@ -29,10 +32,13 @@ debian:
# Run unit tests (simgrid simulator, c++)
- (cd simgrid-simulator && meson test -C build)
# Run unit tests (python)
- (cd client-py && pytest .)
# Run integration tests (simgrid simulator VS c++ client)
- test/simulator-cpp-client.sh
# Run integration tests (simgrid simulator VS python client)
- PATH="${PATH}:/usr/local/bin" test/simulator-py-client.sh
- test/simulator-py-client.sh
artifacts:
paths:
- client-cpp.err
......@@ -54,5 +60,6 @@ nix:
# Any dependency will also be built, for example the following command also builds protocol-python
- nix-build . -A client-py
# Therefore one can just run its desired leaf of the build tree, such as:
- nix-shell . -A client-py_unittest_shell --command '(cd client-py && pytest)'
- nix-shell . -A integration_shell_cpp --command './test/simulator-cpp-client.sh'
- nix-shell . -A integration_shell_py --command './test/simulator-py-client.sh'
......@@ -2,6 +2,9 @@
import zmq
import protocol.hello_pb2 as proto
def some_function(x):
return x*2
def main():
context = zmq.Context()
socket = context.socket(zmq.REP)
......
#!/usr/bin/env python3
import client
def test_some_function():
for i in range(10):
assert(client.some_function(i) == i*2)
......@@ -44,7 +44,11 @@ let self = rec {
"src"
"src/.*\.cpp"
"src/.*\.hpp"
"test"
"test/.*\.cpp"
];
mesonFlags = [ "-Ddo_unit_tests=true" ];
doCheck = true;
buildInputs = with pkgs; [
simgrid
protocol-cpp
......@@ -85,6 +89,11 @@ let self = rec {
];
};
client-py_unittest_shell = pkgs.mkShell {
buildInputs = client-py.propagatedBuildInputs ++ [
pythonPackages.pytest
];
};
integration_shell_cpp = pkgs.mkShell {
buildInputs = [
simgrid-simulator
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment