[openib-general] [PATCH] osm: fix osmtest InformInfo flow to return error when expected error does not happen

Eitan Zahavi eitan at mellanox.co.il
Thu Dec 21 11:16:59 PST 2006


Hi Hal,

I have found that on BAD InformInfo transactions when the osmtest 
expects an error from the SM
it misses returning an error to the calling procedure which will make 
osmtest pass the test.

EZ
Signed-off-by: Eitan Zahavi <eitan at mellanox.co.il>

---
 osm/osmtest/osmtest.c |   50 
+++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/osm/osmtest/osmtest.c b/osm/osmtest/osmtest.c
index b1df333..e1c64ef 100644
--- a/osm/osmtest/osmtest.c
+++ b/osm/osmtest/osmtest.c
@@ -5813,14 +5813,20 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* InformInfoRecord tests */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a BAD - Set Unsubscribe request\n"); 
   memset( &inform_info_opt, 0, sizeof( inform_info_opt ) );
   memset( &inform_info_rec_opt, 0, sizeof( inform_info_rec_opt ) );
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, 
IB_MAD_ATTR_INFORM_INFO_RECORD,
-                       IB_MAD_METHOD_SET, &inform_info_rec_opt,
+                                       IB_MAD_METHOD_SET, 
&inform_info_rec_opt,
                                        &context );
   if ( status == IB_SUCCESS )
+  {
+    status = IB_ERROR;
     goto Exit;
+  }
   else
   {
     osm_log( &p_osmt->log, OSM_LOG_ERROR,
@@ -5828,20 +5834,30 @@ osmtest_validate_against_db( IN osmtest_
              "IS EXPECTED ERROR ^^^^\n");
   }
 
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+              "osmtest_informinfo_request: InformInfoRecord "
+              "Sending a Good - Empty GetTable request\n"); 
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, 
IB_MAD_ATTR_INFORM_INFO_RECORD,
-                       IB_MAD_METHOD_GETTABLE,
+                                                    IB_MAD_METHOD_GETTABLE,
                                        &inform_info_rec_opt, &context );
   if ( status != IB_SUCCESS )
     goto Exit;
 
   /* InformInfo tests */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a BAD - Empty Get request "
+           "(should fail with NO_RECORDS)\n"); 
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, IB_MAD_ATTR_INFORM_INFO,
                                        IB_MAD_METHOD_GET, &inform_info_opt,
                                        &context );
   if ( status == IB_SUCCESS )
+  {
+    status = IB_ERROR;
     goto Exit;
+  }
   else
   {
     osm_log( &p_osmt->log, OSM_LOG_ERROR,
@@ -5849,12 +5865,18 @@ osmtest_validate_against_db( IN osmtest_
              "IS EXPECTED ERROR ^^^^\n");
   }
 
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a BAD - Set Unsubscribe request\n"); 
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, IB_MAD_ATTR_INFORM_INFO,
                                        IB_MAD_METHOD_SET, &inform_info_opt,
                                        &context );
   if ( status == IB_SUCCESS )
+  {
+    status = IB_ERROR;
     goto Exit;
+  }
   else
   {
     osm_log( &p_osmt->log, OSM_LOG_ERROR,
@@ -5863,6 +5885,9 @@ osmtest_validate_against_db( IN osmtest_
   }
 
   /* Now subscribe */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - Set Subscribe request\n");
   inform_info_opt.subscribe = TRUE;
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, IB_MAD_ATTR_INFORM_INFO,
@@ -5872,6 +5897,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Now unsubscribe (QPN needs to be 1 to work) */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - Set Unsubscribe request\n");
   inform_info_opt.subscribe = FALSE;
   inform_info_opt.qpn = 1;
   memset( &context, 0, sizeof( context ) );
@@ -5882,6 +5910,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Now subscribe again */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - Set Subscribe request\n");
   inform_info_opt.subscribe = TRUE;
   inform_info_opt.qpn = 1;
   memset( &context, 0, sizeof( context ) );
@@ -5892,6 +5923,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Subscribe over existing subscription */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - Set Subscribe (again) request\n");
   inform_info_opt.qpn = 0;
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, IB_MAD_ATTR_INFORM_INFO,
@@ -5902,6 +5936,9 @@ osmtest_validate_against_db( IN osmtest_
 
   /* More InformInfoRecord tests */
   /* RID lookup (with currently invalid enum) */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - GetTable by GID\n");
   ib_gid_set_default( &inform_info_rec_opt.subscriber_gid,
                       p_osmt->local_port.port_guid );
   inform_info_rec_opt.subscriber_enum = 1;
@@ -5913,6 +5950,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Enum lookup */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - GetTable (subsriber_enum == 0) request\n");
   inform_info_rec_opt.subscriber_enum = 0;
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, 
IB_MAD_ATTR_INFORM_INFO_RECORD,
@@ -5922,6 +5962,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Get all InformInfoRecords */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - GetTable (ALL records) request\n");
   memset( &inform_info_rec_opt, 0, sizeof( inform_info_rec_opt ) );
   memset( &context, 0, sizeof( context ) );
   status = osmtest_informinfo_request( p_osmt, 
IB_MAD_ATTR_INFORM_INFO_RECORD,
@@ -5931,6 +5974,9 @@ osmtest_validate_against_db( IN osmtest_
     goto Exit;
 
   /* Cleanup subscriptions before further testing */
+  osm_log( &p_osmt->log, OSM_LOG_VERBOSE,
+           "osmtest_informinfo_request: InformInfoRecord "
+           "Sending a Good - Set (cleanup all of them) request\n");
   inform_info_opt.subscribe = FALSE;
   inform_info_opt.qpn = 1;
   memset( &context, 0, sizeof( context ) );
-- 
1.4.4.1.GIT






More information about the general mailing list