[openib-general] [PATCHv2] osm: fixing bugs in osmtest

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Thu Sep 21 00:30:38 PDT 2006


Hi Hal

It appears that each mailer is messing with white spaces 
in its own very special way... 

Anyway, this time it is ok for sure.

Yevgeny

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>

Index: osmtest/include/osmtest.h
===================================================================
--- osmtest/include/osmtest.h	(revision 9585)
+++ osmtest/include/osmtest.h	(working copy)
@@ -506,4 +506,13 @@ ib_api_status_t
 osmtest_get_local_port_lmc( IN osmtest_t * const p_osmt,
                             IN ib_net16_t  lid,
                             OUT uint8_t *  const p_lmc );
+
+
+/*
+ * A few auxiliary macros for logging
+ */
+
+#define EXPECTING_ERRORS_START "[[ ===== Expecting Errors - START ===== "
+#define EXPECTING_ERRORS_END   "   ===== Expecting Errors  -  END ===== ]]"
+
 #endif /* _OSMTEST_H_ */
Index: osmtest/osmtest.c
===================================================================
--- osmtest/osmtest.c	(revision 9585)
+++ osmtest/osmtest.c	(working copy)
@@ -552,6 +552,7 @@ osmtest_init( IN osmtest_t * const p_osm
     osm_log( &p_osmt->log, OSM_LOG_ERROR,
              "osmtest_init: ERR 0001: "
              "Unable to allocate vendor object" );
+    status = IB_ERROR;
     goto Exit;
   }
 
@@ -1817,6 +1818,11 @@ osmtest_wrong_sm_key_ignored( IN osmtest
     osm_log( &p_osmt->log, OSM_LOG_ERROR,
              "osmtest_wrong_sm_key_ignored: ERR 0011: "
              "Did not get a timeout but got (%s)\n", ib_get_err_str( status ) );
+    if ( status == IB_SUCCESS )
+    {
+      /* assign some error value to status, since IB_SUCCESS is a bad rc */
+      status = IB_ERROR;
+    }
     goto Exit;
   }
   else
@@ -5448,14 +5454,23 @@ osmtest_validate_against_db( IN osmtest_
 
   memset( &context, 0, sizeof( context ) );
   memset( &request, 0, sizeof( request ) );
+
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_START "\n" );
   status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status != IB_SUCCESS )
+  {
+     osm_log( &p_osmt->log, OSM_LOG_ERROR,
+              "osmtest_get_multipath_rec: "
+              "Got error %s\n", ib_get_err_str(status) );
+  }
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_END "\n" );
+
   if( status == IB_SUCCESS )
-    goto Exit;
-  else
   {
-    osm_log( &p_osmt->log, OSM_LOG_ERROR,
-             "osmtest_get_multipath_rec: "
-             "IS EXPECTED ERROR ^^^^\n");
+    status = IB_ERROR;
+    goto Exit;
   }
 
   memset( &context, 0, sizeof( context ) );
@@ -5463,14 +5478,23 @@ osmtest_validate_against_db( IN osmtest_
   request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT;
   request.sgid_count = 1;
   ib_gid_set_default( &request.gids[0], portguid );
+
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_START "\n" );
   status = osmtest_get_multipath_rec( p_osmt, &request, &context );
-  if( status == IB_SUCCESS ) 
-    goto Exit;
-  else
+  if( status != IB_SUCCESS )
   {
-    osm_log( &p_osmt->log, OSM_LOG_ERROR,
-             "osmtest_get_multipath_rec: "
-             "IS EXPECTED ERROR ^^^^\n");
+     osm_log( &p_osmt->log, OSM_LOG_ERROR,
+              "osmtest_get_multipath_rec: "
+              "Got error %s\n", ib_get_err_str(status) );
+  }
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_END "\n" );
+
+  if( status == IB_SUCCESS )
+  {
+    status = IB_ERROR;
+    goto Exit;
   }
 
   memset( &context, 0, sizeof( context ) );
@@ -5482,14 +5506,23 @@ osmtest_validate_against_db( IN osmtest_
   /* Set IPoIB broadcast MGID */
   request.gids[1].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);
   request.gids[1].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);
+
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_START "\n" );
   status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status != IB_SUCCESS )
+  {
+     osm_log( &p_osmt->log, OSM_LOG_ERROR,
+              "osmtest_get_multipath_rec: "
+              "Got error %s\n", ib_get_err_str(status) );
+  }
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_END "\n" );
+
   if( status == IB_SUCCESS )
-    goto Exit;
-  else
   {
-    osm_log( &p_osmt->log, OSM_LOG_ERROR,
-             "osmtest_get_multipath_rec: "
-             "IS EXPECTED ERROR ^^^^\n");
+    status = IB_ERROR;
+    goto Exit;
   }
 
   memset( &context, 0, sizeof( context ) );
@@ -5500,14 +5533,23 @@ osmtest_validate_against_db( IN osmtest_
   request.gids[0].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);
   request.gids[0].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);
   ib_gid_set_default( &request.gids[1], portguid );
+
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_START "\n" );
   status = osmtest_get_multipath_rec( p_osmt, &request, &context );
+  if( status != IB_SUCCESS )
+  {
+     osm_log( &p_osmt->log, OSM_LOG_ERROR,
+              "osmtest_get_multipath_rec: "
+              "Got error %s\n", ib_get_err_str(status) );
+  }
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_END "\n" );
+
   if( status == IB_SUCCESS )
-    goto Exit;
-  else
   {
-    osm_log( &p_osmt->log, OSM_LOG_ERROR,
-             "osmtest_get_multipath_rec_gid_ipoib_bcast: "
-             "IS EXPECTED ERROR ^^^^\n");
+    status = IB_ERROR;
+    goto Exit;
   }
 
   memset( &context, 0, sizeof( context ) );
@@ -5569,14 +5611,23 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   memset( &context, 0, sizeof( context ) );
+
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_START "\n" );
   status = osmtest_get_pkeytbl_rec_by_lid( p_osmt, test_lid, 0, &context );
-  if ( status == IB_SUCCESS )
-    goto Exit;
-  else
+  if( status != IB_SUCCESS )
   {
-    osm_log( &p_osmt->log, OSM_LOG_ERROR,
-             "osmtest_get_pkeytbl_rec_by_lid: "
-             "IS EXPECTED ERROR ^^^^\n");
+     osm_log( &p_osmt->log, OSM_LOG_ERROR,
+              "osmtest_get_multipath_rec: "
+              "Got error %s\n", ib_get_err_str(status) );
+  }
+  osm_log( &p_osmt->log, OSM_LOG_ERROR,
+           "osmtest_get_multipath_rec: " EXPECTING_ERRORS_END "\n" );
+
+  if( status == IB_SUCCESS )
+  {
+    status = IB_ERROR;
+    goto Exit;
   }
 
   memset( &context, 0, sizeof( context ) );
@@ -5679,26 +5730,43 @@ osmtest_validate_against_db( IN osmtest_
         goto Exit;
 
       memset( &context, 0, sizeof( context ) );
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_path_rec_by_lid_pair: " EXPECTING_ERRORS_START "\n" );
       status = osmtest_get_path_rec_by_lid_pair( p_osmt, 0xffff,
                                                  0xffff, &context );
-      if (status == IB_SUCCESS )
-        goto Exit;
-      else
+      if( status != IB_SUCCESS )
       {
-        osm_log ( &p_osmt->log, OSM_LOG_ERROR,
+         osm_log( &p_osmt->log, OSM_LOG_ERROR,
                   "osmtest_get_path_rec_by_lid_pair: "
-                  "IS EXPECTED ERROR ^^^^\n" );
+                  "Got error %s\n", ib_get_err_str(status) );
+      }
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_path_rec_by_lid_pair: " EXPECTING_ERRORS_END "\n" );
+
+      if( status == IB_SUCCESS )
+      {
+        status = IB_ERROR;
+        goto Exit;
       }
 
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_path_rec_by_lid_pair: " EXPECTING_ERRORS_START "\n" );
+
       status = osmtest_get_path_rec_by_lid_pair( p_osmt, test_lid,
                                                  0xffff, &context );
-      if (status == IB_SUCCESS )
-        goto Exit;
-      else
+      if( status != IB_SUCCESS )
       {
-        osm_log ( &p_osmt->log, OSM_LOG_ERROR,
+         osm_log( &p_osmt->log, OSM_LOG_ERROR,
                   "osmtest_get_path_rec_by_lid_pair: "
-                  "IS EXPECTED ERROR ^^^^\n" );
+                  "Got error %s\n", ib_get_err_str(status) );
+      }
+      osm_log( &p_osmt->log, OSM_LOG_ERROR,
+               "osmtest_get_path_rec_by_lid_pair: " EXPECTING_ERRORS_END "\n" );
+
+      if( status == IB_SUCCESS )
+      {
+        status = IB_ERROR;
+        goto Exit;
       }
     }
   }
@@ -7141,6 +7209,9 @@ osmtest_run( IN osmtest_t * const p_osmt
 
   if( p_osmt->opt.flow == 1 )
   {
+    /*
+     * Creating an inventory file with all nodes, ports and paths
+     */
     status = osmtest_create_inventory_file( p_osmt );
     if( status != IB_SUCCESS )
     {
@@ -7155,6 +7226,9 @@ osmtest_run( IN osmtest_t * const p_osmt
   {
     if( p_osmt->opt.flow == 5 )
     {
+      /*
+       * Stress SA - flood the it with queries
+       */
       switch ( p_osmt->opt.stress )
       {
         case 0:
@@ -7215,8 +7289,11 @@ osmtest_run( IN osmtest_t * const p_osmt
       /*
        * Run normal validition tests.
        */
-       if (!p_osmt->opt.flow || p_osmt->opt.flow == 2)
+       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 2)
        {
+         /*
+          * Only validate the given inventory file
+          */ 
          status = osmtest_create_db( p_osmt );
          if( status != IB_SUCCESS )
          {
@@ -7238,7 +7315,7 @@ osmtest_run( IN osmtest_t * const p_osmt
          }
        }
 
-       if (!p_osmt->opt.flow)
+       if (p_osmt->opt.flow == 0)
        {
          status = osmtest_wrong_sm_key_ignored( p_osmt );
          if( status != IB_SUCCESS )
@@ -7251,8 +7328,11 @@ osmtest_run( IN osmtest_t * const p_osmt
          }
        }
 
-       if (!p_osmt->opt.flow || p_osmt->opt.flow == 3)
+       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 3)
        {
+         /*
+          * run service registration, deregistration, and lease test
+          */
          status = osmt_run_service_records_flow( p_osmt );
          if( status != IB_SUCCESS )
          {
@@ -7264,8 +7344,11 @@ osmtest_run( IN osmtest_t * const p_osmt
          }
        }
 
-       if (!p_osmt->opt.flow || p_osmt->opt.flow == 4)
+       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 4)
        {
+          /* 
+           * Run event forwarding test
+           */
 #ifdef OSM_VENDOR_INTF_MTL
           status = osmt_run_inform_info_flow( p_osmt );
 
@@ -7286,12 +7369,13 @@ osmtest_run( IN osmtest_t * const p_osmt
 #endif
         }
 
-        /*
-         * since it generates a huge file, we run it only
-         * if explicitly required to
-         */
         if (p_osmt->opt.flow == 7)
         {
+          /* 
+           * QoS info: dump VLArb and SLtoVL tables.
+           * Since it generates a huge file, we run it only
+           * if explicitly required to
+           */
           status = osmtest_create_db( p_osmt );
           if( status != IB_SUCCESS )
           {
@@ -7315,6 +7399,9 @@ osmtest_run( IN osmtest_t * const p_osmt
 
         if (p_osmt->opt.flow == 8)
         {
+          /*
+           * Run trap 64/65 flow (this flow requires running of external tool)
+           */
 #ifdef OSM_VENDOR_INTF_MTL
           status = osmt_run_trap64_65_flow( p_osmt  );
           if( status != IB_SUCCESS )
@@ -7334,8 +7421,11 @@ osmtest_run( IN osmtest_t * const p_osmt
 #endif
         }
 
-        if (!p_osmt->opt.flow || p_osmt->opt.flow == 6)
+        if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 6)
         {
+          /*
+           * Multicast flow
+           */ 
           status = osmt_run_mcast_flow( p_osmt );
           if( status != IB_SUCCESS )
           {





More information about the general mailing list