This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Two patches to add bi-arch test in frysk.


On Tue, 2006-09-19 at 20:07 +0800, Yong Zheng wrote:
> On Wed, 2006-09-13 at 14:02 -0400, Andrew Cagney wrote:
> 
> The patches to add bi-arch test in frysk is blocking by some problems
> found in PPC64. After we do some modifications on the patches, we will
> post them out again. Sorry for that!

Based on the previous two patches post, we do some modifications and now
post out the latest patches to add bi-arch test in frysk.  The main
modifications are focused on how to filter the "-m64" option in PPC64. 

Our first try is to intent to specify "-m64" as CFLAGS and then filter
it when compiling and linking but fail. 

The second try is to filter the COMPILE and LINK which carry "-m64" in
PPC64. It's just for this that we have to generate all rules for arch32
target in Makefile.gen.sh. Please review the attached patches for
details.

Now, the patches work well in X86/X86_64/PPC64 based on the cvs
head(09-20). But it has the following disadvantages:

After applying the pathes, automake will generate some garbage rules in
Makefile.in, which will be commented in Makefile on X86_64/PPC64 but
will be passed into Makefile in X86 after running configure script. Of
course, the garbage rules will influence nothing.

After applying the patches and building frysk, you can run the following
command to do bi-arch test(in fact, it's just do arch 32 test on
X86_64/PPC64 now):

	./TestRunner --help # output the usage info of TestRunner
	./TestRunner        # do what it used to do
	./TestRunner --arch=<64|32> # run the 64-bit or 32-bit cases.

After you install the frysk, you can run the test through funit with the
similar commands as the above.

2006-09-20  Yong Zheng  <zhengyo@cn.ibm.com>

        * common/acinclude.m4: Call FRYSK_DO_BIARCH_TEST. 
        * common/Makefile.gen.sh: (echo_biarch_PROGRAMS): Output of
        rules for bi-arch test.
        * common/Makefile.rules (pkglibexec_biarch_PROGRAMS,
        pkglibexec_biarchdir): Define. 
        * common/TestRunner.javain: Refactor to suport bi-arch test.
        * common/m4/frysk-do-biarch-test.m4: New file, defines
        FRYSK_DO_BIARCH_TEST.

        * frysk-imports/frysk/Config.javain (PKGLIBEXEC_BIARCHDIR):
        Add. 
        * frysk-core/frysk/pkglibexecdir/funit.java (main): Add support
        for bi-arch test.
        * frysk-imports/frysk/ju0nit/Runner.java (repeatValue,
        justBiarchTest, includingBiarchTest, testCases, parser): New.
        (usage): New method.
        (setTestCases, GetTestCases): New methods.
	(setBuildArch, GetBuildArch): New methods.
        (runArchCases): New method.
        (runArch32Cases): New method.
        (Runner): Refactor to support bi-arch test.
	* frysk-core/Makefile.am: Add rules for funit-child-alias.
	* frysk-core/frysk/pkglibexecdir/funit.xml: Update the --arch
	option info.
		
Please reivew. And any comments are welcome!
ok to commit? 

Best regards
Yong Zheng

--- /dev/null	2006-09-14 10:36:20.509523000 +0800
+++ common/m4/frysk_do_arch32_test.m4	2006-09-19 10:52:11.000000000 +0800
@@ -0,0 +1,48 @@
+# This file is part of the program FRYSK.
+#
+# Copyright 2006, IBM Co.
+#
+# FRYSK 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; version 2 of the License.
+#
+# FRYSK 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 FRYSK; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+#
+# In addition, as a special exception, Red Hat, Inc. gives You the
+# additional right to link the code of FRYSK with code not covered
+# under the GNU General Public License ("Non-GPL Code") and to
+# distribute linked combinations including the two, subject to the
+# limitations in this paragraph. Non-GPL Code permitted under this
+# exception must only link to the code of FRYSK through those well
+# defined interfaces identified in the file named EXCEPTION found in
+# the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline
+# functions from the Approved Interfaces without causing the
+# resulting work to be covered by the GNU General Public
+# License. Only Red Hat, Inc. may make changes or additions to the
+# list of Approved Interfaces. You must obey the GNU General Public
+# License in all respects for all of the FRYSK code and other code
+# used in conjunction with FRYSK except the Non-GPL Code covered by
+# this exception. If you modify this file, you may extend this
+# exception to your version of the file, but you are not obligated to
+# do so. If you do not wish to provide this exception without
+# modification, you must delete this exception statement from your
+# version and license this file solely under the GPL without
+# exception.
+
+AC_DEFUN([FRYSK_DO_ARCH32_TEST], [
+AC_REQUIRE([AC_CANONICAL_TARGET])
+case $target_cpu in
+x86_64|powerpc64|ppc64)
+	do_arch32_test=yes;;
+*)	do_arch32_test=no;;
+esac
+AM_CONDITIONAL([DO_ARCH32_TEST], [test $do_arch32_test = yes])
+])
Index: common/acinclude.m4
===================================================================
RCS file: /cvs/frysk/frysk-common/acinclude.m4,v
retrieving revision 1.52
diff -u -r1.52 acinclude.m4
--- common/acinclude.m4	30 Jun 2006 17:04:58 -0000	1.52
+++ common/acinclude.m4	20 Sep 2006 08:30:45 -0000
@@ -133,3 +133,5 @@
 test $UUDECODE = no && AC_ERROR([no uudecode program found, please install sharutils package])
 
 FRYSK_USE_LIBUNWIND
+
+FRYSK_DO_ARCH32_TEST
Index: common/Makefile.rules
===================================================================
RCS file: /cvs/frysk/frysk-common/Makefile.rules,v
retrieving revision 1.133
diff -u -r1.133 Makefile.rules
--- common/Makefile.rules	11 Sep 2006 20:54:45 -0000	1.133
+++ common/Makefile.rules	20 Sep 2006 08:33:09 -0000
@@ -51,6 +51,10 @@
 libexec_PROGRAMS =
 pkglibexec_PROGRAMS =
 pkglibexecdir = $(libexecdir)/@PACKAGE@
+
+pkglibexec_arch32_PROGRAMS =
+pkglibexec_arch32dir = $(pkglibexecdir)/arch32
+
 noinst_LIBRARIES =
 man_MANS =
 LDADD = 
@@ -227,6 +231,7 @@
 		-e 's,[@]pkglibdir[@],$(pkglibdir),g' \
 		-e 's,[@]pkgincludedir[@],$(pkgincludedir),g' \
 		-e 's,[@]pkglibexecdir[@],$(pkglibexecdir),g' \
+		-e 's,[@]pkglibexec_arch32dir[@],$(pkglibexec_arch32dir),g' \
 		-e 's,[@]GEN_PACKAGENAME[@],$(GEN_PACKAGENAME),g' \
 		-e 's,[@]VERSION[@],$(VERSION),g' \
 		-e 's,[@]target_cpu[@],@target_cpu@,g'
Index: common/TestRunner.javain
===================================================================
RCS file: /cvs/frysk/frysk-common/TestRunner.javain,v
retrieving revision 1.8
diff -u -r1.8 TestRunner.javain
--- common/TestRunner.javain	6 Feb 2006 05:58:01 -0000	1.8
+++ common/TestRunner.javain	20 Sep 2006 08:38:01 -0000
@@ -49,10 +49,19 @@
  */
 
 public class TestRunner
-{
+{    
     public static void main (String[] args)
     {
+	Runner testRunner = new Runner (args);
+
+        testRunner.setBuildArch(Build.BUILD_ARCH);
+	
+	// Set the execPrefix path and then do the common test.
 	Paths.setExecPrefix (Build.ABS_BUILDDIR + "/frysk/pkglibexecdir/");
-	new Runner (args, JUnitTests.get ());
+	testRunner.runArchCases(JUnitTests.get ());
+	
+	// Set the execPrefix of arch32 and then do the arch32 test.
+	Paths.setExecPrefix(Build.ABS_BUILDDIR + "/frysk/pkglibexecdir/arch32/");
+	testRunner.runArch32Cases(JUnitTests.get ());
     }
 }
--- common/Makefile.gen.sh	2006-09-19 13:36:34.000000000 +0800
+++ common/Makefile.gen.sh.edited	2006-09-20 17:42:08.000000000 +0800
@@ -140,6 +140,71 @@
     esac
 }
 
+echo_arch32_COMPILER()
+{
+	echo "if DO_ARCH32_TEST"
+	echo "ARCH32_COMPILE=\$(CC) \$(DEFAULT_INCLUDES) \$(INCLUDES) \
+	      \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)"
+	echo "endif"
+}
+
+# usage:
+#	echo_arch32_PROGRAMS ${name} ${file} $(COMPILE_CMD) ${arch32_cflag_name}
+echo_arch32_PROGRAMS()
+{
+    case "$1" in
+        *dir/* )
+            # extract the directory prefix
+            local dir=`echo /"$1" | sed -e 's,.*/\([a-z]*\)dir/.*,\1,'`
+
+	    local dname=`dirname $1`
+		
+	    dname=`dirname ${dname}`
+	    if [ "${dir}" = "pkglibexec" ] && [ "${dname}" = "frysk" ]; then
+		local file="$2"
+		local dir_name=`dirname $1`
+		local base_name=`basename $1`
+		local name="${dir_name}/arch32/${base_name}"
+
+		local name_=`echo ${name} | sed -e 'y,/-,__,'`
+		local ldflags="${name_}_LDFLAGS = -m32 -g"
+		
+		local compiler="$3"
+		local cflag="$4"
+
+		echo 
+		echo "if DO_ARCH32_TEST"
+		echo "${name_}_SOURCES = ${file}"
+		echo "am_${name_}_OBJECTS = ${dir_name}/arch32/${base_name}.\$(OBJEXT)"
+		echo "${ldflags}"
+
+           	test ${suffix} = .cxx && echo "${name_}_LINK = \$(CXXLINK)"
+
+cat <<EOF
+${dir_name}/arch32/${base_name}.\$(OBJEXT): \$(${name_}_SOURCES) frysk/pkglibexecdir/arch32/\$(am__dirstamp)
+	@ARCH32_COMPILE=\`echo "\$(${compiler}) " | sed -e 's, -m64 , ,g'\`; \\
+	\$\$ARCH32_COMPILE \$(${cflag}) -c -o \$@ $<
+
+${dir_name}/arch32/${base_name}\$(EXEEXT): \$(${name_}_OBJECTS) \$(${name_}_DEPENDENCIES) ${dir_name}/arch32/\$(am__dirstamp)
+	@rm -f \$@
+	@ARCH32_LINK=\`echo "\$(LINK) " | sed -e 's, -m64 , ,g'\`; \\
+	\$\$ARCH32_LINK \$(${name_}_LDFLAGS) \$(${name_}_OBJECTS) \$(${name_}_LDADD) \$(LIBS)
+EOF
+	
+            	echo "${dir}_arch32_PROGRAMS += ${dir_name}/arch32/${base_name}"
+
+		if grep pthread.h ${file} > /dev/null 2>&1 ; then
+                    echo "${name_}_LDADD = -lpthread"
+           	fi
+		echo "endif"
+		echo
+	    fi
+            ;;
+        * )
+            ;;
+    esac
+}
+
 # Convert path to the automake equivalent (/ replaced with _).
 echo_name_ ()
 {
@@ -377,6 +442,12 @@
     done
 done
 
+# output the compile for arch32
+echo_arch32_COMPILER
+
+# the flag for output of arch32 test's CFLAGS
+arch32_cflags_output=0
+
 for suffix in .cxx .c .hxx ; do
     print_header "... ${suffix}"
     find ${dirs} \
@@ -394,6 +465,19 @@
 	    if grep pthread.h ${file} > /dev/null 2>&1 ; then
 		echo "${name_}_LDADD = -lpthread"
 	    fi
+
+           # Generate the rules for arch32 test
+           if [ $arch32_cflags_output -eq 0 ]; then
+               echo "if DO_ARCH32_TEST"
+               arch32_path="${d}/arch32"
+               arch32_cflag_name=`echo ${arch32_path}_CFLAGS | sed -e 'y,/-,__,'`
+               echo "${arch32_cflag_name}=-m32 -g"
+               echo "endif"
+           fi
+
+           echo_arch32_PROGRAMS ${name} ${file} "ARCH32_COMPILE" ${arch32_cflag_name}
+           arch32_cflags_output=1
+
 	else
 	    echo "${sources} += ${file}"
 	fi
@@ -415,6 +499,18 @@
 	
 	echo "${name_}_SOURCES = ${file}"
 	echo_PROGRAMS ${name}
+
+	# Generate the rules for arch32 test
+	if [ $arch32_cflags_output -eq 0 ]; then
+	    echo "if DO_ARCH32_TEST"
+	    arch32_path="${d}/arch32"
+	    arch32_as_cflag_name=`echo ${arch32_path}_AS_CFLAGS | sed -e 'y,/-,__,'`
+	    echo "${arch32_as_cflag_name}=-m32 -g"
+	    echo "endif"
+	fi
+
+	echo_arch32_PROGRAMS ${name} ${file} "CCASCOMPILE" ${arch32_as_cflag_name}
+	arch32_cflags_output=1
     done
 done
 
Index: frysk-imports/frysk/Config.javain
===================================================================
RCS file: /cvs/frysk/frysk-imports/frysk/Config.javain,v
retrieving revision 1.9
diff -u -r1.9 Config.javain
--- frysk-imports/frysk/Config.javain	16 Aug 2006 19:09:52 -0000	1.9
+++ frysk-imports/frysk/Config.javain	20 Sep 2006 07:37:27 -0000
@@ -60,6 +60,7 @@
     public static final String PKGLIBEXECDIR = "@pkglibexecdir@";
     public static final String PKGINCLUDEDIR = "@pkgincludedir@";
 
+    public static final String PKGLIBEXEC_ARCH32DIR = "@pkglibexec_arch32dir@";
     public static final String VERSION = "@VERSION@";
 
     // User's config directory.
Index: frysk-imports/frysk/junit/Runner.java
===================================================================
RCS file: /cvs/frysk/frysk-imports/frysk/junit/Runner.java,v
retrieving revision 1.2
diff -u -r1.2 Runner.java
--- frysk-imports/frysk/junit/Runner.java	27 Mar 2006 03:03:46 -0000	1.2
+++ frysk-imports/frysk/junit/Runner.java	20 Sep 2006 08:43:56 -0000
@@ -40,6 +40,7 @@
 package frysk.junit;
 
 import frysk.EventLogger;
+import frysk.imports.Build;
 import jargs.gnu.CmdLineParser;
 import java.io.PrintStream;
 import java.util.Collection;
@@ -63,6 +64,18 @@
     extends TestRunner
 {
     static Logger logger;
+    
+    // Reapeat onece by default.
+    private int repeatValue = 1;
+    private String archTarget = null;
+    private String archBuild = null; 
+    private Collection testCases = null;
+    
+    private CmdLineParser parser = null;
+    
+    public final static String ARCH64 = "64";
+    public final static String ARCH32 = "32";
+    
     /**
      * Overide JUnit's print methods with a version that displays each
      * test as it is run.  Makes tracking down problems when the run
@@ -115,113 +128,289 @@
 	    super (stream);
 	}
     }
+    
+    public static void usage(String message, int exitVal)
+    {
+        System.out.println (message);
+        System.out.println ("Usage: [ -c <console-level> ] [ -l <log-level> ]" +
+			    " [ -r <repeat-count> ] [--arch <arch>] [ class ... ]");
+        System.out.println ("Options: ");
+        System.out.println ("         -c <console-level>");
+        System.out.println ("            Set the console level. The console-level"+
+			    " can be [ OFF | SEVERE | WARNING |"); 
+        System.out.println ("            INFO | CONFIG | FINE | FINER | FINEST].");
+        System.out.println ("         -l <log-level>");
+        System.out.println ("            Set the log level. The log-level can be " +
+			    "[ OFF | SEVERE | WARNING | INFO |"); 
+        System.out.println ("            CONFIG | FINE | FINER | FINEST].");
+        System.out.println ("         -r <repeat-count>");
+        System.out.println ("            Set the count of repeating the test.");
+        System.out.println ("         --arch=<ARCH>");
+        System.out.println ("            Set the target arch whose test cases " + 
+			    "will be running. <ARCH> can be 64 or 32. ");
+        System.out.println ("            If no any arch is set, the arch-64 " + 
+			    "cases will be run.");
+        System.out.println ("            All arch-64 and arch-32 cases will be"+
+			    " run when arch-32 is ready. The --arch option ");
+        System.out.println ("            will take no effect on 32-bit machines.");
+       
+        System.exit (exitVal);
+    }
+
+    public void setTestCases(Collection testCases)
+    {
+      this.testCases = testCases;
+    }
+    
+    public Collection getTestCases()
+    {
+      return this.testCases;
+    }
+   
+    public void setBuildArch(String buildArch)
+    {
+      this.archBuild = buildArch;
+    }
+    public String getBuildArch()
+    {
+      return this.archBuild;
+    }
 
+    private int runCases(Collection testClasses)
+    {
+      // Create the testsuite to be run, either as specified on the
+      // command line, or from the provided list of classes.  XXX:
+      // It would be good if individual tests from within a testcase
+      // could be identified and run.
+      String[] otherArgs = parser.getRemainingArgs ();
+      
+      TestSuite testSuite = new TestSuite ();
+      
+      if (otherArgs.length > 0)
+      {
+	// Construct the testsuite from the list of names.
+	for (int i = 0; i < otherArgs.length; i++)
+          {
+            if (otherArgs[i].charAt (0) == '-')
+              this.repeatValue = -Integer.parseInt (otherArgs[i]);
+            else
+              testSuite.addTest (getTest (otherArgs[i]));
+            }
+          }
+      else
+      {
+        for (Iterator i = testClasses.iterator (); i.hasNext (); )
+          {
+            Class testClass = (Class) i.next ();
+            testSuite.addTest (new TestSuite (testClass));
+          }
+      }
+  
+      // Run the TestSuite <<repeat>> times.
+      try
+        {
+          for (int i = 0; i < this.repeatValue; i++)
+            {
+              TestResult testResult = doRun (testSuite);
+              
+              if (!testResult.wasSuccessful()) 
+                return FAILURE_EXIT;
+            }
+        }
+      catch(Exception e)
+        {
+          System.err.println(e.getMessage());
+          
+          return EXCEPTION_EXIT;
+        }
+      
+      return SUCCESS_EXIT;      
+    }
+    
+    /**
+     * Run the testcases carried by testClasses.
+     * 
+     * @param testClasses
+     * @return int the value of exit.
+     */
+    public int runArchCases(Collection testClasses)
+    {
+      // Check whether we should continue.
+      if ((null != this.archTarget) &&
+          (false == this.archTarget.equals(Runner.ARCH64)))
+        return SUCCESS_EXIT;
+     
+      boolean testArch64 = false;
+      
+      if (null == this.archBuild)
+        this.archBuild = Build.BUILD_ARCH;
+
+      // Check whether --arch=64 is given on 32-bit machine.
+      if (archBuild.equalsIgnoreCase("x86_64") ||
+          archBuild.equalsIgnoreCase("ppc64") ||
+          archBuild.equalsIgnoreCase("powerpc64"))
+      {
+        testArch64 = true;
+      }
+
+      if ((null != this.archTarget) && 
+          (false == testArch64))
+      {
+        System.out.println ("It's unsupported "+
+                            "to do arch test in " + archBuild +". ");
+        System.out.println ("Please try without --arch option! Exit...");
+        System.exit (SUCCESS_EXIT);
+      }
+ 
+      return this.runCases(testClasses);
+    }
+    
+    /**
+     * Run bi-arch test when the "-i" or "-b" option is given.
+     * When doing bi-arch test, all cases are the same as the 
+     * common test except for the execPrefix path. So after the 
+     * correct execPrefix is set before calling this function
+     * in frysk.junit.Paths, we do the same procedures as the doRunner().
+     * 
+     * @param testClasses
+     * @return
+     * @see frysk.junit.Paths
+     */
+    public int runArch32Cases(Collection testClasses)
+    {
+      //XXX: if all 32-bit cases pass, we should comment 
+      //the following instruction.
+      if (null == this.archTarget)
+        return SUCCESS_EXIT;
+      
+      boolean testArch32 = false;
+
+      if (null == this.archBuild)
+        this.archBuild = Build.BUILD_ARCH;
+
+      if (archBuild.equalsIgnoreCase("x86_64") || 
+	  archBuild.equalsIgnoreCase("ppc64") || 
+          archBuild.equalsIgnoreCase("powerpc64"))
+      {
+        testArch32 = true;
+      }
+	  
+      if (false == testArch32)
+      {
+        System.out.println("It's unnecessary or unsupported "+ 
+                           "to do arch test in " + archBuild +". Exit...");
+        System.exit (SUCCESS_EXIT);
+      }
+      else if (false == this.archTarget.equals(Runner.ARCH32))
+        return SUCCESS_EXIT;
+      
+      /**
+       * Output some prompt message when we run both 64-bit and 32-bit cases.
+       */
+      if (null == this.archTarget)
+      {
+        System.out.println("+====================================================+");
+        System.out.println("|                                                    |");
+        System.out.println("|            The following is Biarch Test            |");
+        System.out.println("|                                                    |");
+        System.out.println("+====================================================+");
+      }
+      
+      return this.runCases(testClasses);
+    }
+    
     /**
      * Create a JUnit TestRunner, using command-line arguments args,
      * and the supplied testClasses.
      */
-    public Runner (String[] args, Collection testClasses)
+    public Runner (String[] args)
     {
 	// Override the print methods.
 	super (new Results (System.out));
 
 	// Create the command line parser, and use it to parse all
 	// command line options.
-	CmdLineParser parser = new CmdLineParser ();
+	parser = new CmdLineParser ();
+    
 	CmdLineParser.Option levelOption
 	    = parser.addStringOption ('l', "level");
 	CmdLineParser.Option consoleOption
 	    = parser.addStringOption ('c', "console");
 	CmdLineParser.Option repeatOption
 	    = parser.addIntegerOption ('r', "repeat");
-	try {
+    
+	CmdLineParser.Option archTestOption
+	    = parser.addStringOption("arch");
+    
+	try
+	  {
 	    parser.parse(args);
-	}
-	catch (CmdLineParser.OptionException e) {
-	    System.out.println (e.getMessage());
-	    System.out.println ("Usage: [ -c <console-level> ] [ -l <log-level> ] [ -r <repeat-count> ] [ class ... ]");
-	    System.exit (FAILURE_EXIT);
-	}
+	  }
+	catch (CmdLineParser.OptionException e)
+	  {
+	    Runner.usage(e.getMessage(), FAILURE_EXIT);
+	  }
 
+	Object archObj = parser.getOptionValue (archTestOption);
+	if (null != archObj)
+        {
+          if ((true == archObj.equals(Runner.ARCH32)) ||
+              (true == archObj.equals(Runner.ARCH64)))
+            this.archTarget = (String)archObj;
+          else
+            Runner.usage("Invalid arch value: <" + archObj + ">", FAILURE_EXIT);
+        }
+    
 	// Create the file logger, and then set it's level to that
 	// specified on the command line.
 	logger = EventLogger.get ("logs/", "frysk_core_event.log");
 	String levelValue = (String) parser.getOptionValue (levelOption);
-	if (levelValue != null) {
-	    Level level = null;
-	    try {
-		level = Level.parse (levelValue);
-	    }
-	    catch (IllegalArgumentException e) {
-		System.out.println ("Invalid log level: " + levelValue);
-		System.exit (FAILURE_EXIT);
-	    }
-	    logger.setLevel (level);
+	if (levelValue != null)
+	{
+	  Level level = null;
+	  try
+            {
+              level = Level.parse (levelValue);
+            }
+	  catch (IllegalArgumentException e)
+            {
+              Runner.usage("Invalid log level: " + levelValue, FAILURE_EXIT);
+            }
+	  logger.setLevel (level);
 	}
 
 	// Need to set both the console and the main logger as
 	// otherwize the console won't see the log messages.
 	String consoleValue = (String) parser.getOptionValue (consoleOption);
-	if (consoleValue != null) {
-	    Level consoleLevel = null;
-	    try {
-		consoleLevel = Level.parse (consoleValue);
-	    }
-	    catch (IllegalArgumentException e) {
-		System.out.println ("Invalid log console: " + consoleValue);
-		System.exit (FAILURE_EXIT);
-	    }
-	    System.out.println ("console " + consoleLevel);
-	    Handler consoleHandler = new ConsoleHandler ();
-	    consoleHandler.setLevel (consoleLevel);
-	    logger.addHandler (consoleHandler);
-	    logger.setLevel (consoleLevel);
-	    System.out.println (consoleHandler);
+	if (consoleValue != null)
+	{
+	  Level consoleLevel = null;
+	  try
+            {
+	      consoleLevel = Level.parse (consoleValue);
+            }
+	  catch (IllegalArgumentException e)
+            {
+              Runner.usage("Invalid log console: " + 
+			   consoleValue, FAILURE_EXIT);
+            }
+        
+	   System.out.println ("console " + consoleLevel);
+	   Handler consoleHandler = new ConsoleHandler ();
+	   consoleHandler.setLevel (consoleLevel);
+	   logger.addHandler (consoleHandler);
+	   logger.setLevel (consoleLevel);
+	   System.out.println (consoleHandler);
 	}
 
 	// Determine the number of times that the testsuite should be
 	// run.
+	int repeats = 1;
 	Integer repeatValue = (Integer) parser.getOptionValue (repeatOption);
-        int repeats = 1;
-	if (repeatValue != null) {
-	    repeats = repeatValue.intValue ();
-	}
-
-	// Create the testsuite to be run, either as specified on the
-	// command line, or from the provided list of classes.  XXX:
-	// It would be good if individual tests from within a testcase
-	// could be identified and run.
-	String[] otherArgs = parser.getRemainingArgs ();
-        TestSuite testSuite = new TestSuite ();
-        if (otherArgs.length > 0) {
-	    // Construct the testsuite from the list of names.
-            for (int i = 0; i < otherArgs.length; i++) {
-                if (otherArgs[i].charAt (0) == '-')
-		    repeats = -Integer.parseInt (otherArgs[i]);
-                else
-                    testSuite.addTest (getTest (otherArgs[i]));
-            }
-        }
-        else {
-	    for (Iterator i = testClasses.iterator (); i.hasNext (); ) {
-		Class testClass = (Class) i.next ();
-                testSuite.addTest (new TestSuite (testClass));
-	    }
-
-        }
-
-	// Run the TestSuite <<repeat>> times.
-        try {
-	    for (int i = 0; i < repeats; i++) {
-	        TestResult testResult = doRun (testSuite);
-	        if (!testResult.wasSuccessful()) 
-		    System.exit (FAILURE_EXIT);
-            }
-	} catch(Exception e) {
-	    System.err.println(e.getMessage());
-	    System.exit (EXCEPTION_EXIT);
-	}
+    
+	if (repeatValue != null)
+          repeats = repeatValue.intValue ();
 
-	System.exit (SUCCESS_EXIT);
+	this.repeatValue = repeats;
     }
 }
Index: frysk-core/frysk/pkglibexecdir/funit.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/pkglibexecdir/funit.java,v
retrieving revision 1.4
diff -u -r1.4 funit.java
--- frysk-core/frysk/pkglibexecdir/funit.java	6 Feb 2006 06:17:26 -0000	1.4
+++ frysk-core/frysk/pkglibexecdir/funit.java	20 Sep 2006 08:46:00 -0000
@@ -40,6 +40,9 @@
 import frysk.Config;
 import frysk.junit.Paths;
 import frysk.junit.Runner;
+import frysk.core.Build;
+
+import java.io.File;
 import java.util.LinkedList;
 
 /**
@@ -48,14 +51,27 @@
  */
 
 public class funit
-{
+{  
     public static void main (String[] args)
     {
-	LinkedList list = new LinkedList ();
-	list.addAll (frysk.imports.JUnitTests.get ());
-	list.addAll (frysk.sys.JUnitTests.get ());
-	list.addAll (frysk.core.JUnitTests.get ());
-	Paths.setExecPrefix (Config.PKGLIBEXECDIR + "/");
-	new Runner (args, list);
+      LinkedList list = new LinkedList ();
+      list.addAll (frysk.imports.JUnitTests.get ());
+      list.addAll (frysk.sys.JUnitTests.get ());
+      list.addAll (frysk.core.JUnitTests.get ());
+	
+      Runner testRunner = new Runner (args);   
+      testRunner.setBuildArch(Build.BUILD_ARCH);
+ 
+      // Set the pkglibexec's directroy according to configuration 
+      // and then do the test.
+      Paths.setExecPrefix (Config.PKGLIBEXECDIR + "/");
+      testRunner.runArchCases(list);
+    
+      // It's unnecessary for other modules(such as frysk-import) to 
+      // do arch32 test, so we just add the frysk-core's JUnitTests.
+      LinkedList arch32List = new LinkedList();
+      arch32List.addAll(frysk.core.JUnitTests.get ());
+      Paths.setExecPrefix(Config.PKGLIBEXEC_ARCH32DIR + File.separator);
+      testRunner.runArch32Cases(arch32List);
     }
 }
Index: frysk-core/frysk/pkglibexecdir/funit.xml
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/pkglibexecdir/funit.xml,v
retrieving revision 1.2
diff -u -r1.2 funit.xml
--- frysk-core/frysk/pkglibexecdir/funit.xml	15 Apr 2006 04:10:29 -0000	1.2
+++ frysk-core/frysk/pkglibexecdir/funit.xml	20 Sep 2006 08:46:18 -0000
@@ -78,6 +78,9 @@
         <option>-l <replaceable>log-level</replaceable></option>
       </arg>
       <arg choice="opt">
+        <option>--arch=ARCH<replaceable>ARCH</replaceable></option>
+      </arg>
+      <arg choice="opt">
         <option><replaceable>test-class</replaceable> ...</option>
       </arg>
     </cmdsynopsis>
@@ -105,15 +108,24 @@
 	<term>-c <replaceable>console-log-level</replaceable></term>
 	<listitem>
           <para> Enable logging to the console and at the specified
-          log level.  </para>
+          log level. The log level can be: [ OFF | SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST]. </para>
         </listitem>
       </varlistentry>
       <varlistentry>
 	<term>-l <replaceable>log-level</replaceable></term>
 	<listitem>
-          <para> Specify the file logging level. </para>
+          <para> Specify the file logging level. The log level can be: [ OFF | SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST].</para>
         </listitem>
       </varlistentry>
+
+      <varlistentry>
+        <term>--arch=ARCH<replaceable>ARCH</replaceable></term>
+        <listitem>
+          <para> Specify the test cases' arch. The ARCH can be 64 or 32. If no arch is specified, arch-64 cases will be run. When the arch-32 cases are ready, all cases will be run be default.The option will take no effect in 32-bit machine.  </para>
+        </listitem>
+      </varlistentry>
+
+
     </variablelist>
   </refsect1>
   
Index: frysk-core/Makefile.am
===================================================================
RCS file: /cvs/frysk/frysk-core/Makefile.am,v
retrieving revision 1.68
diff -u -r1.68 Makefile.am
--- frysk-core/Makefile.am	20 Sep 2006 00:30:48 -0000	1.68
+++ frysk-core/Makefile.am	20 Sep 2006 09:27:31 -0000
@@ -104,6 +104,20 @@
 EXTRA_DIST += $(srcdir)/frysk/cli/hpd/doc-files/parsetree.png
 EXTRA_DIST += $(srcdir)/frysk/pkglibexecdir/util.h
 
+if DO_ARCH32_TEST
+frysk/pkglibexecdir/arch32/funit-child-alias.$(OBJEXT): $(frysk_pkglibexecdir_arch32_funit_child_SOURCES)
+	@ARCH32_COMPILE=`echo "$(ARCH32_COMPILE) " | sed -e 's, -m64 , ,g'`; \
+	$$ARCH32_COMPILE $(frysk_pkglibexecdir_arch32_CFLAGS) -c -o $@ $<
+
+frysk/pkglibexecdir/arch32/funit-child-alias$(EXEEXT): frysk/pkglibexecdir/arch32/funit-child-alias.$(OBJEXT) frysk/pkglibexecdir/arch32/$(am__dirstamp)
+	@rm -f $@
+	@ARCH32_LINK=`echo "$(LINK) " | sed -e 's, -m64 , ,g'`; \
+	$$ARCH32_LINK -m32 -g -pthread frysk/pkglibexecdir/arch32/funit-child-alias.$(OBJEXT)
+pkglibexec_arch32_PROGRAMS += frysk/pkglibexecdir/arch32/funit-child-alias
+
+MOSTLYCLEANFILES += frysk/pkglibexecdir/arch32/funit-child-alias.$(OBJEXT)
+endif
+
 # Try running funit from the install directory; ignore things like
 # program transform name for the moment.
 installcheck-local: installcheck-funit

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]