All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Rabin Vincent <rabin@rab.in>
Subject: [PATCH][GIT PULL] ktest: Check parent options for iterated tests
Date: Fri, 18 Nov 2011 11:36:36 -0500	[thread overview]
Message-ID: <1321634196.3533.55.camel@frodo> (raw)

[-- Attachment #1: Type: text/plain, Size: 2427 bytes --]


Linus,

This patch includes a bug fix for ktest. And also proves that ktest has
at least 3 users! 

Please pull the latest for-linus tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git
for-linus

Head SHA1: f9dfb65b055c56678afa03e13e942761459ea53d


Rabin Vincent (1):
      ktest: Check parent options for iterated tests

----
 tools/testing/ktest/ktest.pl |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---------------------------
commit f9dfb65b055c56678afa03e13e942761459ea53d
Author: Rabin Vincent <rabin@rab.in>
Date:   Fri Nov 18 17:05:30 2011 +0530

    ktest: Check parent options for iterated tests
    
    Let's say we have "OUTPUT_DIR = build/${TEST_NAME}", and we're iterating
    a test.  In the second iteration of a test, the TEST_NAME of the test
    we're repeating is not used.  Instead, ${TEST_NAME} appears literally:
    
       touch /home/rabin/kernel/test/build/${TEST_NAME}/.config ... SUCCESS
    
    Fix this by making __eval_option() check the parent test options
    for a repeated test.
    
    Link: http://lkml.kernel.org/r/1321616131-21352-2-git-send-email-rabin@rab.in
    
    Signed-off-by: Rabin Vincent <rabin@rab.in>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 30e2bef..8b4c253 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -747,6 +747,18 @@ sub __eval_option {
     # Add space to evaluate the character before $
     $option = " $option";
     my $retval = "";
+    my $repeated = 0;
+    my $parent = 0;
+
+    foreach my $test (keys %repeat_tests) {
+	if ($i >= $test &&
+	    $i < $test + $repeat_tests{$test}) {
+
+	    $repeated = 1;
+	    $parent = $test;
+	    last;
+	}
+    }
 
     while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) {
 	my $start = $1;
@@ -760,10 +772,14 @@ sub __eval_option {
 	# otherwise see if the default OPT (without [$i]) exists.
 
 	my $o = "$var\[$i\]";
+	my $parento = "$var\[$parent\]";
 
 	if (defined($opt{$o})) {
 	    $o = $opt{$o};
 	    $retval = "$retval$o";
+	} elsif ($repeated && defined($opt{$parento})) {
+	    $o = $opt{$parento};
+	    $retval = "$retval$o";
 	} elsif (defined($opt{$var})) {
 	    $o = $opt{$var};
 	    $retval = "$retval$o";



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

                 reply	other threads:[~2011-11-18 16:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1321634196.3533.55.camel@frodo \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rabin@rab.in \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.