Skip to contentSkip to conversation

Remove files which does not have a dmesg entry

PATCH Superseded Subrata Modak 2 participants 2 messages Jul 1, 2010

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Remove files which does not have a dmesg entry

Hi,

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.

---

runltp renamed from runltp.orig +20 -0
@@ -858,6 +858,26 @@ 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
+		PREVIOUS_TO_DMESG_DIR=`pwd`
+		cd $DMESG_DIR
+		if [ $? -eq 0 ] ; then
+			find . -size 0 -exec rm {} +
+		else
+			echo "cd to $DMESG_DIR failed: $?"
+		fi
+		cd $PREVIOUS_TO_DMESG_DIR
+		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

#1 lore raw

runltp main() · line 873

Quoted 8 lines · On Thursday, July 01, 2010 11:34:47 Subrata Modak wrote:
runltp renamed from runltp.orig +8 -0
+		PREVIOUS_TO_DMESG_DIR=`pwd`
+		cd $DMESG_DIR
+		if [ $? -eq 0 ] ; then
+			find . -size 0 -exec rm {} +
+		else
+			echo "cd to $DMESG_DIR failed: $?"
+		fi
+		cd $PREVIOUS_TO_DMESG_DIR

if find "$DMESG_DIR" -size 0 -exec rm {} + ; then
echo "cd to $DMESG_DIR failed: $?"
fi
-mike

------------------------------------------------------------------------------
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