From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: LTP Mailing List <ltp-list@lists.sourceforge.net>
Cc: Sachin P Sant <sachinp@linux.vnet.ibm.com>,
Mike Frysinger <vapier@gentoo.org>,
Michael Reed <mreed10@us.ibm.com>, Nate Straz <nate@refried.org>,
Paul Larson <paul.larson@ubuntu.com>,
Manoj Iyer <manoj.iyer@ubuntu.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>
Subject: [LTP] [PATCH 02/02] Script that will actually create the COMMAND File entries
Date: Mon, 24 Aug 2009 15:02:54 +0530 [thread overview]
Message-ID: <20090824093253.31997.86880.sendpatchset@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <20090824093204.31997.18175.sendpatchset@subratamodak.linux.ibm.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5557 bytes --]
This is again a simple perl file which takes the temporary COMMAND file generated
by "runltp", parses it one line by line, and then recreates single or multiple
entries which will contain instruction for "cmdline" to invoke the "Valgrind"
tool in it�� various forms:
1) Full "Memory Leak Check",
2) Full "Thread Concurrency Check",
3) Both the above,
This has been written(code reused) from the "create_kernel_faults_in_loops_and_probability.pl",
and works on the similar logic for creating "cmdline" entries in the temporary
COMMAND file generated. Now, this increases Garrett�� work again as he hates perl.
I hope he will agree to work on this to convert to Shell Script ;-)
Signed-off-by: Subrata Modak<subrata@linux.vnet.ibm.com>
---
--- ltp-full-20090731.orig/tools/create_valgrind_check.pl 1970-01-01 05:30:00.000000000 +0530
+++ ltp-full-20090731/tools/create_valgrind_check.pl 2009-08-24 12:08:08.000000000 +0530
@@ -0,0 +1,106 @@
+#!/usr/bin/perl
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2009 ##
+## ##
+## This program is free software; you can redistribute it and/or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
+## ##
+################################################################################
+# ##
+# File : create_valgrind_check ##
+# ##
+# Usage: create_valgrind_check\ ##
+# <LTP_COMMAND_FILE> <VALGRIND_CHECK_TYPE> ##
+# ##
+# Description: This is a simple perl script which will take ltp command file ##
+# as input and then create a final command file while will have ##
+# the following entries for each test tag: ##
+# 1) <tag_name> <test_binary_name> ##
+# 2) <tag_name_valgrind_check_type> <valgrind test_binary_name> ##
+# ##
+# Author: Subrata Modak <subrata@linux.vnet.ibm.com> ##
+# ##
+# History: Aug 23 2009 - Created - Subrata Modak. ##
+################################################################################
+
+my $command_file = shift (@ARGV) || syntax();
+my $valgrind_check_type = shift (@ARGV) || syntax();
+
+sub syntax() {
+ print "syntax: create_valgrind_check\
+ <LTP_COMMAND_FILE> <VALGRIND_CHECK_TYPE>\n";
+ exit (1);
+}
+
+sub print_memory_leak_check {
+ $sub_line = shift;
+ @sub_tag_and_actual_command = split(/\ /, $sub_line);
+ my $sub_token_counter = 0;
+ foreach my $sub_token (@sub_tag_and_actual_command) {
+ if ($sub_token_counter == 0 ) {#print the tagname now
+ print $sub_token . "_valgrind_memory_leak_check " .
+ " valgrind -q --leak-check=full --trace-children=yes ";
+ $sub_token_counter++;
+ next;
+ }
+ print " " . $sub_token . " ";
+ }
+ print "\n";
+}
+
+sub print_thread_concurrency_check {
+ $sub_line = shift;
+ @sub_tag_and_actual_command = split(/\ /, $sub_line);
+ my $sub_token_counter = 0;
+ foreach my $sub_token (@sub_tag_and_actual_command) {
+ if ($sub_token_counter == 0 ) {#print the tagname now
+ print $sub_token . "_valgrind_thread_concurrency_check " .
+ " valgrind -q --tool=helgrind --trace-children=yes ";
+ $sub_token_counter++;
+ next;
+ }
+ print " " . $sub_token . " ";
+ }
+ print "\n";
+}
+
+open (FILE, $command_file) || die "Cannot open file: $command_file\n";
+while ($line = <FILE>) {
+ if ($line =~ /^#/) {
+ print "$line";
+ next;
+ }
+ if ($line =~ /^\n$/) {
+ next;
+ }
+ chomp $line;
+ print "$line\n"; #Print one instance for normal execution
+
+ if ($valgrind_check_type == 3) {
+ #Print for both Memory Leak and Thread Concurrency Checks
+ print_memory_leak_check($line);
+ print_thread_concurrency_check($line);
+ }
+ if ($valgrind_check_type == 2) {
+ #Print only for Thread concurrency Check
+ print_thread_concurrency_check($line);
+ }
+ if ($valgrind_check_type == 1) {
+ #Print only for Memory leak Check
+ print_memory_leak_check($line);
+ }
+}
+close (FILE);
+
---
Regards--
Subrata
[-- Attachment #2: Type: text/plain, Size: 355 bytes --]
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2009-08-24 9:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-24 9:32 [LTP] [PATCH 00/02] Integrate Valgrind Memory Check Tool to LTP Subrata Modak
2009-08-24 9:32 ` [LTP] [PATCH 01/02] Create the necessary Interface with runltp Subrata Modak
2009-08-24 9:32 ` Subrata Modak [this message]
2009-08-24 9:33 ` [LTP] [RESULTS] The Actual results of the tests run with the new interface Subrata Modak
2009-08-24 12:47 ` [LTP] [PATCH 00/02] Integrate Valgrind Memory Check Tool to LTP Paul Larson
2009-08-25 10:12 ` Subrata Modak
2009-08-25 21:22 ` Paul Larson
2009-08-26 2:09 ` Garrett Cooper
2009-08-26 7:11 ` Subrata Modak
2009-08-26 7:11 ` Subrata Modak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090824093253.31997.86880.sendpatchset@subratamodak.linux.ibm.com \
--to=subrata@linux.vnet.ibm.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=manoj.iyer@ubuntu.com \
--cc=mreed10@us.ibm.com \
--cc=nate@refried.org \
--cc=paul.larson@ubuntu.com \
--cc=sachinp@linux.vnet.ibm.com \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox