aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/native/testsuite
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
commit4f9533c7722fa07511a94d005227961f4a4dec23 (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/native/testsuite
parenteaec4980e139903ae9b274d1abcf3a13946603a8 (diff)
downloadgcc-4f9533c7722fa07511a94d005227961f4a4dec23.zip
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.bz2
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
Diffstat (limited to 'libjava/classpath/native/testsuite')
-rw-r--r--libjava/classpath/native/testsuite/Makefile.am2
-rw-r--r--libjava/classpath/native/testsuite/guile-jvm.c223
2 files changed, 0 insertions, 225 deletions
diff --git a/libjava/classpath/native/testsuite/Makefile.am b/libjava/classpath/native/testsuite/Makefile.am
deleted file mode 100644
index 26f2f82..0000000
--- a/libjava/classpath/native/testsuite/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-##bin_PROGRAMS = guile-jvm
-
diff --git a/libjava/classpath/native/testsuite/guile-jvm.c b/libjava/classpath/native/testsuite/guile-jvm.c
deleted file mode 100644
index c372f75..0000000
--- a/libjava/classpath/native/testsuite/guile-jvm.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Guile/JNI/JVM Testing Framework
- *
- * Copyright (c) 1998 Free Software Foundation, Inc.
- * Written by Paul Fisher (rao@gnu.org)
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <libguile.h>
-#include <guile/gh.h>
-#include <jni.h>
-
-static JNIEnv *env;
-static jclass test_class, result_class;
-static jmethodID test_mid, test_name_mid, result_name_mid, result_msg_mid;
-
-SCM
-abort_test (SCM name, char *exception)
-{
- (*env)->ExceptionClear (env);
- return gh_list (name,
- gh_symbol2scm ("ERROR"),
- gh_str02scm (exception),
- SCM_UNDEFINED);
-}
-
-SCM
-handle_test_exception (jobject test_name_obj)
-{
- jthrowable throwable;
- jclass object_class;
- jobject err_msg_obj;
- char *err_msg, *test_name;
- const char *utf;
- SCM result;
- jboolean is_copy;
- static jmethodID obj_toString_mid = NULL;
-
- throwable = (*env)->ExceptionOccurred (env);
- (*env)->ExceptionClear (env);
-
- if (obj_toString_mid == NULL)
- obj_toString_mid = (*env)->GetMethodID (env,
- (*env)->FindClass (env,
- "java/lang/Object"),
- "toString",
- "()Ljava/lang/String;");
-
- err_msg_obj = (*env)->CallObjectMethod (env, throwable, obj_toString_mid);
-
- utf = (*env)->GetStringUTFChars (env, err_msg_obj, &is_copy);
- err_msg = strdup (utf);
- (*env)->ReleaseStringUTFChars (env, err_msg_obj, utf);
-
- utf = (*env)->GetStringUTFChars (env, test_name_obj, &is_copy);
- test_name = strdup (utf);
- (*env)->ReleaseStringUTFChars (env, test_name_obj, utf);
-
- result = abort_test (gh_str02scm (test_name), err_msg);
-
- free (err_msg);
- free (test_name);
-
- return result;
-}
-
-SCM
-perform_test (SCM clazz_scm_name)
-{
- char *clazz_name, *test_name, *result_name, *msg;
- const char *utf;
- jclass clazz;
- jmethodID mid;
- jobject test_obj, result_obj, test_name_obj, result_name_obj, msg_obj;
- jboolean is_copy;
- SCM scm_test_name, scm_result_name, scm_result_msg;
-
- clazz_name = gh_scm2newstr (clazz_scm_name, NULL);
- clazz = (*env)->FindClass (env, clazz_name);
- if (clazz == NULL)
- {
- SCM clazz_err = gh_str02scm (clazz_name);
- free (clazz_name);
- return abort_test (clazz_err, "Unable to find class");
- }
-
- mid = (*env)->GetMethodID (env, clazz, "<init>", "()V");
- test_obj = (*env)->NewObject (env, clazz, mid);
-
- if ((*env)->IsInstanceOf (env, test_obj, test_class) == JNI_FALSE)
- {
- SCM clazz_err = gh_str02scm (clazz_name);
- free (clazz_name);
- return abort_test (clazz_err, "Not an instanceof gnu.test.Test");
- }
- free (clazz_name);
-
- /* Call all the Java testing methods */
- test_name_obj = (*env)->CallObjectMethod (env, test_obj, test_name_mid);
- result_obj = (*env)->CallObjectMethod (env, test_obj, test_mid);
-
- /* Handle an exception if one occurred */
- if ((*env)->ExceptionOccurred (env))
- return handle_test_exception (test_name_obj);
-
- result_name_obj = (*env)->CallObjectMethod (env, result_obj,
- result_name_mid);
- msg_obj = (*env)->CallObjectMethod (env, result_obj, result_msg_mid);
-
- /* Grab all the C result messages */
- utf = (*env)->GetStringUTFChars (env, test_name_obj, &is_copy);
- test_name = strdup (utf);
- (*env)->ReleaseStringUTFChars (env, test_name_obj, utf);
-
- utf = (*env)->GetStringUTFChars (env, result_name_obj, &is_copy);
- result_name = strdup (utf);
- (*env)->ReleaseStringUTFChars (env, result_name_obj, utf);
-
- utf = (*env)->GetStringUTFChars (env, msg_obj, &is_copy);
- msg = strdup (utf);
- (*env)->ReleaseStringUTFChars (env, msg_obj, utf);
-
- /* Convert the C result messages to Scheme */
- scm_test_name = gh_str02scm (test_name);
- scm_result_name = gh_symbol2scm (result_name);
- scm_result_msg = gh_str02scm (msg);
-
- /* Free up the C result messages */
- free (test_name);
- free (result_name);
- free (msg);
-
- return gh_list (scm_test_name,
- scm_result_name,
- scm_result_msg,
- SCM_UNDEFINED);
-}
-
-int
-init_testing_framework ()
-{
- JavaVM *jvm;
- JDK1_1InitArgs vm_args;
-
- vm_args.version = 0x00010001;
- JNI_GetDefaultJavaVMInitArgs (&vm_args);
- vm_args.classpath = getenv ("CLASSPATH");
- if (JNI_CreateJavaVM (&jvm, &env, &vm_args) < 0)
- return -1;
-
- test_class = (*env)->FindClass (env, "gnu/test/Test");
- if (test_class == NULL)
- {
- fprintf (stderr, "Unable to locate gnu.test.Test\n");
- return -1;
- }
- test_class = (*env)->NewGlobalRef (env, test_class);
-
- result_class = (*env)->FindClass (env, "gnu/test/Result");
- if (result_class == NULL)
- {
- fprintf (stderr, "Unable to locate gnu.test.Result\n");
- return -1;
- }
- result_class = (*env)->NewGlobalRef (env, result_class);
-
- test_mid = (*env)->GetMethodID (env, test_class, "test",
- "()Lgnu/test/Result;");
- test_name_mid = (*env)->GetMethodID (env, test_class, "getName",
- "()Ljava/lang/String;");
- if (test_mid == NULL || test_name_mid == NULL)
- {
- fprintf (stderr, "Malformed gnu.test.Test class\n");
- return -1;
- }
-
- result_name_mid = (*env)->GetMethodID (env, result_class, "getName",
- "()Ljava/lang/String;");
- result_msg_mid = (*env)->GetMethodID (env, result_class, "getMsg",
- "()Ljava/lang/String;");
- if (result_name_mid == NULL || result_msg_mid == NULL)
- {
- fprintf (stderr, "Malformed gnu.test.Result class\n");
- return -1;
- }
-
- gh_new_procedure1_0 ("test", perform_test);
- return 0;
-}
-
-static void
-inner_main (void *closure, int argc, char **argv)
-{
- if (init_testing_framework () < 0)
- {
- fprintf (stderr, "Unable to instantiate JVM.\n");
- exit (1);
- }
- scm_shell (argc, argv);
-}
-
-int
-main (int argc, char **argv)
-{
- scm_boot_guile (argc, argv, inner_main, 0);
- return 0;
-}