[Lsb-messages] /var/www/bzr/lsb/devel/misc-test r2400: minor: pep8 checking on tetj.py, no functional chg / no version bump

Mats Wichmann mats at linuxfoundation.org
Tue Oct 1 17:11:31 UTC 2013


------------------------------------------------------------
revno: 2400
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: misc-test
timestamp: Tue 2013-10-01 11:11:31 -0600
message:
  minor: pep8 checking on tetj.py, no functional chg / no version bump
modified:
  rpmchk/archive.c
  tetj/tetj.py
-------------- next part --------------
=== modified file 'rpmchk/archive.c'
--- a/rpmchk/archive.c	2013-09-28 15:26:11 +0000
+++ b/rpmchk/archive.c	2013-10-01 17:11:31 +0000
@@ -524,7 +524,6 @@
     int filesizesum = 0;
     int i;
     ElfFile *elfFile;
-    char *execFile = NULL;
 
     file1->archive = (caddr_t) file1->nexthdr;
 
@@ -618,7 +617,7 @@
 	    elfFile->size = elfFiles[i]->filesize;
 	    elfFile->filename = NULL;
 
-	    if ((execFile = (char *) calloc(1, elfFile->size)) == NULL) {
+	    if ((elfFile->addr = (char *) calloc(1, elfFile->size)) == NULL) {
 		    fprintf(stderr,
 			    "Unable to alloc memory for uncompressed file %s\n",
 			    elfFiles[i]->filename);
@@ -650,8 +649,7 @@
 		    "\ncheckRpmArchive: Inflating file %s-pass2 size %d ...\n",
 		    elfFiles[i]->filename, elfFile->size);
 #endif
-	    gzread(zfile, execFile, elfFile->size);
-	    elfFile->addr = execFile;
+	    gzread(zfile, elfFile->addr, elfFile->size);
 	    snprintf(tmp_string, TMP_STRING_SIZE,
 		     "Checking ELF file %s ...", elfFiles[i]->filename);
 	    fprintf(stderr, "%s\n", tmp_string);
@@ -666,7 +664,10 @@
 		checkElf(elfFile, ELF_IS_DSO, journal);
 		check_lib(elfFile, ELF_IS_DSO, modules);
 	    }
-out:
+
+out:	    /* before exit, free up the various allocated chunks */
+	    if(elfFIle && elfFile->addr)
+		free(elfFile->addr);
 
 	    if(elfFile && elfFile->filename)
 		free(elfFile->filename);
@@ -674,12 +675,9 @@
 	    if(elfFile && elfFile->versionnames)
 		free(elfFile->versionnames);
 
-	    if(execFile)
-		free(execFile);
 	    if(elfFile)
 		free(elfFile);
 	}			/* for number of ET_EXEC files */
     }				/* if check_app */
-    
     gzclose(zfile);
 }

=== modified file 'tetj/tetj.py'
--- a/tetj/tetj.py	2009-02-27 18:35:26 +0000
+++ b/tetj/tetj.py	2013-10-01 17:11:31 +0000
@@ -16,13 +16,13 @@
 # Python module originally converted from C version (tetj.c 1.3)
 # Author: Mats Wichmann, Intel Corporation on behalf of the LSB project
 #
-# Copyright (C) 2002-2009 The Linux Foundation
+# Copyright (C) 2002-2013 The Linux Foundation
 # All rights reserved.
-# 
+#
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
 # are met:
-# 
+#
 #     * Redistributions of source code must retain the above copyright
 # notice, this list of conditions and the following disclaimer.
 #     * Redistributions in binary form must reproduce the above copyright
@@ -31,7 +31,7 @@
 #     * Neither the name of the Linux Foundation nor the names of its
 # contributors may be used to endorse or promote products derived from
 # this software without specific prior written permission.
-# 
+#
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -112,12 +112,11 @@
         except KeyError:
             pwent = 'Unknown'
 
-        
-        self.__log(0, '%s %s' % (self.tetj_vers, datetime), 
-                   'User: %s (%i) TCC Start, Command line: %s' % 
+        self.__log(0, '%s %s' % (self.tetj_vers, datetime),
+                   'User: %s (%i) TCC Start, Command line: %s' %
                    (pwent[0], uid, command_run))
 
-        self.__log(5, '%s %s %s %s %s' % (sysname, nodename, release, 
+        self.__log(5, '%s %s %s %s %s' % (sysname, nodename, release,
                    version, machine), 'System Information')
 
     # private methods
@@ -125,7 +124,7 @@
         """write message to journal with bounds checking"""
         # historically, tet lines limited to 512 bytes, be compatible
         # 3 delimiter chars, as in:  linetype|info|msg\n
-        maxlen = 512 - len(str(linetype)) - len(info) - len(msg) -3
+        maxlen = 512 - len(str(linetype)) - len(info) - len(msg) - 3
         if len(msg) > maxlen:
             self.journal.append("%d|%s|%s\n" % (linetype, info, msg[:maxlen]))
             self.journal.append('510||warning: results file line truncated\n')
@@ -185,7 +184,7 @@
 
     def testcase_end(self, message=""):
         """log a testcase end event"""
-        self.__log(80, '%u 0 %s' % (self.activity, timestr()), 
+        self.__log(80, '%u 0 %s' % (self.activity, timestr()),
                    'TC End %s' % message)
 
     def purpose_start(self, message=""):
@@ -196,11 +195,11 @@
         # Instead we make the call purpose_start mean 400 200,
         # and predict the tp count within that ic as (hardwired) 1
         self.testcase += 1
-        self.__log(400, 
+        self.__log(400,
                    '%u %u 1 %s' % (self.activity, self.testcase, timestr()),
                    'IC Start')
         self.__log(200, '%u %u %s' % (self.activity, self.testcase, timestr()),
-                   'TP Start %s' %message)
+                   'TP Start %s' % message)
 
     def purpose_end(self):
         """log a test purpose end event"""
@@ -209,12 +208,12 @@
         if self.rescode == -1:
             self.rescode = 7
         res = RESULT_CODES.get(self.rescode, 'UNREPORTED')
-        self.__log(220, '%u %u %u %s' % (self.activity, self.testcase, 
+        self.__log(220, '%u %u %u %s' % (self.activity, self.testcase,
                                          self.rescode, timestr()), res)
         self.rescode = -1
         # Now log the test purpose end
         # see note above: the hardwired '1' shouldn't be
-        self.__log(410, '%u %u 1 %s' % 
+        self.__log(410, '%u %u 1 %s' %
                         (self.activity, self.testcase, timestr()),
                    'IC End')
 
@@ -230,10 +229,9 @@
             self.__setcontext()
         # in case we got a multi-line info message, split it up
         for line in cStringIO.StringIO(str(message)):
-            self.__log(520, 
-                       '%u %u %u %u %u' % (self.activity, self.testcase, 
-                       self.context, self.block, self.sequence),
-                       line.strip())
+            self.__log(520, '%u %u %u %u %u' %
+                       (self.activity, self.testcase, self.context,
+                        self.block, self.sequence), line.strip())
             self.sequence += 1
 
     # add convenience methods for results



More information about the lsb-messages mailing list