[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 <subrata@linux.vnet.ibm.com>,
diff --git a/runltp b/runltp
index 7a8ac28..b385984 100755
--- a/runltp
+++ b/runltp
@@ -858,6 +858,21 @@
     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