November 8 2006

来源:互联网 发布:异地一半照片软件 编辑:程序博客网 时间:2024/05/23 17:47
Yesterday I added debug print information into two C source files.  I thought it is a easy
thing to do.  However,  there are still troublesome during the procedures.  When the "eclipse",
a development tools by IBM, importing the sources of a project, in fact, it copied those source
into a project directory made by "eclipse" itself.  So, I made a mistake that I uploaded the
source file is not in the project directory.  Oh, I was strange why not the new program producted
print the debug information.

  Today the task is not finished.  We must read those source to understand the merchanism of
those programs.  In addition, more debug work must be done, for example exception debug,
pressure testing, and so forth.

  Firstly, I testing the saturation on file IO error, data error.  I renamed the CSV file.  Then
the "tmstmsnd" which I am debugging can not find the correct file in according to the specified
path, so it did not create any sub-threads and reported "fopen() error." and exit.

  That is right.  I changed the CSV file's content.  I set the "retry=0, timeout=0".  According to
the business logic, "tmstmsnd" will create its child threads.  It do it.  These threads will retry
to send time message towards a remote host if it failed to send and the retried time is less than
the specified times.

  Secondly, I changed some codes so as to ensure the program traverse all branchs include the normal
or the abnormals.  It is unreality to simulate those occurring exceptions in reality.  For instance,
the program must report a error on "Fail to create a batebase" if it real failed.  Although we can
shut down the database server that is bad idea.  There are seven persons concurring testing this
system.  Once the databse server is shut down by one the others must wait its restarting.

  The means we adopted is to make error cases in codes.  As follow:

  //orginial codes
  if( FALSE == createDBQuery( queryBuffer, DB_MODE_SELECT, "CMN", DIRECTOR_INFO_TBL_NAME, whereBuffer, fieldsBuffer ) ) {
        SGCMNsyslogErr("getCLtimeMaster.c@getCLtimeMaster():createDBQuery Error");
        return FALSE;
  }

  // modified
  if( FALSE == createDBQuery( queryBuffer, DB_MODE_SELECT, "ABC", DIRECTOR_INFO_TBL_NAME, whereBuffer, fieldsBuffer ) ) {
        SGCMNsyslogErr("getCLtimeMaster.c@getCLtimeMaster():createDBQuery Error");
        return FALSE;
  }

  The "ABC" or "CMN" is the name of a database, but "ABC" database does not exist.  So, we
can find a log message in the log file -- "getCLtimeMaster.c@getCLtimeMaster():createDBQuery Error".