From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19763 invoked by alias); 28 May 2008 10:13:52 -0000 Received: (qmail 19733 invoked by uid 367); 28 May 2008 10:13:51 -0000 Date: Wed, 28 May 2008 10:13:00 -0000 Message-ID: <20080528101351.19714.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: New scripts Runner and TestRunner for running JNI. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 435b6331ffaa61dab0feb8e2c988f0f062ee96f3 X-Git-Newrev: 9c76bab74da6115985f57ad5383fb7415eb0be25 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00295.txt.bz2 The branch, master has been updated via 9c76bab74da6115985f57ad5383fb7415eb0be25 (commit) via caa00a26b47a4fc05f2a644ff76337864d38effb (commit) from 435b6331ffaa61dab0feb8e2c988f0f062ee96f3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9c76bab74da6115985f57ad5383fb7415eb0be25 Author: Andrew Cagney Date: Wed May 28 06:12:37 2008 -0400 New scripts Runner and TestRunner for running JNI. For instance: ./Runner TestRunner: Runs TestRunner.main using JNI ./TestRunner : Same, but a shorter alias. commit caa00a26b47a4fc05f2a644ff76337864d38effb Author: Andrew Cagney Date: Tue May 27 14:05:08 2008 -0400 Mention pre-release stuff. ----------------------------------------------------------------------- Summary of changes: frysk-common/ChangeLog | 7 ++ frysk-common/Makefile.gen.sh | 3 +- frysk-common/Makefile.rules | 53 ++++++++++++++ frysk-common/TestRunner.java-in | 6 ++ frysk-sys/ChangeLog | 7 ++ frysk-sys/Makefile.am | 73 -------------------- frysk-sys/frysk/config/ChangeLog | 6 ++ .../frysk/config/Runtime.java | 73 ++++++++++++++----- .../frysk/config/cni/Runtime.cxx | 30 ++------ .../frysk/config/jni/Runtime.cxx | 30 ++------- htdocs/releases/index.html | 61 +++++++++++++--- 11 files changed, 198 insertions(+), 151 deletions(-) copy frysk-common/TestRunner.java-in => frysk-sys/frysk/config/Runtime.java (57%) mode change 100755 => 100644 copy frysk-common/TestRunner.java-in => frysk-sys/frysk/config/cni/Runtime.cxx (71%) mode change 100755 => 100644 copy frysk-common/TestRunner.java-in => frysk-sys/frysk/config/jni/Runtime.cxx (71%) mode change 100755 => 100644 First 500 lines of diff: diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog index 7b61862..d28e1f7 100644 --- a/frysk-common/ChangeLog +++ b/frysk-common/ChangeLog @@ -1,3 +1,10 @@ +2008-05-27 Andrew Cagney + + * Makefile.gen.sh (noinst_DATA): Add TestRunner.jar. + * Makefile.rules (TestRunner.jar): New target. + (JniRunner, Runner): New. + * TestRunner.java-in: Call Runtime.load(). + 2008-05-22 Andrew Cagney * frysk-common.ac (--with-libopcodes): Delete. diff --git a/frysk-common/Makefile.gen.sh b/frysk-common/Makefile.gen.sh index fa8f15d..a9dc667 100755 --- a/frysk-common/Makefile.gen.sh +++ b/frysk-common/Makefile.gen.sh @@ -505,7 +505,8 @@ endif BUILT_SOURCES += ${GEN_SOURCENAME}/JUnitTests.java SCRIPT_BUILT += ${GEN_SOURCENAME}/JUnitTests.java TESTS += TestRunner -noinst_PROGRAMS += TestRunner +noinst_PROGRAMS += TestRunner Runner JniRunner +noinst_DATA += TestRunner.jar EOF echo_LDFLAGS TestRunner diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules index c15e028..b6ab03e 100644 --- a/frysk-common/Makefile.rules +++ b/frysk-common/Makefile.rules @@ -337,9 +337,25 @@ SUFFIXES += .xml-in .xml.8: mkdir -p `dirname $@` $(XMLTO) -o `dirname $@` man $< + +# When compiling the test runner be sure to include the current +# directories classes. + +TestRunner.jar: TestRunner.java + rm -f $@.tmp $*.class + $(JAVAC) `echo $(JAVACFLAGS) | sed -e 's/-classpath /-classpath $(GEN_DIRNAME).jar:/'` $*.java + $(JAR) cf $@.tmp $*.class + rm -f $*.class + mv $@.tmp $@ + +# Make gets confused about which root to build TestRunner.o from - +# .jar or .java, spell it out. +TestRunner.o: TestRunner.java + $(GCJCOMPILE) -c $< TestRunner.java: common/TestRunner.java-in $(SUBST) + $(GEN_SOURCENAME)/JUnitTests.java: files-java.list mkdir -p $(GEN_SOURCENAME) rm -f $@.tmp @@ -371,6 +387,43 @@ $(GEN_SOURCENAME)/JUnitTests.java: files-java.list echo >> $@.tmp '}' mv -f $@.tmp $@ +frysk_imports = $$(cd ../frysk-imports && pwd) +Runner: + rm -f $@ + echo "#!/bin/sh" >> $@.tmp + echo "export LD_PRELOAD=\"\\" >> $@.tmp + echo "libstdc++.so.6 \\" >> $@.tmp + echo "libdw.so \\" >> $@.tmp + echo "libelf.so \\" >> $@.tmp + echo "libunwind-x86.so \\" >> $@.tmp + echo "libunwind-ppc32.so \\" >> $@.tmp + echo "libunwind-ppc64.so \\" >> $@.tmp + echo "libunwind-x86_64.so \\" >> $@.tmp + echo "\"" >> $@.tmp + echo "# hack to hopefully find the right libstdc++.so" >> $@.tmp + echo "export LD_LIBRARY_PATH=.\\" >> $@.tmp + echo ":$(frysk_imports)/elfutils/libdw\\" >> $@.tmp + echo ":$(frysk_imports)/elfutils/libelf\\" >> $@.tmp + echo ":$(frysk_imports)/elfutils/backends\\" >> $@.tmp + echo ":$(frysk_imports)/libunwind-i386/src/.libs\\" >> $@.tmp + echo ":$(frysk_imports)/libunwind-ppc32/src/.libs\\" >> $@.tmp + echo ":$(frysk_imports)/libunwind-ppc64/src/.libs\\" >> $@.tmp + echo ":$(frysk_imports)/libunwind-x86_64/src/.libs\\" >> $@.tmp + echo ":/usr/lib64\\" >> $@.tmp + echo ":/usr/lib" >> $@.tmp + echo "export CLASSPATH=\\" >> $@.tmp + echo "$(CLASSPATH):$(GEN_DIRNAME).jar:TestRunner.jar" >> $@.tmp + echo "gij \"\$$@\"" >> $@.tmp + chmod a+x $@.tmp + mv $@.tmp $@ + +JniRunner: + rm -f $@ + echo "#!/bin/sh" >> $@.tmp + echo "exec ./Runner TestRunner \"\$$@\"" >> $@.tmp + chmod a+x $@.tmp + mv $@.tmp $@ + # Generate one or more .h files, one per named class, and using CNI, # from the corresponding .java file. Anonymous classes are pruned. diff --git a/frysk-common/TestRunner.java-in b/frysk-common/TestRunner.java-in index b3f9eeb..b93c9fa 100755 --- a/frysk-common/TestRunner.java-in +++ b/frysk-common/TestRunner.java-in @@ -43,6 +43,7 @@ import frysk.junit.Runner; import @GEN_PACKAGENAME@.JUnitTests; import frysk.config.Prefix; import frysk.config.PrefixFactory; +import frysk.config.Runtime; /** * Run the JUnit tests from within the build tree. @@ -62,4 +63,9 @@ public class TestRunner { int status = testRunner.runTestCases(JUnitTests.get()); System.exit (status); } + static { + // Needs to be done before main, and hence before any + // libraries main needs to load. + Runtime.load(); + } } diff --git a/frysk-sys/ChangeLog b/frysk-sys/ChangeLog index 08aad82..52b6d1c 100644 --- a/frysk-sys/ChangeLog +++ b/frysk-sys/ChangeLog @@ -1,3 +1,10 @@ +2008-05-27 Andrew Cagney + + * Makefile.am (JniRunner.java): Delete. + (JniRunner.jar): Delete. + (noinst_DATA): Delete JniRunner.jar and JniRunner. + (JniRunner): Delete. + 2008-05-26 Andrew Cagney * Makefile.am (JNIXX_CLASSES): Add UnwindRegistersX86 et.al. diff --git a/frysk-sys/Makefile.am b/frysk-sys/Makefile.am index 4efa836..24032eb 100644 --- a/frysk-sys/Makefile.am +++ b/frysk-sys/Makefile.am @@ -83,76 +83,3 @@ JNIXX_CLASSES += lib.unwind.UnwindRegistersPPC32 JNIXX_CLASSES += lib.unwind.UnwindRegistersPPC64 JNIXX_CLASSES += lib.unwind.UnwindRegistersX86 JNIXX_CLASSES += lib.unwind.UnwindRegistersX8664 - - -# Quick hack to get a test JNI program up-and-running; as a package is -# re-implemented in JNI, add it to the below. - -noinst_DATA += JniRunner.jar JniRunner -CLEANFILES += JniRunner -JniRunner: | frysk-sys.jar libfrysk-sys-jni.so - rm -f $@.tmp - echo "#!/bin/sh" >> $@.tmp - echo "export LD_PRELOAD=\"\\" >> $@.tmp - echo "libstdc++.so.6 \\" >> $@.tmp - echo "libdw.so \\" >> $@.tmp - echo "libelf.so \\" >> $@.tmp - echo "libunwind-x86.so \\" >> $@.tmp - echo "libunwind-ppc32.so \\" >> $@.tmp - echo "libunwind-ppc64.so \\" >> $@.tmp - echo "libunwind-x86_64.so \\" >> $@.tmp - echo "\"" >> $@.tmp - echo "# hack to hopefully find the right libstdc++.so" >> $@.tmp - echo "export LD_LIBRARY_PATH=.\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/elfutils/libdw && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/elfutils/libelf && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/elfutils/backends && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/libunwind-i386/src/.libs && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/libunwind-ppc32/src/.libs && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/libunwind-ppc64/src/.libs && pwd)\\" >> $@.tmp - echo ":$$(cd ../frysk-imports/libunwind-x86_64/src/.libs && pwd)\\" >> $@.tmp - echo ":/usr/lib64\\" >> $@.tmp - echo ":/usr/lib" >> $@.tmp - echo "export CLASSPATH=\\" >> $@.tmp - echo "$(CLASSPATH):frysk-sys.jar:JniRunner.jar" >> $@.tmp - echo "if test \$$# -eq 0 ; then" >> $@.tmp - echo " $(JAVA) JniRunner \\" >> $@.tmp - echo " frysk.config \\" >> $@.tmp - echo " frysk.expunit \\" >> $@.tmp - echo " frysk.junit \\" >> $@.tmp - echo " frysk.rsl \\" >> $@.tmp - echo " frysk.sys.proc \\" >> $@.tmp - echo " frysk.sys.termios \\" >> $@.tmp - echo " frysk.sys.TestPipePair \\" >> $@.tmp - echo " frysk.sys.TestProcessIdentifier \\" >> $@.tmp - echo " frysk.sys.TestPseudoTerminal \\" >> $@.tmp - echo " frysk.sys.TestSignal \\" >> $@.tmp - echo " frysk.sys.TestSignalSet \\" >> $@.tmp - echo " frysk.testbed \\" >> $@.tmp - echo " inua \\" >> $@.tmp - echo " jnixx \\" >> $@.tmp - echo " lib.stdcpp \\" >> $@.tmp - echo " ;" >> $@.tmp - echo "else" >> $@.tmp - echo " $(JAVA) JniRunner \"\$$@\"" >> $@.tmp - echo "fi" >> $@.tmp - chmod a+x $@.tmp - mv $@.tmp $@ -jni: JniRunner - -CLEANFILES += JniRunner.class JniRunner.jar -JniRunner.jar: JniRunner.java - rm -f $@.tmp - $(JAVAC) `echo $(JAVACFLAGS) | sed -e 's/-classpath /-classpath frysk-sys.jar:/'` JniRunner.java - $(JAR) cf $@ JniRunner.class - rm JniRunner.class -CLEANFILES += JniRunner.java -JniRunner.java: common/TestRunner.java-in - rm -f $@.tmp - ( $(SUBST_SED) < $< | sed -e 's/TestRunner/JniRunner/' -e '/^}/d' ; \ - echo " static {" ; \ - echo " System.loadLibrary(\"frysk-sys-jni\");" ; \ - echo " }" ; \ - echo "}" ; \ - ) > $@.tmp - mv $@.tmp $@ diff --git a/frysk-sys/frysk/config/ChangeLog b/frysk-sys/frysk/config/ChangeLog index edf0de6..f5a775a 100644 --- a/frysk-sys/frysk/config/ChangeLog +++ b/frysk-sys/frysk/config/ChangeLog @@ -1,3 +1,9 @@ +2008-05-27 Andrew Cagney + + * Runtime.java: New. + * cni/Runtime.cxx: New. + * jni/Runtime.cxx: New. + 2008-05-09 Andrew Cagney * jni/FryskVersion.cxx-in: Use String's JNI methods. diff --git a/frysk-common/TestRunner.java-in b/frysk-sys/frysk/config/Runtime.java old mode 100755 new mode 100644 similarity index 57% copy from frysk-common/TestRunner.java-in copy to frysk-sys/frysk/config/Runtime.java index b3f9eeb..a5549db --- a/frysk-common/TestRunner.java-in +++ b/frysk-sys/frysk/config/Runtime.java @@ -1,8 +1,6 @@ -// -*- Java -*- - // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. +// Copyright 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -39,27 +37,64 @@ // version and license this file solely under the GPL without // exception. -import frysk.junit.Runner; -import @GEN_PACKAGENAME@.JUnitTests; -import frysk.config.Prefix; -import frysk.config.PrefixFactory; +package frysk.config; /** - * Run the JUnit tests from within the build tree. + * Attempt to load frysk's runtime bindings. */ -public class TestRunner { - public static void main (String[] args) { - String ABS_BUILDDIR = "@abs_builddir@"; - String ROOT_SRCDIR = "@root_srcdir@"; +public class Runtime { + private final String name; + private Runtime(String name) { + this.name = name; + } + public String toString() { + return name; + } - Prefix configAll = PrefixFactory.createBuildPrefix(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config32 = PrefixFactory.createBuildPrefix32(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config64 = PrefixFactory.createBuildPrefix64(ROOT_SRCDIR, ABS_BUILDDIR); + public static final Runtime COMPILER_NATIVE_INTERFACE = new Runtime("CNI"); + public static final Runtime JAVA_NATIVE_INTERFACE = new Runtime("JNI"); - Runner testRunner = new Runner("TestRunner", args, - configAll, config32, config64); - int status = testRunner.runTestCases(JUnitTests.get()); - System.exit (status); + private static boolean tryBindings() { + // Try calling a binding, if it works cool. If it fails, + // check that it failed on the expected symbol and if that is + // wrong abort. + try { + runtime(); + return true; + } catch (UnsatisfiedLinkError e) { + if (!e.getMessage().equals("runtime")) { + System.err.println("Problem loading runtime bindings, unexpected error: " + e.toString()); + System.exit(1); + } + return false; + } } + + public static void load() { + // Just try a call, perhaps things have already been loaded so + // things will just work. + if (tryBindings()) { + return; + } + // No such luck, try explicitly loading frysk's JNI runtime. + try { + System.loadLibrary("frysk-sys-jni"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Problem loading runtime bindings, " + + e.getMessage()); + System.exit(1); + } + if (tryBindings()) { + return; + } + System.err.println("Problem loading runtime bindings."); + System.exit(1); + } + + public static Runtime get() { + return runtime(); + } + + private static native Runtime runtime(); } diff --git a/frysk-common/TestRunner.java-in b/frysk-sys/frysk/config/cni/Runtime.cxx old mode 100755 new mode 100644 similarity index 71% copy from frysk-common/TestRunner.java-in copy to frysk-sys/frysk/config/cni/Runtime.cxx index b3f9eeb..29150ec --- a/frysk-common/TestRunner.java-in +++ b/frysk-sys/frysk/config/cni/Runtime.cxx @@ -1,8 +1,6 @@ -// -*- Java -*- - // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. +// Copyright 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -39,27 +37,13 @@ // version and license this file solely under the GPL without // exception. -import frysk.junit.Runner; -import @GEN_PACKAGENAME@.JUnitTests; -import frysk.config.Prefix; -import frysk.config.PrefixFactory; - -/** - * Run the JUnit tests from within the build tree. - */ +#include -public class TestRunner { - public static void main (String[] args) { - String ABS_BUILDDIR = "@abs_builddir@"; - String ROOT_SRCDIR = "@root_srcdir@"; +#include "frysk/config/Runtime.h" - Prefix configAll = PrefixFactory.createBuildPrefix(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config32 = PrefixFactory.createBuildPrefix32(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config64 = PrefixFactory.createBuildPrefix64(ROOT_SRCDIR, ABS_BUILDDIR); +using namespace frysk::config; - Runner testRunner = new Runner("TestRunner", args, - configAll, config32, config64); - int status = testRunner.runTestCases(JUnitTests.get()); - System.exit (status); - } +Runtime* +Runtime::runtime() { + return COMPILER_NATIVE_INTERFACE; } diff --git a/frysk-common/TestRunner.java-in b/frysk-sys/frysk/config/jni/Runtime.cxx old mode 100755 new mode 100644 similarity index 71% copy from frysk-common/TestRunner.java-in copy to frysk-sys/frysk/config/jni/Runtime.cxx index b3f9eeb..9dc8e27 --- a/frysk-common/TestRunner.java-in +++ b/frysk-sys/frysk/config/jni/Runtime.cxx @@ -1,8 +1,6 @@ -// -*- Java -*- - // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. +// Copyright 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -39,27 +37,11 @@ // version and license this file solely under the GPL without // exception. -import frysk.junit.Runner; -import @GEN_PACKAGENAME@.JUnitTests; -import frysk.config.Prefix; -import frysk.config.PrefixFactory; - -/** - * Run the JUnit tests from within the build tree. - */ - -public class TestRunner { - public static void main (String[] args) { - String ABS_BUILDDIR = "@abs_builddir@"; - String ROOT_SRCDIR = "@root_srcdir@"; +#include "jni.hxx" - Prefix configAll = PrefixFactory.createBuildPrefix(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config32 = PrefixFactory.createBuildPrefix32(ROOT_SRCDIR, ABS_BUILDDIR); - Prefix config64 = PrefixFactory.createBuildPrefix64(ROOT_SRCDIR, ABS_BUILDDIR); +using namespace frysk::config; - Runner testRunner = new Runner("TestRunner", args, - configAll, config32, config64); - int status = testRunner.runTestCases(JUnitTests.get()); - System.exit (status); - } +Runtime +Runtime::runtime(jnixx::env env) { + return GetCOMPILER_NATIVE_INTERFACE(env); } diff --git a/htdocs/releases/index.html b/htdocs/releases/index.html index 93e8f8e..9453c4a 100755 --- a/htdocs/releases/index.html +++ b/htdocs/releases/index.html @@ -55,10 +55,11 @@

+Before the Release
Branch
-Release -Upload -Announce +Release
+Upload
+Announce

@@ -89,8 +90,27 @@ patch-level number like 0.2.1 and use the original releases branch +

Before The Release

+ +

About a week before the release drop an e-mail to frysk@, and in +the Wednesday meeting, reminding everyone: + +

    + +
  • when the release is planned +
  • to add whats-new to the NEWS file + +
+ +

In the meeting, or on IRC, you might even collect suggestions and +add them yourself. If you think of anything, just add it also. + +

Cutting the Branch

+

First, before cutting the branch, ask around for any late breaking +NEWS additions. +

Here's a suggested sequence:

    @@ -101,7 +121,7 @@ meaningful:
     cd frysk  (change to the directory where a fresh checkout of frysk is)
    -version=0.2 ! ! ! change this
    +version=0.3 ! ! ! change this
     echo $version
     date=`date -u +"%Y.%m.%d"`
     echo date=$date 1>&2
    @@ -122,18 +142,35 @@ git push origin $branch
     
    hooks/post-receive -- frysk system monitor/debugger