A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ahem. You mean I need to actually compile with MC after moving files?
[simgrid.git]
/
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
b8e4bec
..
e38b70a
100644
(file)
--- a/
teshsuite/mc/dwarf-expression/dwarf-expression.cpp
+++ b/
teshsuite/mc/dwarf-expression/dwarf-expression.cpp
@@
-1,5
+1,4
@@
-/* Copyright (c) 2014-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-8,16
+7,19
@@
#undef NDEBUG
#endif
#undef NDEBUG
#endif
+#include "src/mc/mc_private.hpp"
+
+#include "src/mc/inspect/ObjectInformation.hpp"
+#include "src/mc/inspect/Type.hpp"
+#include "src/mc/inspect/Variable.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
+
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <cstring>
+#include <random>
-#include "src/mc/mc_private.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::RemoteClient* process;
static simgrid::mc::RemoteClient* process;
@@
-33,11
+35,9
@@
uintptr_t eval_binary_operation(
ops[2].atom = op;
simgrid::dwarf::ExpressionStack stack;
ops[2].atom = op;
simgrid::dwarf::ExpressionStack stack;
-
try {
simgrid::dwarf::execute(ops, 3, state, stack);
try {
simgrid::dwarf::execute(ops, 3, state, stack);
- }
- catch(std::runtime_error& e) {
+ } catch (const simgrid::dwarf::evaluation_error&) {
fprintf(stderr,"Expression evaluation error");
}
fprintf(stderr,"Expression evaluation error");
}
@@
-51,17
+51,20
@@
void basic_test(simgrid::dwarf::ExpressionContext const& state) {
Dwarf_Op ops[60];
Dwarf_Op ops[60];
- uintptr_t a = r
and
();
- uintptr_t b = r
and
();
+ uintptr_t a = r
nd_engine
();
+ uintptr_t b = r
nd_engine
();
simgrid::dwarf::ExpressionStack stack;
simgrid::dwarf::ExpressionStack stack;
+ bool caught_ex = false;
try {
ops[0].atom = DW_OP_drop;
simgrid::dwarf::execute(ops, 1, state, stack);
try {
ops[0].atom = DW_OP_drop;
simgrid::dwarf::execute(ops, 1, state, stack);
- fprintf(stderr,"Exception expected");
+ } catch (const simgrid::dwarf::evaluation_error&) {
+ 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);
ops[0].atom = DW_OP_lit21;
simgrid::dwarf::execute(ops, 1, state, stack);
@@
-119,8
+122,7
@@
void basic_test(simgrid::dwarf::ExpressionContext const& state) {
assert(stack.top() == a);
assert(stack.top(1) == b);
assert(stack.top() == a);
assert(stack.top(1) == b);
- }
- catch(std::runtime_error& e) {
+ } catch (const simgrid::dwarf::evaluation_error&) {
fprintf(stderr,"Expression evaluation error");
}
}
fprintf(stderr,"Expression evaluation error");
}
}
@@
-142,8
+144,7
@@
void test_deref(simgrid::dwarf::ExpressionContext const& state) {
assert(stack.size() == 1);
assert(stack.top() == foo);
assert(stack.size() == 1);
assert(stack.top() == foo);
- }
- catch(std::runtime_error& e) {
+ } catch (const simgrid::dwarf::evaluation_error&) {
fprintf(stderr,"Expression evaluation error");
}
}
fprintf(stderr,"Expression evaluation error");
}
}
@@
-158,26
+159,26
@@
int main(int argc, char** argv) {
basic_test(state);
for(int i=0; i!=100; ++i) {
basic_test(state);
for(int i=0; i!=100; ++i) {
- uintptr_t a = r
and
();
- uintptr_t b = r
and
();
+ uintptr_t a = r
nd_engine
();
+ uintptr_t b = r
nd_engine
();
assert(eval_binary_operation(state, DW_OP_plus, a, b) == (a + b));
}
for(int i=0; i!=100; ++i) {
assert(eval_binary_operation(state, DW_OP_plus, a, b) == (a + b));
}
for(int i=0; i!=100; ++i) {
- uintptr_t a = r
and
();
- uintptr_t b = r
and
();
+ uintptr_t a = r
nd_engine
();
+ uintptr_t b = r
nd_engine
();
assert(eval_binary_operation(state, DW_OP_or, a, b) == (a | b));
}
for(int i=0; i!=100; ++i) {
assert(eval_binary_operation(state, DW_OP_or, a, b) == (a | b));
}
for(int i=0; i!=100; ++i) {
- uintptr_t a = r
and
();
- uintptr_t b = r
and
();
+ uintptr_t a = r
nd_engine
();
+ uintptr_t b = r
nd_engine
();
assert(eval_binary_operation(state, DW_OP_and, a, b) == (a & b));
}
for(int i=0; i!=100; ++i) {
assert(eval_binary_operation(state, DW_OP_and, a, b) == (a & b));
}
for(int i=0; i!=100; ++i) {
- uintptr_t a = r
and
();
- uintptr_t b = r
and
();
+ uintptr_t a = r
nd_engine
();
+ uintptr_t b = r
nd_engine
();
assert(eval_binary_operation(state, DW_OP_xor, a, b) == (a ^ b));
}
assert(eval_binary_operation(state, DW_OP_xor, a, b) == (a ^ b));
}