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

Merge tag 'v1.3.0' into releases

Version 1.3.0

Added
- CLI: logging verbosity can now be set with `--verbosity`.

Changed
- Dependencies: added [intervalset](https://framagit.org/batsim/intervalset).
- Dependencies: added [loguru](https://github.com/emilk/loguru).
parents 588e53dd b74b81f5
No related branches found
No related tags found
No related merge requests found
Showing with 504 additions and 50 deletions
*.user
build
test-out
test-instances
cover
image: oarteam/robin_ci
image: oarteam/batsim_ci
variables:
GIT_SUBMODULE_STRATEGY: none
stages:
- build
- update_dependencies_cache
- test
- coverage
- deploy
###############################################################################
# Build stage
###############################################################################
build:
stage: build
script:
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- |
nix-shell /datamovepkgs -A batsched \
--command 'cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-Denable_warnings=ON \
-Dtreat_warnings_as_errors=ON'
- nix-shell /datamovepkgs -A batsched --command 'make'
- ./ci/build.bash
artifacts:
paths:
- ${CI_PROJECT_DIR}/build/batsched
- /builds/batsim/batsched/build
###############################################################################
# Dependencies cache stage
###############################################################################
update_dependencies_cache:
stage: update_dependencies_cache
script:
- ./ci/update-dependencies-cache.bash
###############################################################################
# Test stage
###############################################################################
# batsim_tests:
# stage: test
# script:
# # Remove nix-installed batsched
# - nix-env -e batsched-v1.1.0
# # Install ci-built batsched
# - export PATH="${PATH}:${CI_PROJECT_DIR}/build"
# # Install and run the redis server
# - nix-env -i redis
# - |
# redis-server>/dev/null &
# while ! nc -z localhost 6379; do
# sleep 1
# done
# # Prepare Batsim directory to generate the tests
# - mkdir -p /batsim/build
# - cd /batsim/build
# - nix-shell /datamovepkgs -A batsim --command 'cmake ..'
# # Finally run the tests
# - cd /batsim
# - echo "Batsim tests are not run yet."
# - batsched --version
# dependencies:
# - build
test_pinned_batsim:
stage: test
script:
- nix-shell ./ci -A test_pinned --command 'bash ./ci/run-tests.bash'
dependencies:
- build
artifacts:
paths:
- /builds/batsim/batsched/build
test_dev_batsim:
stage: test
script:
- nix-shell ./ci -A test_dev --command 'bash ./ci/run-tests.bash'
dependencies:
- build
###############################################################################
# Coverage stage
###############################################################################
coverage:
stage: coverage
script:
- nix-shell ./ci -A test_deps_pinned --command 'bash ./ci/analyze-coverage.bash'
dependencies:
- test_pinned_batsim
artifacts:
paths:
- /builds/batsim/batsched/cover
###############################################################################
# Deploy stage
###############################################################################
deploy_coverage:
stage: deploy
script:
# Pushes Batsim's code doc (doxygen) onto the gforge website.
# SSH setup (do NOT run these commands on your machine)
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
# Finally push the code documentation on the gforge website
- rsync -rlgoDz --delete cover/html/ mpoquet@scm.gforge.inria.fr:/home/groups/batsim/htdocs/batsched/coverage
dependencies:
- coverage
only:
- master
deploy_batsched_dev_cachix:
stage: deploy
script:
- ./ci/update-batsched_dev-cache.bash
only:
- master
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog][changelog]
and this project adheres to [Semantic Versioning][semver].
The format is based on [Keep a Changelog][changelog].
Batsched adheres to [Semantic Versioning][semver] and its public API is the following.
- Batched's command-line interface.
- The format of Batsched's input files.
- **Important note**: Changes in the Batsim protocol does not impact
Batsched's public API.
[//]: =========================================================================
## [Unreleased]
[//]: =========================================================================
## [1.3.0] - 2019-01-15 - For [Batsim v3.0.0][Batsim v3.0.0]
### Added
- CLI: logging verbosity can now be set with `--verbosity`.
### Changed
- Dependencies: added [intervalset](https://framagit.org/batsim/intervalset).
- Dependencies: added [loguru](https://github.com/emilk/loguru).
[//]: =========================================================================
## [1.2.1] - 2018-07-03 - For [Batsim v2.0.0][Batsim v2.0.0]
### Fixed
......@@ -71,9 +85,11 @@ Initial release.
[taywee/args]: https://github.com/Taywee/args
[boost::po]: http://www.boost.org/doc/libs/1_66_0/doc/html/program_options.html
[Batsim v2.0.0]: https://github.com/oar-team/batsim/blob/master/doc/changelog.md#200---2018-02-20
[Batsim v2.0.0]: https://batsim.readthedocs.io/en/latest/changelog.html#v2-0-0
[Batsim v3.0.0]: https://batsim.readthedocs.io/en/latest/changelog.html#v3-0-0
[Unreleased]: https://gitlab.inria.fr/batsim/batsched/compare/v1.2.1...master
[Unreleased]: https://gitlab.inria.fr/batsim/batsched/compare/v1.3.0...master
[1.3.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.2.1...v1.3.0
[1.2.1]: https://gitlab.inria.fr/batsim/batsched/compare/v1.2.0...v1.2.1
[1.2.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.1.0...v1.2.0
[1.1.0]: https://gitlab.inria.fr/batsim/batsched/compare/v1.0.0...v1.1.0
......@@ -10,6 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Options
option(enable_warnings "Enable compilation warnings" ON)
option(treat_warnings_as_errors "Treat compilation warnings as compilation errors" OFF)
option(do_coverage "Compile in coverage mode" OFF)
# Build type
# Set a default build type if none was specified
......@@ -25,11 +26,32 @@ endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Coverage
if (do_coverage)
set(coverage_cxxflags "-g -O0 -fprofile-arcs -ftest-coverage")
set(coverage_ldflags "-lgcov --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${coverage_cxxflags}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${coverage_ldflags}")
endif()
# Dependencies
## Boost
find_package(Boost 1.48 REQUIRED COMPONENTS regex locale)
include_directories(${Boost_INCLUDE_DIR})
## Intervalset
find_package(intervalset REQUIRED)
include_directories(${INTERVALSET_INCLUDE_DIR})
## loguru
find_package(loguru REQUIRED)
include_directories(${LOGURU_INCLUDE_DIR})
## pthread (for loguru)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
## GMP
find_package(GMP REQUIRED)
include_directories(${GMP_INCLUDE_DIR})
......@@ -64,6 +86,10 @@ add_executable(batsched ${batsched_SRC})
target_link_libraries(batsched ${GMP_LIBRARIES}
${Boost_REGEX_LIBRARY_DEBUG}
${Boost_LOCALE_LIBRARY_DEBUG}
${INTERVALSET_LIBRARY}
${LOGURU_LIBRARIES}
Threads::Threads
${CMAKE_DL_LIBS}
${REDOX_LIBRARY}
${LIBEV_LIBRARY}
${HIREDIS_LIBRARY}
......@@ -96,7 +122,7 @@ endif()
####################
# Batsched version #
####################
set(default_batsched_version "v1.2.1")
set(default_batsched_version "v1.3.0")
include(GetGitRevisionDescription)
git_describe(batsched_version)
message(STATUS "Batsched version from git: ${batsched_version}")
......
[![pipeline status](https://framagit.org/batsim/batsched/badges/master/pipeline.svg)](https://framagit.org/batsim/batsched/pipelines)
[![coverage report](https://framagit.org/batsim/batsched/badges/master/coverage.svg)](http://batsim.gforge.inria.fr/batsched/coverage/)
[![changelog](https://img.shields.io/badge/doc-changelog-blue.svg)](./CHANGELOG.md)
**batsched** is a set of [Batsim]-compatible algorithms implemented in C++.
## Install
### For [Nix] users
``` bash
# Up-to-date version
nix-env -iA batsched_dev -f 'https://github.com/oar-team/kapack/archive/master.tar.gz'
# Latest release
nix-env -iA batsched -f 'https://github.com/oar-team/kapack/archive/master.tar.gz'
```
### Manually
``` bash
git clone https://framagit.org/batsim/batsched.git
mkdir -p batsched/build
cd batsched/build
cmake ..
make
make install
```
Up-to-date dependencies and versions are fully defined in [batsched's CI nix recipe](./default.nix).
Here is a quick (and probably outdated) list:
- decent clang/gcc and cmake
- zmq (C and C++)
- redox (hiredis + libev)
- [loguru]
- [intervalset]
- decent boost, gmp, rapidjson, openssl...
[Batsim]: https://framagit.org/batsim/batsim/
[intervalset]: https://framagit.org/batsim/intervalset
[loguru]: https://github.com/emilk/loguru
[Nix]: https://nixos.org/nix/
This directory is essentially a nix repository with some scripts.
# Packages overview
## batsched_local
This is the current version of batsched (built from current file hierarchy).
## batsim_pinned
This is the current *reference* Batsim version for batsched.
batsched should always work with this version.
## batsim_dev
This is the up-to-date Batsim version.
batsched should work with this version.
## test_deps_(pinned|dev)
The list of packages needed to run tests.
This is meant to be used as a shell, not meant to be installed.
## test_(pinned|dev)
A shell used to run tests. Essentially batsim_local + test_deps.
Not meant to be installed either.
# Useful commands
In all the following examples, the current directory is expected to be
batsched's root.
## Building packages
This can be done via `nix-build`. Result will be in `./result/`.
Some examples:
``` bash
nix-build ./ci -A batsched_local
nix-build ./ci -A batsim_pinned
```
## Install packages
This is done via `nix-env`:
``` bash
nix-env -f ./ci -iA batsched_local
nix-env -f ./ci -iA batsim_dev
```
To uninstall them, use `nix-env --uninstall`.
## Get into a shell to build packages
`nix-shell` is your friend here. Example:
``` bash
nix-shell ./ci -A batsched_local
# your shell now has all batsched's build dependencies!
# you can freely build the project (cmake, make...)
```
## Run the tests
This is essentially "run the test script in the desired environment".
``` bash
# test current batsched with batsim_pinned:
nix-shell ./ci -A test_pinned --command './ci/run-tests.bash'
# or test with batsim_dev:
nix-shell ./ci -A test_dev --command './ci/run-tests.bash'
```
#!/usr/bin/env nix-shell
#! nix-shell . -i bash -A test_deps_pinned
set -eu
echo "Prepare directories"
rm -rf ./cover
mkdir -p ./cover/tmp
cd ./cover/tmp
echo "Call gcov"
gcov_files=$(find ../../build -name '*.gcda')
for gcov_file in ${gcov_files[@]}; do
gcov ${gcov_file} 1>/dev/null 2>&1
done
echo "Only keep interesting files"
interesting_sources=$(find ../../src -name '*.?pp' | sort | grep -v 'pempek_assert\|taywee_args')
set +e
for interesting_source in ${interesting_sources[@]}; do
interesting_file="./$(basename ${interesting_source}).gcov"
cp -f ${interesting_file} ../ 2>/dev/null
done
set -e
cd ../..
rm -rf ./cover/tmp
echo "Run gcovr analysis (human-readable report)"
gcovr -gk -o ./cover/summary.txt
cat ./cover/summary.txt
echo "Run gcovr analysis (html report)"
rm -rf ./cover/html
mkdir -p ./cover/html
gcovr -gk --html-details -o ./cover/html/index.html
exit 0
#!/usr/bin/env nix-shell
#! nix-shell . -i bash -A batsched_local
set -eux
# Start from a clean build directory
rm -rf ./build
mkdir -p ./build
# Usual cmake build stuff
cd ./build
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-Denable_warnings=ON \
-Dtreat_warnings_as_errors=OFF \
-Ddo_coverage=ON
make -j $(nproc)
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/18.03.tar.gz") {};
kapack = import
( fetchTarball "https://github.com/oar-team/kapack/archive/master.tar.gz") {};
in
let
callPackage = pkgs.lib.callPackageWith (pkgs // pkgs.xlibs // self // kapack);
self = rec {
inherit pkgs kapack;
# Redefine some packages for clarity's sake
batexpe = kapack.batexpe;
batsim_pinned = (kapack.batsim.override {simgrid = kapack.simgrid_dev_working; }).overrideAttrs (attrs: rec {
name = "batsim-${version}";
version = "3.0.0-pinned";
src = pkgs.fetchgit {
url = "https://framagit.org/batsim/batsim.git";
rev = "12db5085210ac24d82657b21fafe0ca198dcf48d";
sha256 = "07b9npm5qvrzanp14rwp743dxsh7dwpvpywmlpxla5j4kxk665hc";
};
});
batsim_dev = (kapack.batsim.override {simgrid = kapack.simgrid_dev_working; }).overrideAttrs (attrs: rec {
nativeBuildInputs = attrs.nativeBuildInputs ++ [kapack.intervalset];
name = "batsim-${version}";
version = "3.1.0-dev";
src = fetchTarball "https://gitlab.inria.fr/batsim/batsim/repository/master/archive.tar.gz";
});
pytest = pkgs.python36Packages.pytest;
gcovr = kapack.gcovr;
# Packages defined in this tree
batsched_local = callPackage ./local.nix {};
test_deps_pinned = callPackage ./test-deps.nix {
batsim = batsim_pinned;
};
test_deps_dev = callPackage ./test-deps.nix {
batsim = batsim_dev;
};
# Packages meant to be used as shells
test_pinned = callPackage ./test-env.nix {
batsched = batsched_local;
test_deps = test_deps_pinned;
};
test_dev = callPackage ./test-env.nix {
batsched = batsched_local;
test_deps = test_deps_dev;
};
};
in
self
{ stdenv, batsched_dev }:
(batsched_dev.override {}).overrideAttrs (attrs: rec {
name = "batsched-1.4.0-nix-ci";
src = stdenv.lib.sourceByRegex ../. [
"^src$"
"^src/algo$"
"^src/external$"
".*\.cpp$" ".*\.hpp$"
"^cmake$"
"^cmake/Modules$"
".*\.cmake"
".*\.cmake.in"
"^CMakeLists\.txt$"
];
enableParallelBuilding = true;
doCheck = false;
preConfigure = ''
# Always start from a clean build directory
rm -rf ./build
'';
})
#!/usr/bin/env nix-shell
#! nix-shell . -i bash -A test_deps_dev
if [ "$#" -ne 1 ]; then
echo 'usage: pin-batsim.bash BATSIM-REV'
exit 1
fi
rev=$1
nix-prefetch-git \
--url https://framagit.org/batsim/batsim.git \
--rev ${rev} \
> batsim-pinned.json
#!/usr/bin/env nix-shell
#! nix-shell . -i bash -A test_deps_pinned
set -eu
initial_dir=$(realpath .)
# Run a redis server if needed
redis_launched_here=0
r=$(ps faux | grep redis-server | grep -v grep | wc -l)
if [ $r -eq 0 ]
then
echo "Running a Redis server..."
redis-server>/dev/null &
redis_launched_here=1
while ! nc -z localhost 6379; do
sleep 1
done
fi
# Add built batsched in PATH
export PATH=$(realpath ./build):${PATH}
# Set TEST_ROOT so simulation input files can be found
export TEST_ROOT=$(realpath ./test)
# Print which versions are used
echo "batsched realpath: $(realpath $(which batsched))"
echo "batsim realpath: $(realpath $(which batsim))"
echo "robin realpath: $(realpath $(which robin))"
# Execute the tests (TODO: clean tests)
cd test
pytest
failed=$?
# Stop the redis server if it has been launched by this script
if [ $redis_launched_here -eq 1 ]
then
echo "Stopping the Redis server..."
killall redis-server
fi
cd ${initial_dir}
exit ${failed}
{ stdenv, batsim, batexpe,
which, redis, procps, psmisc, pytest, gcovr,
nix-prefetch-git
}:
stdenv.mkDerivation rec {
name = "batsched-test-deps";
# This package is not meant to be built
unpackPhase = "true";
installPhase = "true";
propagatedBuildInputs = [ batsim batexpe
which redis procps psmisc pytest gcovr
nix-prefetch-git
];
}
{ stdenv, batsched, test_deps }:
stdenv.mkDerivation rec {
name = "batsched-test-env";
# This package is not meant to be built
unpackPhase = "true";
installPhase = "true";
propagatedBuildInputs = [ batsched test_deps ];
}
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix
set -eu
# Build up-to-date batsched_dev package, push it on binary cache
nix-build https://github.com/oar-team/kapack/archive/master.tar.gz -A batsched_dev | cachix push batsim
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix
set -eu
# (re)build up-to-date CI batsched package + deps, push them on binary cache
nix-build ./ci -A test_pinned | cachix push batsim
nix-build ./ci -A test_dev | cachix push batsim
# Find the intervalset library (https://framagit.org/batsim/intervalset)
#
# Sets the usual variables expected for find_package scripts:
#
# INTERVALSET_INCLUDE_DIR - header location
# INTERVALSET_LIBRARIES - library to link against
# INTERVALSET_FOUND - true if intervalset was found.
find_path(INTERVALSET_INCLUDE_DIR intervalset.hpp)
find_library(INTERVALSET_LIBRARY intervalset)
# Support the REQUIRED and QUIET arguments, and set INTERVALSET_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(intervalset DEFAULT_MSG INTERVALSET_LIBRARY
INTERVALSET_INCLUDE_DIR)
mark_as_advanced(INTERVALSET_LIBRARY INTERVALSET_INCLUDE_DIR)
# Find the loguru library (https://github.com/emilk/loguru)
#
# Sets the usual variables expected for find_package scripts:
#
# LOGURU_INCLUDE_DIR - header location
# LOGURU_LIBRARIES - libraries needed to use loguru
# LOGURU_FOUND - true if loguru was found.
find_path(LOGURU_INCLUDE_DIR loguru.hpp)
find_library(LOGURU_LIBRARIES NAMES loguru libloguru)
# Support the REQUIRED and QUIET arguments, and set LOGURU_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(loguru DEFAULT_MSG LOGURU_INCLUDE_DIR LOGURU_LIBRARIES)
mark_as_advanced(LOGURU_INCLUDE_DIR LOGURU_LIBRARIES)
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/18.03.tar.gz") {};
kapack = import
( fetchTarball "https://github.com/oar-team/kapack/archive/master.tar.gz")
{ inherit pkgs; };
in
with kapack;
with pkgs;
(batsched_dev.override {}).overrideAttrs (attrs: rec {
name = "batsched-1.4.0-nix-local";
src = ../.;
enableParallelBuilding = true;
doCheck = false;
})
......@@ -8,6 +8,8 @@
#include <stdexcept>
#include <loguru.hpp>
Crasher::CrashType Crasher::crash_type_from_string(const std::string &str)
{
if (str == "segmentation_fault") return CrashType::SEGMENTATION_FAULT;
......@@ -85,11 +87,12 @@ Crasher::Crasher(Workload *workload,
_crash_type = crash_type_from_string(crash_type_str);
}
printf("crash_on_start: %d\n", _crash_on_start);
printf("crash_on_end: %d\n", _crash_on_end);
printf("crash_on_decision_call: %d\n", _crash_on_decision_call);
printf("crash_on_decision_call_number: %d\n", _crash_on_decision_call_number);
printf("crash_type: %s\n", crash_type_to_string(_crash_type).c_str());
LOG_SCOPE_FUNCTION(INFO);
LOG_F(INFO, "crash_on_start: %d", _crash_on_start);
LOG_F(INFO, "crash_on_end: %d", _crash_on_end);
LOG_F(INFO, "crash_on_decision_call: %d", _crash_on_decision_call);
LOG_F(INFO, "crash_on_decision_call_number: %d", _crash_on_decision_call_number);
LOG_F(INFO, "crash_type: %s", crash_type_to_string(_crash_type).c_str());
}
Crasher::~Crasher()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment