public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: cagney@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Allow << ./TestRunner frysk.config >>
Date: Thu, 17 Apr 2008 01:28:00 -0000	[thread overview]
Message-ID: <20080417012834.3081.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  0ed6ec301f2086eaf9f88b8f16a7f36191616875 (commit)
      from  85a1a3630fbe5c7ce5f5f2dfd9d1b01f6d32f2cb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 0ed6ec301f2086eaf9f88b8f16a7f36191616875
Author: Andrew Cagney <cagney@redhat.com>
Date:   Wed Apr 16 21:24:25 2008 -0400

    Allow << ./TestRunner frysk.config >>
    
    frysk-sys/frysk/junit/ChangeLog
    2008-04-16  Andrew Cagney  <cagney@redhat.com>
    
    	* Runner.java: Match partial class names.

-----------------------------------------------------------------------

Summary of changes:
 frysk-sys/frysk/junit/ChangeLog   |    4 ++
 frysk-sys/frysk/junit/Runner.java |   74 +++++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 35 deletions(-)

First 500 lines of diff:
diff --git a/frysk-sys/frysk/junit/ChangeLog b/frysk-sys/frysk/junit/ChangeLog
index 11f1a89..f382888 100644
--- a/frysk-sys/frysk/junit/ChangeLog
+++ b/frysk-sys/frysk/junit/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-16  Andrew Cagney  <cagney@redhat.com>
+
+	* Runner.java: Match partial class names.
+
 2008-04-15  Andrew Cagney  <cagney@redhat.com>
 
 	* Runner.java: Use Prefix and PrefixFactory.
diff --git a/frysk-sys/frysk/junit/Runner.java b/frysk-sys/frysk/junit/Runner.java
index 96023d6..49ade26 100755
--- a/frysk-sys/frysk/junit/Runner.java
+++ b/frysk-sys/frysk/junit/Runner.java
@@ -97,63 +97,67 @@ public class Runner extends TestRunner {
       
 	if (otherArgs.size() > 0) {
 	    // Construct the testsuite from the list of names.
-	    Iterator iter = otherArgs.listIterator(0);
-	    while (iter.hasNext()) {
-		String arg = (String) iter.next();
+	    for (Iterator argIter = otherArgs.listIterator(0);
+		 argIter.hasNext(); ) {
+		String arg = (String)argIter.next();
 		if (arg.charAt(0) == '-') {
 		    this.repeatValue = - Integer.parseInt(arg);
 		} else {
 		    int lidot = arg.lastIndexOf('.');
 		    String testName = null;
-		    String testCaseName = null;
+		    String testClass = null;
 		    if (arg.substring(lidot + 1).startsWith("test")) {
-			testCaseName = arg.substring(0, lidot);
+			testClass = arg.substring(0, lidot);
 			testName = arg.substring(lidot + 1);
 		    } else if (arg.matches("test.*\\(.*\\)")) {
 			String[] testTuple = arg.split("[\\(\\)]");
 			testName = testTuple[0];
-			testCaseName = testTuple[1];
+			testClass = testTuple[1];
 		    } else {
-			testCaseName = arg;
+			testClass = arg;
 		    }
 		    
-		    try {
+		    for (Iterator classIter = testClasses.iterator();
+			 classIter.hasNext (); ) {
+			Class testKlass = (Class)classIter.next ();
 			if (testName == null) {
-			    testSuite.addTest(getTest(testCaseName));
+			    // class only
+			    if (testKlass.getName().startsWith(testClass)) {
+				testSuite.addTest(new TestSuite(testKlass));
+			    }
 			} else {
-			    Class klass = loadSuiteClass(testCaseName);
-			    TestCase test = (TestCase) klass.newInstance();
-			    
-			    //Check if the method exists.
-			    klass.getMethod(testName, null);
-			    
-			    test.setName(testName);
-			    testSuite.addTest(test);
+			    // class.name or name(class)
+			    if (testKlass.getName().equals(testClass)) {
+				try {
+				    // Probe the class to see if the
+				    // method exists.
+				    testKlass.getMethod(testName, null);
+				    TestCase test = (TestCase)testKlass.newInstance();
+				    test.setName(testName);
+				    testSuite.addTest(test);
+				} catch (NoSuchMethodException e) {
+				    System.out.println("Couldn't find test method: " + testClass + "." + testName);
+				} catch (InstantiationException e) {
+				    System.out.println("Couldn't instantiate class with name: "
+						       + testClass);
+				} catch (IllegalAccessException e) {
+				    System.out.println("Couldn't access class with name: "
+						       + testClass);
+				}
+			    }
 			}
-		    } catch (NoSuchMethodException e) {
-			System.out.println("Couldn't find method with name: "
-					   + testName);
-		    } catch (ClassNotFoundException e) {
-			System.out.println("Couldn't find class with name: "
-					   + testCaseName);
-		    } catch (InstantiationException e) {
-			System.out.println("Couldn't instantiate class with name: "
-					   + testCaseName);
-		    } catch (IllegalAccessException e) {
-			System.out.println("Couldn't access class with name: "
-					   + testCaseName);
 		    }
 		}
 	    }
 	} else {
 	    for (Iterator i = testClasses.iterator (); i.hasNext (); ) {
-		Class testClass = (Class) i.next ();
+		Class testKlass = (Class) i.next ();
 		// Only include tests that gets by both filters.
-		if (testClass.getName ().matches (testFilter)) {
+		if (testKlass.getName ().matches (testFilter)) {
 		    boolean addit = true;
 		    for (int j = 0; j < excludeTests.size(); j++) {
 			try {
-			    if (testClass.getName ()
+			    if (testKlass.getName ()
 				.matches ((String)excludeTests.get (j))) {
 				addit = false;
 				break;
@@ -165,7 +169,7 @@ public class Runner extends TestRunner {
 		    if (!addit) {
 			for (int j = 0; j < includeTests.size(); j++) {
 			    try {
-				if (testClass.getName ()
+				if (testKlass.getName ()
 				    .matches ((String)includeTests.get (j))) {
 				    addit = true;
 				    break;
@@ -176,9 +180,9 @@ public class Runner extends TestRunner {
 			}
 		    }
 		    if (addit) {
-			testSuite.addTest (new TestSuite (testClass));
+			testSuite.addTest (new TestSuite (testKlass));
 		    } else {
-			System.out.println ("Omitting " + testClass.getName());
+			System.out.println ("Omitting " + testKlass.getName());
 		    }
 		}
 	    }


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-04-17  1:28 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=20080417012834.3081.qmail@sourceware.org \
    --to=cagney@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).