Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc sonar threats.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 10 Jul 2019 06:48:45 +0000 (08:48 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 10 Jul 2019 06:48:45 +0000 (08:48 +0200)
src/surf/network_cm02.hpp
src/surf/xml/surfxml_sax_cb.cpp
teshsuite/mc/random-bug/random-bug-replay.tesh
teshsuite/mc/random-bug/random-bug.cpp
teshsuite/mc/random-bug/random-bug.tesh

index 8cd453e..1b9469b 100644 (file)
@@ -57,9 +57,6 @@ class NetworkWifiLink : public NetworkCm02Link {
   /** @brief Hold every rates association between host and links (host name, rates id) */
   std::map<xbt::string, int> host_rates_;
 
-  /** @brief Hold every rates available for this Access Point */
-  // double* rates; FIXME: unused
-
   /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */
   std::vector<Metric> bandwidths_;
 
index 5544791..a363d6c 100644 (file)
@@ -243,7 +243,7 @@ std::vector<double> surf_parse_get_bandwidths(const char* string, const char* en
         "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"));
   }
 
-  return (bandwidths);
+  return bandwidths;
 }
 
 double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name)
index 11145c9..ed83684 100644 (file)
@@ -1,12 +1,12 @@
 #!/usr/bin/env tesh
 $ ${bindir:=.}/random-bug printf ${platfdir}/small_platform.xml  --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=model-check/replay:1/3;1/4"
-> Behavior: printf
+> [  0.000000] (0:maestro@) Behavior: printf
 > [  0.000000] (0:maestro@) path=1/3;1/4
-> Error reached
+> [  0.000000] (1:app@Fafard) Error reached
 
 # Behavior: assert does not have the same output within and without MC, so don't test it here. That's already covered with the other ones
 
 ! expect signal SIGIOT
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/random-bug abort ${platfdir}/small_platform.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=model-check/replay:1/3;1/4"
-> Behavior: abort
+> [  0.000000] (0:maestro@) Behavior: abort
 > [  0.000000] (0:maestro@) path=1/3;1/4
index 4f3a9f8..23e96cb 100644 (file)
@@ -3,10 +3,12 @@
 /* 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. */
 
+#include <cstring>
 #include <simgrid/modelchecker.h>
 #include <simgrid/s4u.hpp>
+#include <xbt/log.h>
 
-#include <stdio.h> /* snprintf */
+XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "For this example");
 
 enum { ABORT, ASSERT, PRINTF } behavior;
 
@@ -16,13 +18,16 @@ static void app()
   int x = MC_random(0, 5);
   int y = MC_random(0, 5);
 
-  if (behavior == ABORT) {
-    abort();
-  } else if (behavior == ASSERT) {
-    MC_assert(x != 3 || y != 4);
-  } else if (behavior == PRINTF) {
-    if (x == 3 && y == 4)
-      fprintf(stderr, "Error reached\n");
+  switch (behavior) {
+    case ABORT:
+      abort();
+    case ASSERT:
+      MC_assert(x != 3 || y != 4);
+      break;
+    case PRINTF:
+      if (x == 3 && y == 4)
+        XBT_ERROR("Error reached");
+      break;
   }
 }
 
@@ -32,13 +37,13 @@ int main(int argc, char* argv[])
   simgrid::s4u::Engine e(&argc, argv);
   xbt_assert(argc == 3, "Usage: random-bug raise|assert <platformfile>");
   if (strcmp(argv[1], "abort") == 0) {
-    printf("Behavior: abort\n");
+    XBT_INFO("Behavior: abort");
     behavior = ABORT;
   } else if (strcmp(argv[1], "assert") == 0) {
-    printf("Behavior: assert\n");
+    XBT_INFO("Behavior: assert");
     behavior = ASSERT;
   } else if (strcmp(argv[1], "printf") == 0) {
-    printf("Behavior: printf\n");
+    XBT_INFO("Behavior: printf");
     behavior = PRINTF;
   }
 
index 4e03424..c41c45b 100644 (file)
@@ -2,7 +2,7 @@
 ! expect return 1
 $ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug assert ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning
 > [  0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: assert
+> [  0.000000] (0:maestro@) Behavior: assert
 > [  0.000000] (0:maestro@) **************************
 > [  0.000000] (0:maestro@) *** PROPERTY NOT VALID ***
 > [  0.000000] (0:maestro@) **************************
@@ -18,7 +18,7 @@ $ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug assert ${platfdir
 # because SIMGRID_MC_EXIT_PROGRAM_CRASH = 6
 $ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug abort ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --log=no_loc
 > [  0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: abort
+> [  0.000000] (0:maestro@) Behavior: abort
 > [  0.000000] (0:maestro@) **************************
 > [  0.000000] (0:maestro@) ** CRASH IN THE PROGRAM **
 > [  0.000000] (0:maestro@) **************************
@@ -34,8 +34,8 @@ $ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug abort ${platfdir}
 
 $ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug printf ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning
 > [  0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
-> Behavior: printf
-> Error reached
+> [  0.000000] (0:maestro@) Behavior: printf
+> [  0.000000] (1:app@Fafard) Error reached
 > [  0.000000] (0:maestro@) No property violation found.
 > [  0.000000] (0:maestro@) Expanded states = 43
 > [  0.000000] (0:maestro@) Visited states = 108