Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cunit: C++-ify s_xbt_test_unit.
[simgrid.git] / src / xbt / cunit.cpp
1 /* cunit - A little C Unit facility                                         */
2
3 /* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 /* This is partially inspirated from the OSSP ts (Test Suite Library)       */
9 /* At some point we should use https://github.com/google/googletest instead */
10
11 #include "src/internal_config.h"
12 #include <algorithm>
13 #include <cstdio>
14 #include <string>
15 #include <vector>
16
17 #include <xbt/cunit.h>
18 #include <xbt/ex.hpp>
19 #include <xbt/string.hpp>
20
21 #include "xbt/sysdep.h"         /* bvprintf */
22 #include "xbt/dynar.h"
23
24 #define STRLEN 1024
25
26 /* collection of all suites */
27 static xbt_dynar_t _xbt_test_suites = nullptr;
28 /* global statistics */
29 static int _xbt_test_nb_tests = 0;
30 static int _xbt_test_test_failed = 0;
31 static int _xbt_test_test_ignore = 0;
32 static int _xbt_test_test_expect = 0;
33
34 static int _xbt_test_nb_units = 0;
35 static int _xbt_test_unit_failed = 0;
36 static int _xbt_test_unit_ignore = 0;
37 static int _xbt_test_unit_disabled = 0;
38
39 static int _xbt_test_nb_suites = 0;
40 static int _xbt_test_suite_failed = 0;
41 static int _xbt_test_suite_ignore = 0;
42 static int _xbt_test_suite_disabled = 0;
43
44 /* Context */
45 xbt_test_unit_t _xbt_test_current_unit = nullptr;
46
47 /* test suite test log */
48 class s_xbt_test_log {
49 public:
50   s_xbt_test_log(std::string text, std::string file, int line)
51       : text_(std::move(text)), file_(std::move(file)), line_(line)
52   {
53   }
54   void dump() const;
55
56   std::string text_;
57   std::string file_;
58   int line_;
59 };
60
61 void s_xbt_test_log::dump() const
62 {
63   fprintf(stderr, "      log %p(%s:%d)=%s\n", this, this->file_.c_str(), this->line_, this->text_.c_str());
64 }
65
66 /* test suite test check */
67 class s_xbt_test_test {
68 public:
69   s_xbt_test_test(std::string title, std::string file, int line)
70       : title_(std::move(title)), file_(std::move(file)), line_(line)
71   {
72   }
73   void dump() const;
74
75   std::string title_;
76   bool failed_           = false;
77   bool expected_failure_ = false;
78   bool ignored_          = false;
79   std::string file_;
80   int line_;
81   std::vector<s_xbt_test_log> logs_;
82 };
83
84 void s_xbt_test_test::dump() const
85 {
86   fprintf(stderr, "    test %p(%s:%d)=%s (%s)\n", this, this->file_.c_str(), this->line_, this->title_.c_str(),
87           this->failed_ ? "failed" : "not failed");
88   for (s_xbt_test_log const& log : this->logs_)
89     log.dump();
90 }
91
92 /* test suite test unit */
93 class s_xbt_test_unit {
94 public:
95   s_xbt_test_unit(std::string name, std::string title, ts_test_cb_t func)
96       : name_(std::move(name)), title_(std::move(title)), func_(func)
97   {
98   }
99   void dump() const;
100
101   std::string name_;
102   std::string title_;
103   ts_test_cb_t func_;
104   std::vector<s_xbt_test_test> tests_;
105
106   bool enabled_    = true;
107   int nb_tests_    = 0;
108   int test_failed_ = 0;
109   int test_ignore_ = 0;
110   int test_expect_ = 0;
111 };
112
113 void s_xbt_test_unit::dump() const
114 {
115   fprintf(stderr, "  UNIT %s: %s (%s)\n", this->name_.c_str(), this->title_.c_str(),
116           (this->enabled_ ? "enabled" : "disabled"));
117   if (this->enabled_) {
118     for (s_xbt_test_test const& test : this->tests_)
119       test.dump();
120   }
121 }
122
123 /* test suite */
124 struct s_xbt_test_suite {
125   int enabled;
126   const char *name;
127   char *title;
128   std::vector<s_xbt_test_unit> units;
129
130   int nb_tests;
131   int nb_units;
132   int test_failed;
133   int test_ignore;
134   int test_expect;
135   int unit_failed;
136   int unit_ignore;
137   int unit_disabled;
138 };
139
140 /* destroy test suite */
141 static void xbt_test_suite_free(void *s)
142 {
143   xbt_test_suite_t suite = *(xbt_test_suite_t *) s;
144
145   if (suite == nullptr)
146     return;
147   xbt_free(suite->title);
148   delete suite;
149 }
150
151 /** @brief retrieve a testsuite from name, or create a new one */
152 xbt_test_suite_t xbt_test_suite_by_name(const char *name, const char *fmt, ...)
153 {
154   if (_xbt_test_suites == nullptr) {
155     _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t), xbt_test_suite_free);
156   } else {
157     xbt_test_suite_t suite;
158     unsigned int it_suite;
159     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
160       if (not strcmp(suite->name, name))
161         return suite;
162   }
163
164   xbt_test_suite_t suite = new s_xbt_test_suite{};
165   va_list ap;
166   va_start(ap, fmt);
167   suite->title = bvprintf(fmt, ap);
168   va_end(ap);
169   suite->name    = name;
170   suite->enabled = 1;
171
172   xbt_dynar_push(_xbt_test_suites, &suite);
173
174   return suite;
175 }
176
177 static void xbt_test_suite_dump(xbt_test_suite_t suite)
178 {
179   if (suite) {
180     fprintf(stderr, "TESTSUITE %s: %s (%s)\n", suite->name, suite->title, suite->enabled ? "enabled" : "disabled");
181     if (suite->enabled) {
182       for (s_xbt_test_unit const& unit : suite->units)
183         unit.dump();
184     }
185   } else {
186     fprintf(stderr, "TESTSUITE IS NULL!\n");
187   }
188 }
189
190 /* add test case to test suite */
191 void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t func, const char *fmt, ...)
192 {
193   xbt_assert(suite);
194   xbt_assert(func);
195   xbt_assert(fmt);
196
197   va_list ap;
198   va_start(ap, fmt);
199   suite->units.emplace_back(name, simgrid::xbt::string_vprintf(fmt, ap), func);
200   va_end(ap);
201 }
202
203 /* run test one suite */
204 static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
205 {
206   if (suite == nullptr)
207     return 0;
208
209   /* suite title pretty-printing */
210   char suite_title[81];
211   int suite_len = strlen(suite->title);
212
213   xbt_assert(suite_len < 68, "suite title \"%s\" too long (%d should be less than 68", suite->title, suite_len);
214
215   suite_title[0] = ' ';
216   for (int i = 1; i < 79; i++)
217     suite_title[i] = '=';
218   suite_title[79]  = '\n';
219   suite_title[80]  = '\0';
220
221   snprintf(suite_title + 40 - (suite_len + 4) / 2, 81 - (40 - (suite_len + 4) / 2), "[ %s ]", suite->title);
222   suite_title[40 + (suite_len + 5) / 2] = '=';
223   if (not suite->enabled)
224     snprintf(suite_title + 70, 11, " DISABLED ");
225   fprintf(stderr, "\n%s\n", suite_title);
226
227   if (suite->enabled) {
228     /* iterate through all tests */
229     for (s_xbt_test_unit& unit : suite->units) {
230       /* init unit case counters */
231       unit.nb_tests_    = 0;
232       unit.test_ignore_ = 0;
233       unit.test_failed_ = 0;
234       unit.test_expect_ = 0;
235
236       /* display unit title */
237       char* cp = bprintf(" Unit: %s ......................................"
238                          "......................................",
239                          unit.title_.c_str());
240       cp[70] = '\0';
241       fprintf(stderr, "%s", cp);
242       free(cp);
243
244       /* run the test case function */
245       _xbt_test_current_unit = &unit;
246       if (unit.enabled_)
247         unit.func_();
248
249       /* iterate through all performed tests to determine status */
250       for (s_xbt_test_test const& test : unit.tests_) {
251         if (test.ignored_) {
252           unit.test_ignore_++;
253         } else {
254           unit.nb_tests_++;
255
256           if ((test.failed_ && not test.expected_failure_) || (not test.failed_ && test.expected_failure_))
257             unit.test_failed_++;
258           if (test.expected_failure_)
259             unit.test_expect_++;
260         }
261       }
262       /* Display whether this unit went well */
263       if (unit.test_failed_ > 0 || unit.test_expect_ || (verbosity && unit.nb_tests_ > 0)) {
264         /* some tests failed (or were supposed to), so do detailed reporting of test case */
265         if (unit.test_failed_ > 0) {
266           fprintf(stderr, ".. failed\n");
267         } else if (unit.nb_tests_) {
268           fprintf(stderr, "...... ok\n");       /* successful, but show about expected */
269         } else {
270           fprintf(stderr, ".... skip\n");       /* shouldn't happen, but I'm a bit lost with this logic */
271         }
272         for (s_xbt_test_test const& test : unit.tests_) {
273           std::string file = test.file_;
274           int line         = test.line_;
275           const char* resname;
276           if (test.ignored_)
277             resname = " SKIP";
278           else if (test.expected_failure_) {
279             if (test.failed_)
280               resname = "EFAIL";
281             else
282               resname = "EPASS";
283           } else {
284             if (test.failed_)
285               resname = " FAIL";
286             else
287               resname = " PASS";
288           }
289           fprintf(stderr, "      %s: %s [%s:%d]\n", resname, test.title_.c_str(), file.c_str(), line);
290
291           if ((test.expected_failure_ && not test.failed_) || (not test.expected_failure_ && test.failed_)) {
292             for (s_xbt_test_log const& log : test.logs_) {
293               file = (log.file_.empty() ? file : log.file_);
294               line = (log.line_ == 0 ? line : log.line_);
295               fprintf(stderr, "             %s:%d: %s\n", file.c_str(), line, log.text_.c_str());
296             }
297           }
298         }
299         fprintf(stderr, "    Summary: %d of %d tests failed", unit.test_failed_, unit.nb_tests_);
300         if (unit.test_ignore_) {
301           fprintf(stderr, " (%d tests ignored)\n", unit.test_ignore_);
302         } else {
303           fprintf(stderr, "\n");
304         }
305       } else if (not unit.enabled_) {
306         fprintf(stderr, " disabled\n"); /* no test were run */
307       } else if (unit.nb_tests_) {
308         fprintf(stderr, "...... ok\n"); /* successful */
309       } else {
310         fprintf(stderr, ".... skip\n"); /* no test were run */
311       }
312
313       /* Accumulate test counts into the suite */
314       suite->nb_tests += unit.nb_tests_;
315       suite->test_failed += unit.test_failed_;
316       suite->test_ignore += unit.test_ignore_;
317       suite->test_expect += unit.test_expect_;
318
319       _xbt_test_nb_tests += unit.nb_tests_;
320       _xbt_test_test_failed += unit.test_failed_;
321       _xbt_test_test_ignore += unit.test_ignore_;
322       _xbt_test_test_expect += unit.test_expect_;
323
324       /* What's the conclusion of this test anyway? */
325       if (unit.nb_tests_) {
326         suite->nb_units++;
327         if (unit.test_failed_)
328           suite->unit_failed++;
329       } else if (not unit.enabled_) {
330         suite->unit_disabled++;
331       } else {
332         suite->unit_ignore++;
333       }
334     }
335   }
336   _xbt_test_nb_units += suite->nb_units;
337   _xbt_test_unit_failed += suite->unit_failed;
338   _xbt_test_unit_ignore += suite->unit_ignore;
339   _xbt_test_unit_disabled += suite->unit_disabled;
340
341   if (suite->nb_units) {
342     _xbt_test_nb_suites++;
343     if (suite->test_failed)
344       _xbt_test_suite_failed++;
345   } else if (not suite->enabled) {
346     _xbt_test_suite_disabled++;
347   } else {
348     _xbt_test_suite_ignore++;
349   }
350
351   /* print test suite summary */
352   if (suite->enabled) {
353     int first = 1; /* for result pretty printing */
354
355     fprintf(stderr," =====================================================================%s\n",
356             (suite->nb_units ? (suite->unit_failed ? "== FAILED" : "====== OK") :
357                                (suite->unit_disabled ? " DISABLED" : "==== SKIP")));
358     fprintf(stderr, " Summary: Units: %.0f%% ok (%d units: ", suite->nb_units
359             ? ((1 - (double) suite->unit_failed / (double) suite->nb_units) * 100.0) : 100.0, suite->nb_units);
360
361     if (suite->nb_units != suite->unit_failed) {
362       fprintf(stderr, "%s%d ok", (first ? "" : ", "), suite->nb_units - suite->unit_failed);
363       first = 0;
364     }
365     if (suite->unit_failed) {
366       fprintf(stderr, "%s%d failed", (first ? "" : ", "), suite->unit_failed);
367       first = 0;
368     }
369     if (suite->unit_ignore) {
370       fprintf(stderr, "%s%d ignored", (first ? "" : ", "), suite->unit_ignore);
371       first = 0;
372     }
373     if (suite->unit_disabled) {
374       fprintf(stderr, "%s%d disabled", (first ? "" : ", "), suite->unit_disabled);
375     }
376     fprintf(stderr, ")\n          Tests: %.0f%% ok (%d tests: ", suite->nb_tests
377             ? ((1 - (double) suite->test_failed / (double) suite->nb_tests) * 100.0) : 100.0, suite->nb_tests);
378
379     first = 1;
380     if (suite->nb_tests != suite->test_failed) {
381       fprintf(stderr, "%s%d ok", (first ? "" : ", "), suite->nb_tests - suite->test_failed);
382       first = 0;
383     }
384     if (suite->test_failed) {
385       fprintf(stderr, "%s%d failed", (first ? "" : ", "), suite->test_failed);
386       first = 0;
387     }
388     if (suite->test_ignore) {
389       fprintf(stderr, "%s%d ignored", (first ? "" : "; "), suite->test_ignore);
390       first = 0;
391     }
392     if (suite->test_expect) {
393       fprintf(stderr, "%s%d expected to fail", (first ? "" : "; "), suite->test_expect);
394     }
395     fprintf(stderr, ")\n");
396   }
397   return suite->unit_failed;
398 }
399
400 static void apply_selection(char *selection)
401 {
402   /* for the parsing */
403   char *sel = selection;
404   int done = 0;
405   char dir[STRLEN]; /* the directive */
406   /* iterators */
407   unsigned int it_suite;
408   xbt_test_suite_t suite;
409
410   char suitename[STRLEN];
411   char unitname[STRLEN];
412
413   if (not selection || selection[0] == '\0')
414     return;
415
416   /* First apply the selection */
417   while (not done) {
418     int enabling = 1;
419
420     char *p = strchr(sel, ',');
421     if (p) {
422       snprintf(dir, STRLEN, "%.*s", (int)(p - sel), sel);
423       sel = p + 1;
424     } else {
425       snprintf(dir, STRLEN, "%s", sel);
426       done = 1;
427     }
428
429     if (dir[0] == '-') {
430       enabling = 0;
431       memmove(dir, dir + 1, strlen(dir));
432     }
433     if (dir[0] == '+') {
434       enabling = 1;
435       memmove(dir, dir + 1, strlen(dir));
436     }
437
438     p = strchr(dir, ':');
439     if (p) {
440       snprintf(suitename, STRLEN, "%.*s", (int)(p - dir), dir);
441       snprintf(unitname, STRLEN, "%s", p + 1);
442     } else {
443       snprintf(suitename, STRLEN, "%s", dir);
444       unitname[0] = '\0';
445     }
446
447     /* Deal with the specific case of 'all' pseudo serie */
448     if (not strcmp("all", suitename)) {
449       xbt_assert(unitname[0] == '\0', "The 'all' pseudo-suite does not accept any unit specification\n");
450
451       xbt_dynar_foreach(_xbt_test_suites, it_suite, suite) {
452         for (s_xbt_test_unit& unit : suite->units) {
453           unit.enabled_ = enabling;
454         }
455         suite->enabled = enabling;
456       }
457     } else {
458       unsigned int it;
459       for (it = 0; it < xbt_dynar_length(_xbt_test_suites); it++) {
460         xbt_test_suite_t thissuite =
461             xbt_dynar_get_as(_xbt_test_suites, it, xbt_test_suite_t);
462         if (not strcmp(suitename, thissuite->name)) {
463           /* Do not disable the whole suite when we just want to disable a child */
464           if (enabling || (unitname[0] == '\0'))
465             thissuite->enabled = enabling;
466
467           if (unitname[0] == '\0') {
468             for (s_xbt_test_unit& unit : thissuite->units) {
469               unit.enabled_ = enabling;
470             }
471           } else {              /* act on one child only */
472             /* search relevant unit */
473             auto unit = std::find_if(begin(thissuite->units), end(thissuite->units),
474                                      [&unitname](s_xbt_test_unit const& unit) { return unit.name_ == unitname; });
475             if (unit == end(thissuite->units))
476               xbt_die("Suite '%s' has no unit of name '%s'. Cannot apply the selection\n", suitename, unitname);
477             unit->enabled_ = enabling;
478           }                     /* act on childs (either all or one) */
479
480           break;                /* found the relevant serie. We are happy */
481         }
482       }                         /* search relevant series */
483       xbt_assert(it != xbt_dynar_length(_xbt_test_suites),
484                  "No suite of name '%s' found. Cannot apply the selection\n", suitename);
485     }
486   }
487 }
488
489 void xbt_test_dump(char *selection)
490 {
491   apply_selection(selection);
492
493   if (_xbt_test_suites) {
494     unsigned int it_suite;
495     xbt_test_suite_t suite;
496
497     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
498         xbt_test_suite_dump(suite);
499   } else {
500     printf(" No suite defined.");
501   }
502 }
503
504 int xbt_test_run(char *selection, int verbosity)
505 {
506   apply_selection(selection);
507
508   if (_xbt_test_suites) {
509     unsigned int it_suite;
510     xbt_test_suite_t suite;
511     int first = 1;
512
513     /* Run all the suites */
514     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
515       xbt_test_suite_run(suite, verbosity);
516
517     /* Display some more statistics */
518     fprintf(stderr, "\n\n TOTAL: Suites: %.0f%% ok (%d suites: ",_xbt_test_nb_suites
519             ? ((1 - (double) _xbt_test_suite_failed / (double) _xbt_test_nb_suites) * 100.0)
520             : 100.0, _xbt_test_nb_suites);
521     if (_xbt_test_nb_suites != _xbt_test_suite_failed) {
522       fprintf(stderr, "%d ok", _xbt_test_nb_suites - _xbt_test_suite_failed);
523       first = 0;
524     }
525     if (_xbt_test_suite_failed) {
526       fprintf(stderr, "%s%d failed", (first ? "" : ", "), _xbt_test_suite_failed);
527       first = 0;
528     }
529
530     if (_xbt_test_suite_ignore) {
531       fprintf(stderr, "%s%d ignored", (first ? "" : ", "), _xbt_test_suite_ignore);
532     }
533     fprintf(stderr, ")\n        Units:  %.0f%% ok (%d units: ", _xbt_test_nb_units
534             ? ((1 - (double) _xbt_test_unit_failed / (double) _xbt_test_nb_units) * 100.0) : 100.0, _xbt_test_nb_units);
535     first = 1;
536     if (_xbt_test_nb_units != _xbt_test_unit_failed) {
537       fprintf(stderr, "%d ok", _xbt_test_nb_units - _xbt_test_unit_failed);
538       first = 0;
539     }
540     if (_xbt_test_unit_failed) {
541       fprintf(stderr, "%s%d failed", (first ? "" : ", "), _xbt_test_unit_failed);
542       first = 0;
543     }
544     if (_xbt_test_unit_ignore) {
545       fprintf(stderr, "%s%d ignored", (first ? "" : ", "), _xbt_test_unit_ignore);
546     }
547     fprintf(stderr, ")\n        Tests:  %.0f%% ok (%d tests: ", _xbt_test_nb_tests
548             ? ((1 - (double) _xbt_test_test_failed / (double) _xbt_test_nb_tests) * 100.0) : 100.0, _xbt_test_nb_tests);
549     first = 1;
550     if (_xbt_test_nb_tests != _xbt_test_test_failed) {
551       fprintf(stderr, "%d ok", _xbt_test_nb_tests - _xbt_test_test_failed);
552       first = 0;
553     }
554     if (_xbt_test_test_failed) {
555       fprintf(stderr, "%s%d failed", (first ? "" : ", "), _xbt_test_test_failed);
556       first = 0;
557     }
558     if (_xbt_test_test_ignore) {
559       fprintf(stderr, "%s%d ignored", (first ? "" : ", "), _xbt_test_test_ignore);
560       first = 0;
561     }
562     if (_xbt_test_test_expect) {
563       fprintf(stderr, "%s%d expected to fail", (first ? "" : ", "), _xbt_test_test_expect);
564     }
565
566     fprintf(stderr, ")\n");
567   } else {
568     fprintf(stderr, "No unit to run!\n");
569     _xbt_test_unit_failed++;
570   }
571   return _xbt_test_unit_failed;
572 }
573
574 void xbt_test_exit()
575 {
576   xbt_dynar_free(&_xbt_test_suites);
577 }
578
579 /* annotate test case with test */
580 void _xbt_test_add(const char *file, int line, const char *fmt, ...)
581 {
582   xbt_test_unit_t unit = _xbt_test_current_unit;
583   xbt_assert(unit);
584
585   va_list ap;
586   va_start(ap, fmt);
587   unit->tests_.emplace_back(simgrid::xbt::string_vprintf(fmt, ap), file, line);
588   va_end(ap);
589 }
590
591 /* annotate test case with log message and failure */
592 void _xbt_test_fail(const char *file, int line, const char *fmt, ...)
593 {
594   xbt_test_unit_t unit = _xbt_test_current_unit;
595   xbt_assert(unit);
596   xbt_assert(not _xbt_test_current_unit->tests_.empty(), "Test failed even before being declared (broken unit: %s)",
597              unit->title_.c_str());
598
599   s_xbt_test_test& test = unit->tests_.back();
600   va_list ap;
601   va_start(ap, fmt);
602   test.logs_.emplace_back(simgrid::xbt::string_vprintf(fmt, ap), file, line);
603   va_end(ap);
604
605   test.failed_ = true;
606 }
607
608 void xbt_test_exception(xbt_ex_t e)
609 {
610   _xbt_test_fail(e.throwPoint().file, e.throwPoint().line, "Exception %s raised: %s", xbt_ex_catname(e.category), e.what());
611 }
612
613 void xbt_test_expect_failure()
614 {
615   xbt_assert(not _xbt_test_current_unit->tests_.empty(),
616              "Cannot expect the failure of a test before declaring it (broken unit: %s)",
617              _xbt_test_current_unit->title_.c_str());
618   _xbt_test_current_unit->tests_.back().expected_failure_ = true;
619 }
620
621 void xbt_test_skip()
622 {
623   xbt_assert(not _xbt_test_current_unit->tests_.empty(), "Test skipped even before being declared (broken unit: %s)",
624              _xbt_test_current_unit->title_.c_str());
625   _xbt_test_current_unit->tests_.back().ignored_ = true;
626 }
627
628 /* annotate test case with log message only */
629 void _xbt_test_log(const char *file, int line, const char *fmt, ...)
630 {
631   xbt_test_unit_t unit = _xbt_test_current_unit;
632   xbt_assert(unit);
633   xbt_assert(not _xbt_test_current_unit->tests_.empty(),
634              "Test logged into even before being declared (broken test unit: %s)", unit->title_.c_str());
635
636   va_list ap;
637   va_start(ap, fmt);
638   unit->tests_.back().logs_.emplace_back(simgrid::xbt::string_vprintf(fmt, ap), file, line);
639   va_end(ap);
640 }
641
642 #ifdef SIMGRID_TEST
643 XBT_TEST_SUITE("cunit", "Testsuite mechanism autotest");
644
645 XBT_TEST_UNIT("expect", test_expected_failure, "expected failures")
646 {
647   xbt_test_add("Skipped test");
648   xbt_test_skip();
649
650   xbt_test_add("%s %s", "EXPECTED", "FAILURE");
651   xbt_test_expect_failure();
652   xbt_test_log("%s %s", "Test", "log");
653   xbt_test_fail("EXPECTED FAILURE");
654 }
655 #endif                          /* SIMGRID_TEST */