Commit c7e4013c authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis
Browse files

First try to see if travis is working

parent 305d9da1
language: cpp
os:
- linux
sudo: required
dist: trusty
compiler:
- gcc
- clang
sudo: required
install: sudo apt-get update -qq && sudo apt-get install -qq libboost-all-dev libboost-test-dev libeigen3-dev libtbb-dev
addons:
apt:
packages:
- libboost1.55-all-dev
- libeigen3-dev
- libtbb-dev
- libgtest-dev
- autoconf
- automake
- libtool
- libgoogle-glog-dev
- libgflags-dev
install:
# Change this to your needs
script:
./waf configure && ./waf
\ No newline at end of file
script:
- sudo cd /usr/src/gtest
- sudo mkdir build && cd build
- sudo cmake ..
- sudo make
- sudo cp *.a /usr/lib
- cd
- git clone git@github.com:beniz/libcmaes.git
- cd libcmaes
- ./autogen.sh
- ./configure
- make
- sudo make install
- cd ..
- cd resibots/limbo
- ./waf configure
- ./waf --tests --alltests -v
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE nlopt_test
#define BOOST_TEST_MODULE test_cmaes
#include <boost/test/unit_test.hpp>
......@@ -20,16 +20,28 @@ opt::eval_t fsphere(const Eigen::VectorXd& params, bool g)
BOOST_AUTO_TEST_CASE(test_cmaes_unbounded)
{
Eigen::VectorXd g = limbo::opt::Cmaes<Params>()(fsphere, Eigen::VectorXd::Zero(2), false);
size_t N = 10;
size_t errors = 0;
for (size_t i = 0; i < N; i++) {
Eigen::VectorXd g = limbo::opt::Cmaes<Params>()(fsphere, Eigen::VectorXd::Zero(2), false);
BOOST_CHECK_SMALL(g(0), 0.00000001);
BOOST_CHECK_SMALL(g(1), 0.00000001);
if (std::abs(g(0)) > 0.00000001 || std::abs(g(1)) > 0.00000001)
errors++;
}
BOOST_CHECK((double(errors) / double(N)) < 0.4);
}
BOOST_AUTO_TEST_CASE(test_cmaes_bounded)
{
Eigen::VectorXd g = limbo::opt::Cmaes<Params>()(fsphere, Eigen::VectorXd::Zero(2), true);
size_t N = 10;
size_t errors = 0;
for (size_t i = 0; i < N; i++) {
Eigen::VectorXd g = limbo::opt::Cmaes<Params>()(fsphere, Eigen::VectorXd::Zero(2), true);
if (std::abs(g(0)) > 0.00000001 || std::abs(g(1)) > 0.00000001)
errors++;
}
BOOST_CHECK_SMALL(g(0), 0.00000001);
BOOST_CHECK_SMALL(g(1), 0.00000001);
BOOST_CHECK((double(errors) / double(N)) < 0.3);
}
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE gp
#define BOOST_TEST_MODULE test_gp
#include <boost/test/unit_test.hpp>
......
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE init_functions
#define BOOST_TEST_MODULE test_init_functions
#include <boost/test/unit_test.hpp>
......@@ -79,8 +79,8 @@ BOOST_AUTO_TEST_CASE(no_init)
Opt_t opt;
opt.optimize(fit_eval());
BOOST_CHECK(opt.observations().size() == 1);
BOOST_CHECK(opt.samples().size() == 1);
BOOST_CHECK(opt.observations().size() == 0);
BOOST_CHECK(opt.samples().size() == 0);
}
BOOST_AUTO_TEST_CASE(random_sampling)
......
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE macros
#define BOOST_TEST_MODULE test_macros
#include <cstring>
......
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE nlopt_test
#define BOOST_TEST_MODULE test_nlopt
#include <boost/test/unit_test.hpp>
......
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE optimizers
#define BOOST_TEST_MODULE test_optimizers
#include <boost/test/unit_test.hpp>
......
......@@ -4,7 +4,8 @@
def build(bld):
bld.recurse('examples')
bld.recurse('tests')
if bld.options.tests:
bld.recurse('tests')
bld.recurse('benchmarks')
bld.stlib(source=' \
......
......@@ -14,6 +14,7 @@ import os
import subprocess
import limbo
from waflib.Build import BuildContext
from waflib.Tools import waf_unit_test
import inspect
......@@ -34,6 +35,8 @@ def options(opt):
opt.add_option('--qsub', type='string', help='config file (json) to submit to torque', dest='qsub')
opt.add_option('--oar', type='string', help='config file (json) to submit to oar', dest='oar')
opt.add_option('--experimental', action='store_true', help='specify to compile the experimental examples', dest='experimental')
# tests
opt.add_option('--tests', action='store_true', help='compile tests or not', dest='tests')
opt.load('xcode')
for i in glob.glob('exp/*'):
if os.path.isdir(i):
......@@ -88,14 +91,24 @@ def configure(conf):
print 'configuring for exp: ' + i
conf.recurse('exp/' + i)
def summary(bld):
lst = getattr(bld, 'utest_results', [])
total = 0
tfail = 0
if lst:
total = len(lst)
tfail = len([x for x in lst if x[1]])
waf_unit_test.summary(bld)
if tfail > 0:
bld.fatal("Build failed, because some tests failed!")
def build(bld):
bld.recurse('src/')
if bld.options.exp:
for i in bld.options.exp.split(','):
print 'Building exp: ' + i
bld.recurse('exp/' + i)
from waflib.Tools import waf_unit_test
bld.add_post_fun(waf_unit_test.summary)
bld.add_post_fun(summary)
def build_extensive_tests(ctx):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment