r8594 struggleyb - in /branches/struggleyb/libdom-remain/test: build-test.sh leak-test.sh run-single-test.sh run-test.sh

netsurf at semichrome.net netsurf at semichrome.net
Fri Jul 17 07:33:53 BST 2009


Author: struggleyb
Date: Fri Jul 17 01:33:53 2009
New Revision: 8594

URL: http://source.netsurf-browser.org?rev=8594&view=rev
Log:
Add leak-test.sh which uses valgrind to test memroy leaks of libdom with DOMTS. Add usage comment for the four simple shell scripts.

Added:
    branches/struggleyb/libdom-remain/test/leak-test.sh   (with props)
Modified:
    branches/struggleyb/libdom-remain/test/build-test.sh
    branches/struggleyb/libdom-remain/test/run-single-test.sh
    branches/struggleyb/libdom-remain/test/run-test.sh

Modified: branches/struggleyb/libdom-remain/test/build-test.sh
URL: http://source.netsurf-browser.org/branches/struggleyb/libdom-remain/test/build-test.sh?rev=8594&r1=8593&r2=8594&view=diff
==============================================================================
--- branches/struggleyb/libdom-remain/test/build-test.sh (original)
+++ branches/struggleyb/libdom-remain/test/build-test.sh Fri Jul 17 01:33:53 2009
@@ -1,4 +1,18 @@
 #!/bin/bash
+#
+# This is a simple script to recompile a C test file.
+# Usage:
+# This script is designed to run under test output directory.
+# 
+# You should firstly run "run-test.sh", which will genrate a test output directory. In that
+# directory, there are C source files and corresponding executables.
+#
+# ../../../build-test.sh some-test-converted-c-file.c
+#
+#  This file is part of libdom test suite.
+#  Licensed under the MIT License,
+#                 http://www.opensource.org/licenses/mit-license.php
+#  Copyright 2009 Bo Yang <struggleyb.nku at gmail.com>
 
 src="testutils/comparators.c testutils/domtsasserts.c testutils/foreach.c testutils/list.c testutils/load.c testutils/utils.c testutils/domtscondition.c"
 domdir="../build-Linux-Linux-debug-lib-static"

Added: branches/struggleyb/libdom-remain/test/leak-test.sh
URL: http://source.netsurf-browser.org/branches/struggleyb/libdom-remain/test/leak-test.sh?rev=8594&view=auto
==============================================================================
--- branches/struggleyb/libdom-remain/test/leak-test.sh (added)
+++ branches/struggleyb/libdom-remain/test/leak-test.sh Fri Jul 17 01:33:53 2009
@@ -1,0 +1,45 @@
+#!/bin/bash
+#
+# This is a simple script used to test libdom memory leakage. 
+# Usage: 
+# You should firstly run "run-test.sh", which will genrate a test output directory. In that
+# directory, there are C source files and corresponding executables.
+# Go to the test output directory. For example , for core, level 1, it is output/level1/core
+# And run this script as ../../../leak-test.sh "log-file"
+#
+#  This file is part of libdom test suite.
+#  Licensed under the MIT License,
+#                 http://www.opensource.org/licenses/mit-license.php
+#  Copyright 2009 Bo Yang <struggleyb.nku at gmail.com>
+
+log=$1;
+totla=0;
+leak=0;
+ok=0;
+while read f; do
+	#Test defnitely lost
+	echo -n "$f: " >&3;
+	echo -n "$f: ";
+	dl=$(valgrind "$f" 2>&1 | grep "definitely lost" | sed -e 's/definitely lost//g' -e 's/bytes in//g' -e 's/blocks.//g' -e 's/^.*://g'  -e 's/ //g' -e 's/,//g');
+	pl=$(valgrind "$f" 2>&1 | grep "possibly lost" | sed -e 's/possibly lost//g' -e 's/bytes in//g' -e 's/blocks.//g' -e 's/^.*://g'  -e 's/ //g' -e 's/,//g');
+
+	total=$((total+1));
+	if [ "$dl" -eq "00" -a "$pl" -eq "00" ]; then
+		echo "ok..."  >&3;
+		echo "ok...";
+		ok=$((ok+1));
+	else
+		echo "leaked!" >&3;
+		echo "leaked!";
+		leak=$((leak+1));
+	fi
+
+done 3>"$log" < <(find ./ -perm -o=x  -type f -print);
+
+echo "Total: $total" >>"$log";
+echo "Leak:  $leak" >>"$log";
+echo "Ok:	 $ok" >>"$log";
+
+echo "Total: $total";
+echo "Leak:  $leak";
+echo "Ok:	 $ok";

Propchange: branches/struggleyb/libdom-remain/test/leak-test.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: branches/struggleyb/libdom-remain/test/run-single-test.sh
URL: http://source.netsurf-browser.org/branches/struggleyb/libdom-remain/test/run-single-test.sh?rev=8594&r1=8593&r2=8594&view=diff
==============================================================================
--- branches/struggleyb/libdom-remain/test/run-single-test.sh (original)
+++ branches/struggleyb/libdom-remain/test/run-single-test.sh Fri Jul 17 01:33:53 2009
@@ -1,4 +1,20 @@
 #!/bin/bash 
+#
+# This is a simple script to convert the a XML testcae to C source file, compile it, run it, and report the result.
+# Usage:
+# This script is designed to run under the libdom/test directory.
+# 
+# domts="testcases" dtd="dom1-interfaces.xml" level="level1" ./run-single-test.sh
+#
+# The above command will convert the XML testcase in directory testcases/tests/level/core and 
+# use dom1-interfaces.xml to convert it. 
+# This script will generate a output/ directory in libdom/test, and in that directory, there is a same structure
+# as in DOMTS XML testcases files.
+#
+#  This file is part of libdom test suite.
+#  Licensed under the MIT License,
+#                 http://www.opensource.org/licenses/mit-license.php
+#  Copyright 2009 Bo Yang <struggleyb.nku at gmail.com>
 
 level=${level:-"level1"};
 module=${module:-"core"};

Modified: branches/struggleyb/libdom-remain/test/run-test.sh
URL: http://source.netsurf-browser.org/branches/struggleyb/libdom-remain/test/run-test.sh?rev=8594&r1=8593&r2=8594&view=diff
==============================================================================
--- branches/struggleyb/libdom-remain/test/run-test.sh (original)
+++ branches/struggleyb/libdom-remain/test/run-test.sh Fri Jul 17 01:33:53 2009
@@ -1,4 +1,20 @@
 #!/bin/bash
+#
+# This is a simple script to convert the XML testcaes to C source file, compile it, run it, and report the result.
+# Usage:
+# This script is designed to run under the libdom/test directory.
+# 
+# domts="testcases" dtd="dom1-interfaces.xml" level="level1" ./run-test.sh
+#
+# The above command will convert the XML testcase in directory testcases/tests/level/core and 
+# use dom1-interfaces.xml to convert it. 
+# This script will generate a output/ directory in libdom/test, and in that directory, there is a same structure
+# as in DOMTS XML testcases files.
+#
+#  This file is part of libdom test suite.
+#  Licensed under the MIT License,
+#                 http://www.opensource.org/licenses/mit-license.php
+#  Copyright 2009 Bo Yang <struggleyb.nku at gmail.com>
 
 level=${level:-"level1"};
 module=${module:-"core"};




More information about the netsurf-commits mailing list