X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dccf1b41e9c7b5a696f01abceaa2779fe65f154f..7233106ddd4d22acaefbba0e6167350caaafe65d:/teshsuite/mc/dwarf-expression/dwarf-expression.cpp diff --git a/teshsuite/mc/dwarf-expression/dwarf-expression.cpp b/teshsuite/mc/dwarf-expression/dwarf-expression.cpp index f059b2c058..a3c143ffe3 100644 --- a/teshsuite/mc/dwarf-expression/dwarf-expression.cpp +++ b/teshsuite/mc/dwarf-expression/dwarf-expression.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015. The SimGrid Team. +/* Copyright (c) 2014-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -8,18 +8,21 @@ #undef NDEBUG #endif -#include -#include -#include +#include +#include +#include +#include -#include "src/mc/mc_private.h" +#include "src/mc/mc_private.hpp" -#include "src/mc/Process.hpp" -#include "src/mc/Type.hpp" #include "src/mc/ObjectInformation.hpp" +#include "src/mc/Type.hpp" #include "src/mc/Variable.hpp" +#include "src/mc/remote/RemoteClient.hpp" + +static std::default_random_engine rnd_engine; -static simgrid::mc::Process* process; +static simgrid::mc::RemoteClient* process; static uintptr_t eval_binary_operation( @@ -51,17 +54,20 @@ void basic_test(simgrid::dwarf::ExpressionContext const& state) { Dwarf_Op ops[60]; - uintptr_t a = rand(); - uintptr_t b = rand(); + uintptr_t a = rnd_engine(); + uintptr_t b = rnd_engine(); simgrid::dwarf::ExpressionStack stack; + bool caught_ex = false; try { ops[0].atom = DW_OP_drop; simgrid::dwarf::execute(ops, 1, state, stack); - fprintf(stderr,"Exception expected"); + } catch (simgrid::dwarf::evaluation_error& e) { + caught_ex = true; } - catch(simgrid::dwarf::evaluation_error& e) {} + if (not caught_ex) + fprintf(stderr, "Exception expected"); ops[0].atom = DW_OP_lit21; simgrid::dwarf::execute(ops, 1, state, stack); @@ -149,7 +155,7 @@ void test_deref(simgrid::dwarf::ExpressionContext const& state) { } int main(int argc, char** argv) { - process = new simgrid::mc::Process(getpid(), -1); + process = new simgrid::mc::RemoteClient(getpid(), -1); process->init(); simgrid::dwarf::ExpressionContext state; @@ -158,26 +164,26 @@ int main(int argc, char** argv) { basic_test(state); for(int i=0; i!=100; ++i) { - uintptr_t a = rand(); - uintptr_t b = rand(); + uintptr_t a = rnd_engine(); + uintptr_t b = rnd_engine(); assert(eval_binary_operation(state, DW_OP_plus, a, b) == (a + b)); } for(int i=0; i!=100; ++i) { - uintptr_t a = rand(); - uintptr_t b = rand(); + uintptr_t a = rnd_engine(); + uintptr_t b = rnd_engine(); assert(eval_binary_operation(state, DW_OP_or, a, b) == (a | b)); } for(int i=0; i!=100; ++i) { - uintptr_t a = rand(); - uintptr_t b = rand(); + uintptr_t a = rnd_engine(); + uintptr_t b = rnd_engine(); assert(eval_binary_operation(state, DW_OP_and, a, b) == (a & b)); } for(int i=0; i!=100; ++i) { - uintptr_t a = rand(); - uintptr_t b = rand(); + uintptr_t a = rnd_engine(); + uintptr_t b = rnd_engine(); assert(eval_binary_operation(state, DW_OP_xor, a, b) == (a ^ b)); }