[PATCH v4] Remove files which does not have a dmesg entry

The recently introduced option:

-K DMESG_LOG_DIR
        Log Kernel messages generated for each test cases inside this directory,

when used will generate huge no. of files inside the DMESG_DIR. Many of
them will be ZERO size as we do not expect KERNEL MESSAGE to be generated
against all the LTP TESTS that we will run. It is better to prune them, and
let only those files exist which will have real entries. The following
patch fixes the same.

Signed-off-by: Subrata Modak <[email protected]>,
---

--- ltp/runltp.orig     2010-07-01 20:51:15.000000000 +0530
+++ ltp/runltp  2010-07-01 22:19:53.000000000 +0530
@@ -858,6 +858,21 @@ main()
     cd ..
     echo "LTP Version: $version_date"
 
+       # $DMESG_DIR is used to cache messages obtained from dmesg after a test 
run.
+       # Proactively reap all of the 0-byte files in $DMESG_DIR as they have 
zero value
+       # and only clutter up the filesystem.
+
+       if [ $ALT_DMESG_OUT -eq 1 ] ; then
+               if ! find "$DMESG_DIR" -size 0 -exec rm {} + ; then
+                       echo "cd to $DMESG_DIR failed: $?"
+               fi
+               if [ -n "$(ls "$DMESG_DIR")" ] ; then
+                       echo "Kernel messages were generated for LTP tests 
$version_date"
+               else
+                       echo "No Kernel messages were generated for LTP tests 
$version_date"
+               fi
+       fi
+
     if [ "$ALT_HTML_OUT" -eq 1 ] ; then        #User wants the HTML output to 
be created, it then needs to be generated
        export LTP_VERSION=$version_date
        export TEST_START_TIME=$test_start_time

---
Regards--
Subrata


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to