diff options
Diffstat (limited to 'libjava/testsuite')
37 files changed, 1948 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog new file mode 100644 index 00000000000..d7559a238b8 --- /dev/null +++ b/libjava/testsuite/ChangeLog @@ -0,0 +1,326 @@ +1999-04-06 Tom Tromey <tromey@cygnus.com> + + * libjava.mauve/mauve.exp (test_mauve_sim): Reference + mauve-libgcj. + (test_mauve): Likewise. + +1999-03-30 Tom Tromey <tromey@cygnus.com> + + * libjava.mauve/mauve.exp: Renamed from test.exp. With the new + name it is easier to run just the Mauve tests. + + * libjava.mauve/test.exp (test_mauve): Added gnu/testlet/config to + list of files to link in. + (test_mauve_sim): Likewise. + * libjava.mauve/DejaGNUTestHarness.java (srcdir, tmpdir): New + static variables. + (DejaGNUTestHarness): Removed argument from constructor. + (dejasrcdir): New static variable. + (main): Set `dejasrcdir'. + (getSourceDirectory): New method. + +1999-03-08 Tom Tromey <tromey@cygnus.com> + + * libjava.compile/perc.java: New file. + +1999-02-26 Tom Tromey <tromey@cygnus.com> + + * libjava.util/test.exp: Removed. + +1999-02-25 Tom Tromey <tromey@cygnus.com> + + * libjava.mauve/test.exp: Make sure current directory is correct + after tests are run. + + * libjava.mauve/test.exp (test_mauve): Removed extra arg in call + to bytecompile_file. + (test_mauve_sim): Likewise. + +Thu Feb 25 09:21:03 1999 Anthony Green <green@cygnus.com> + + * libjava.compile/euc_comment1.java, + libjava.compile/euc_comment2.java, + libjava.compile/euc_comment3.java, + libjava.compile/euc_comment1.java, + libjava.compile/euc_comment2.java, + libjava.compile/euc_comment3.java: New files. + + * libjava.compile/Case.java, libjava.compile/support/Case.java: + New files. + +1999-02-24 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp (find_jvscan): New proc. + (bytecompile_file): Removed `srcfile_in' argument. + (test_libjava_from_javac): Use `jv-scan' program to find name of + `main' and name of all generated classes. Compile all generated + classes, not just primary class. For no-exec tests, only try to + build the .o, not the full executable. + +Wed Feb 24 11:22:32 1999 Anthony Green <green@hoser.cygnus.com> + + * libjava.compile/test.exp: Minor fix. + +1999-02-23 Anthony Green <green@cygnus.com> + + * libjava.compile/Where.java, libjava.compile/support/Waldo.java, + libjava.compile/Twice.java, libjava.compile/Semi.java, + libjava.compile/Statics.java, libjava.compile/test.exp, + libjava.lang/Synch.java, libjava.lang/Synch.out: New files. + +1999-02-16 Tom Tromey <tromey@cygnus.com> + + * Makefile.in: Rebuilt. + * Makefile.am (AUTOMAKE_OPTIONS): Added no-installinfo. + +Wed Feb 17 19:53:51 1999 Warren Levy <warrenl@cygnus.com> + + * libjava.mauve/test.exp: modified file allows Mauve tests to + run on JMR board; simplified script to use same procedure for + all testing + +1999-02-10 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp (libjava_arguments): Updated to track library + renames. + +1999-02-07 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/slash.java: New file. + * libjava.lang/slash.out: New file. + +Mon Feb 1 05:17:40 1999 Anthony Green <green@fencer.cygnus.com> + + * lib/libjava.exp: Test compiling from source as well as from + bytecodes. + +1999-01-11 Tom Tromey <tromey@cygnus.com> + + * libjava.mauve/test.exp (mauve_compute_uses): Read classes file, + not choices file. + + * libjava.mauve/test.exp (test_mauve): Added + ResourceNotFoundException to list of harness files to compile. + (test_mauve_sim): Likewise. + +1998-12-17 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Invoke_1.java: New file. + + * libjava.lang/Thread_1.java (Thread_1): Class now public. + * libjava.lang/Array_1.java (Array_1): Class now public. + + * libjava.lang/Throw_1.out: New file. + * libjava.lang/Throw_1.java: New file. + +1998-12-11 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp (libjava_arguments): New proc. + (test_libjava): Use it. + (bytecompile_file): Added classpath argument. + * libjava.mauve/test.exp: New file. + * libjava.mauve/DejaGNUTestHarness.java: New file. + +1998-12-08 Tom Tromey <tromey@cygnus.com> + + * Various: removed all test files that migrated to Mauve. + +1998-12-07 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Array_1.java (main): Removed extraneous + getSuperclass call. + +1998-11-23 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Finalize_1.java (main): Clear `f' before GC. + +1998-10-08 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Thread_1.out: Added missing line. + +Fri Oct 2 14:55:46 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Array_1.java: Changed so Cloneable test can run + even if clone test itself fails. + + * libjava.lang/Array_1.java: Uncommented calls to getSuperclass. + Added test to see if array implements Cloneable. + +Thu Oct 1 11:28:06 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Array_1.java: New file. + * libjava.lang/Array_1.out: New file. + +Thu Oct 1 13:51:00 1998 Anthony Green <green@cygnus.com> + + * testsuite/lib/libjava.exp: Find qthreads library correctly. + +Tue Sep 29 16:36:43 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.util/Hashtable_1.java, libjava.util/Hashtable_1.out: Created. + +Tue Sep 29 00:40:26 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Thread_1.java (started): New field. + (run): Set `started'. Handle all synchronization here. + (Thread_1): Initialize `started'. + (doit): Just start both threads and let them handle their own + synchronization. + + * libjava.lang/Boolean_5.out: Changed to reflect the + Boolean_5.java changes. + * libjava.lang/Boolean_5.java: Don't replace the system + properties, just augment them. Don't print the property object. + * libjava.lang/Long_2.out: Changed to reflect Long_2.java + changes. + * libjava.lang/Long_2.java: Don't replace the system properties, + just augment them. Don't print the property object. + * libjava.lang/Integer_2.out: Changed to reflect Integer_2.java + changes. + * libjava.lang/Integer_2.java: Don't replace the system + properties, just augment them. Don't print the property object. + +Sat Sep 26 15:57:39 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Thread_1.java (main): Catch InterruptedException. + +Tue Sep 22 13:45:58 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Thread_1.out: New file. + * libjava.lang/Thread_1.java: New file. + +Mon Sep 21 14:20:08 1998 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp (test_libjava): Use runtest_file_p to see if + test should be short-circuited. + +Tue Sep 15 13:57:45 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Character_9.java: New file. + * libjava.lang/Character_9.out: New file. + +Mon Sep 14 12:27:04 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Character_8.out: New file. + * libjava.lang/Character_8.java: New file. + * libjava.lang/Character_7.out: New file. + * libjava.lang/Character_7.java: New file. + * libjava.lang/Character_6.out: New file. + * libjava.lang/Character_6.java: New file. + * libjava.lang/Character_5.out: New file. + * libjava.lang/Character_5.java: New file. + * libjava.lang/Character_4.out: New file. + * libjava.lang/Character_4.java: New file. + * libjava.lang/Character_3.out: New file. + * libjava.lang/Character_3.java: New file. + * libjava.lang/Character_2.out: New file. + * libjava.lang/Character_2.java: New file. + +Fri Sep 11 10:04:55 1998 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Character_1.out: New file. + * libjava.lang/Character_1.java: New file. + +Fri Sep 18 14:43:59 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.lang/Long_1.java, libjava.lang/Long_1.out, + libjava.lang/Long_2.java, libjava.lang/Long_2.out: Created. + +Fri Sep 18 12:43:52 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.lang/Integer_1.java, libjava.lang/Integer_1.out, + libjava.lang/Integer_2.java, libjava.lang/Integer_2.out: Created. + + * libjava.lang/String_2.java, libjava.lang/String_2.out: Use JDK 1.2 + values for hashCode. + +Thu Sep 10 12:44:42 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.lang/String_1.java, libjava.lang/String_1.out, + libjava.lang/String_2.java, libjava.lang/String_2.out, + libjava.lang/String_3.java, libjava.lang/String_3.out, + libjava.lang/String_4.java, libjava.lang/String_4.out, + libjava.lang/String_5.java, libjava.lang/String_5.out, + libjava.lang/String_6.java, libjava.lang/String_6.out, + libjava.lang/String_7.java, libjava.lang/String_7.out, + libjava.lang/String_8.java, libjava.lang/String_8.out, + libjava.lang/String_9.java, libjava.lang/String_9.out: Created. + +Tue Sep 8 13:31:59 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.lang/Byte_1.java, libjava.lang/Byte_1.out, + libjava.lang/Short_1.java, libjava.lang/Short_1.out: New files. + +Thu Sep 3 15:57:57 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.lang/Boolean_1.java, libjava.lang/Boolean_1.out, + libjava.lang/Boolean_2.java, libjava.lang/Boolean_2.out, + libjava.lang/Boolean_3.java, libjava.lang/Boolean_3.out, + libjava.lang/Boolean_4.java, libjava.lang/Boolean_4.out, + libjava.lang/Boolean_5.java, libjava.lang/Boolean_5.out: Created. + +Tue Sep 1 12:27:54 1998 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp (bytecompile_file): Don't throw error if byte + compilation fails. Added `srcfile_in' argument. Changed return + value. + (test_libjava): Gracefully handle byte-compilation failure. + + * libjava.lang/System_15.java (main): Typo fix. + (System_15): Choose correct class name. + (X): Moved into System_15. + + * libjava.lang/System_1.java, libjava.lang/System_1.out, + libjava.lang/System_10.java, libjava.lang/System_10.out, + libjava.lang/System_11.java, libjava.lang/System_11.out, + libjava.lang/System_12.java, libjava.lang/System_12.out, + libjava.lang/System_13.java, libjava.lang/System_13.out, + libjava.lang/System_14.java, libjava.lang/System_14.out, + libjava.lang/System_15.java, libjava.lang/System_15.out, + libjava.lang/System_2.java, libjava.lang/System_2.out, + libjava.lang/System_3.java, libjava.lang/System_3.out, + libjava.lang/System_4.java, libjava.lang/System_4.out, + libjava.lang/System_5.java, libjava.lang/System_5.out, + libjava.lang/System_6.java, libjava.lang/System_6.out, + libjava.lang/System_7.java, libjava.lang/System_7.out, + libjava.lang/System_8.java, libjava.lang/System_8.out, + libjava.lang/System_9.java, libjava.lang/System_9.out: New files. + + * lib/libjava.exp (test_libjava): Only add -lgc or -lqthreads if + library is actually found. + + * lib/libjava.exp (test_libjava): Look for qthreads. + +Mon Aug 31 17:49:21 1998 Warren Levy <warrenl@cygnus.com> + + * libjava.util/Random_1.java, libjava.util/Random_1.out, + libjava.util/Random_2.java, libjava.util/Random_2.out, + libjava.util/Random_3.java, libjava.util/Random_3.out, + libjava.util/Random_4.java, libjava.util/Random_4.out, + libjava.util/Random_5.java, libjava.util/Random_5.out, + libjava.util/Random_6.java, libjava.util/Random_6.out, + libjava.util/Random_7.java, libjava.util/Random_7.out, + libjava.util/Random_8.java, libjava.util/Random_8.out, + libjava.util/test.exp: Created. + +Mon Aug 31 16:37:19 1998 Tom Tromey <tromey@cygnus.com> + + * lib/libjava.exp: Changed gjavac to gcj everywhere. + +Wed Aug 26 12:20:10 1998 Anthony Green <green@cygnus.com> + + * Makefile.am (EXPECT,RUNTEST): Find expect and runtest + correctly. + * Makefile.in: Rebuild. + +Tue Aug 25 18:43:33 1998 Anthony Green <green@cygnus.com> + + * lib/libjava.exp: Fix CLASSPATH setting. + +Tue Aug 25 17:27:37 1998 Anthony Green <green@cygnus.com> + + * ChangeLog, lib/libjava.exp, config/default.exp, + libjava.lang/Finalize_1.java, libjava.lang/Finalize_1.out, + libjava.lang/Float_1.java, libjava.lang/Float_1.out + libjava.lang/test.exp, Makefile.am, Makefile.in: Created. + diff --git a/libjava/testsuite/Makefile.am b/libjava/testsuite/Makefile.am new file mode 100644 index 00000000000..e1d359d8f76 --- /dev/null +++ b/libjava/testsuite/Makefile.am @@ -0,0 +1,15 @@ +## Process this file with automake to produce Makefile.in. + +AUTOMAKE_OPTIONS = foreign dejagnu no-installinfo + +# Setup the testing framework, if you have one +EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ + echo $(top_builddir)/../expect/expect ; \ + else echo expect ; fi` + +RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ + echo $(top_srcdir)/../dejagnu/runtest ; \ + else echo runtest; fi` + +RUNTESTFLAGS = @AM_RUNTESTFLAGS@ + diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in new file mode 100644 index 00000000000..764c148a3ca --- /dev/null +++ b/libjava/testsuite/Makefile.in @@ -0,0 +1,251 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ +AR = @AR@ +AS = @AS@ +CC = @CC@ +COMPPATH = @COMPPATH@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@ +EXEEXT = @EXEEXT@ +GCDEPS = @GCDEPS@ +GCINCS = @GCINCS@ +GCLIBS = @GCLIBS@ +GCOBJS = @GCOBJS@ +LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@ +LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@ +LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +RANLIB = @RANLIB@ +THREADDEPS = @THREADDEPS@ +THREADINCS = @THREADINCS@ +THREADLIBS = @THREADLIBS@ +THREADOBJS = @THREADOBJS@ +VERSION = @VERSION@ +here = @here@ +libgcj_basedir = @libgcj_basedir@ + +AUTOMAKE_OPTIONS = foreign dejagnu no-installinfo + +# Setup the testing framework, if you have one +EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ + echo $(top_builddir)/../expect/expect ; \ + else echo expect ; fi` + + +RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ + echo $(top_srcdir)/../dejagnu/runtest ; \ + else echo runtest; fi` + + +RUNTESTFLAGS = @AM_RUNTESTFLAGS@ +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = ../include/config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = ChangeLog Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = testsuite + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign testsuite/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEJATOOL = $(PACKAGE) + +RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir + +check-DEJAGNU: site.exp + srcdir=`cd $(srcdir) && pwd`; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi +site.exp: Makefile + @echo 'Making a new site.exp file...' + @test ! -f site.bak || rm -f site.bak + @echo '## these variables are automatically generated by make ##' > $@-t + @echo '# Do not edit here. If you wish to override these values' >> $@-t + @echo '# edit the last section' >> $@-t + @echo 'set tool $(DEJATOOL)' >> $@-t + @echo 'set srcdir $(srcdir)' >> $@-t + @echo 'set objdir' `pwd` >> $@-t + @echo 'set host_alias $(host_alias)' >> $@-t + @echo 'set host_triplet $(host_triplet)' >> $@-t + @echo 'set target_alias $(target_alias)' >> $@-t + @echo 'set target_triplet $(target_triplet)' >> $@-t + @echo 'set build_alias $(build_alias)' >> $@-t + @echo 'set build_triplet $(build_triplet)' >> $@-t + @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t + @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t + @test ! -f site.exp || mv site.exp site.bak + @mv $@-t site.exp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir check-DEJAGNU info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libjava/testsuite/config/default.exp b/libjava/testsuite/config/default.exp new file mode 100644 index 00000000000..90967cccc18 --- /dev/null +++ b/libjava/testsuite/config/default.exp @@ -0,0 +1 @@ +load_lib "standard.exp" diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp new file mode 100644 index 00000000000..9c8b36d19a9 --- /dev/null +++ b/libjava/testsuite/lib/libjava.exp @@ -0,0 +1,450 @@ +# Copyright (C) 1998, 1999 Cygnus Solutions + +load_lib "libgloss.exp" + +# GCJ_UNDER_TEST is the compiler under test. + +global tmpdir + +if ![info exists tmpdir] { + set tmpdir "/tmp" +} + +# Find `jv-scan'. FIXME: this relies on DejaGnu internals. These +# should probably be exposed in a better way. +proc find_jvscan {} { + global tool_root_dir + + set file [lookfor_file $tool_root_dir jv-scan] + if { $file == "" } { + set file [lookfor_file $tool_root_dir gcc/jv-scan]; + } + if {$file == ""} { + set file jv-scan + } + return $file +} + +proc bytecompile_file { file objdir {classpath {}} } { + global env + set dirname [file dirname $file]; + + catch {unset env(CLASSPATH)} + if {$classpath != ""} then { + set env(CLASSPATH) $classpath + } + if {[catch {system "cd $dirname; javac $file -d $objdir"} msg]} then { + verbose "couldn't compile $file: $msg" + set r 0 + } else { + set r 1 + } + return $r +} + +set libjava_initialized 0 + +# +# Build the status wrapper library as needed. +# +proc libjava_init { args } { + global wrapper_file; + global wrap_compile_flags; + global libjava_initialized + global GCJ_UNDER_TEST + global TOOL_EXECUTABLE + + if { $libjava_initialized == 1 } { return; } + + if ![info exists GCJ_UNDER_TEST] { + if [info exists TOOL_EXECUTABLE] { + set GCJ_UNDER_TEST $TOOL_EXECUTABLE; + } else { + set GCJ_UNDER_TEST "[find_gcj]" + } + } + + set wrapper_file ""; + set wrap_compile_flags ""; + if [target_info exists needs_status_wrapper] { + set result [build_wrapper "testglue.o"]; + if { $result != "" } { + set wrapper_file [lindex $result 0]; + set wrap_compile_flags [lindex $result 1]; + } else { + warning "Status wrapper failed to build." + } + } + + set libjava_initialized 1 +} + +# Compute arguments needed for compiler. +proc libjava_arguments {} { + global base_dir + global LIBJAVA + global LIBGC + global srcdir subdir objdir + global TOOL_OPTIONS + global GCJ_UNDER_TEST + global tmpdir + global runtests + + if [info exists LIBJAVA] { + set libjava $LIBJAVA; + } else { + set gp [get_multilibs]; + if { $gp != "" } { + if [file exists "$gp/libjava/libgcj.a"] { + set libjava "-L$gp/libjava -lgcj"; + } + } + if ![info exists libjava] { + set libjava [findfile $base_dir/../../libjava/libgcj.a "-L$base_dir/../../libjava -lgcj" -lgcj] + } + } + + if [info exists LIBGC] { + set libgc $LIBGC; + } else { + set gp [get_multilibs]; + if { $gp != "" } { + if [file exists "$gp/boehm-gc/libgcjgc.a"] { + set libgc "-L$gp/boehm-gc -lgcjgc"; + } + } + if ![info exists libgc] { + set libgc [findfile $base_dir/../../boehm-gc/libgcjgc.a \ + "-L$base_dir/../../boehm-gc -lgcjgc" \ + {}] + } + } + + if [info exists LIBQTHREADS] { + set libqthreads $LIBQTHREADS + } else { + set gp [get_multilibs] + if { $gp != "" } { + if [file exists "$gp/qthreads/libgcjcoop.a"] { + set libqthreads "-L$gp/qthreads -lgcjcoop"; + } + } + if ![info exists libqthreads] { + set libqthreads [findfile $base_dir/../../qthreads/libgcjcoop.a \ + "-L$base_dir/../../qthreads -lgcjcoop" \ + {}] + } + } + + # FIXME: there's no way to determine whether -lpthread is + # required. We should get this info from configure, or it should + # just be in the compiler driver. + + verbose "using LIBJAVA = $libjava" 2 + verbose "using LIBGC = $libgc" 2 + verbose "using LIBQTHREADS = $libqthreads" 2 + set args "" + + # Basically we want to build up a colon separated path list from + # the value of $libjava. + + # First strip away any -L arguments. + regsub -all -- "-L" $libjava "" ld_library_path + + # Then remove any -lgcj argument. + regsub -all -- " -lgcj.*" $ld_library_path "" ld_library_path + + # First strip away any -L arguments. + regsub -all -- "-L" $libgc $ld_library_path ld_library_path + + # Then remove any -lgcjgc argument. + regsub -all -- " -lgcjgc.*" $ld_library_path "" ld_library_path + + # That's enough to make things work for the normal case. + # If we wanted to handle an arbitrary value of libjava, + # then we'd have to do a lot more work. + + # Set variables the dynamic linker looks at. + setenv LD_LIBRARY_PATH $ld_library_path + setenv SHLIB_PATH $ld_library_path + + # Set the CLASSPATH environment variable + verbose "CLASSPATH is $objdir/.." + global env + set env(CLASSPATH) "$objdir/.." + + global wrapper_file wrap_compile_flags; + lappend args "additional_flags=$wrap_compile_flags"; + lappend args "libs=$wrapper_file"; + lappend args "libs=$libjava"; + lappend args "libs=$libgc"; + lappend args "libs=$libqthreads" + lappend args debug + + if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { + lappend args "libs=${gluefile}" + lappend args "ldflags=$wrap_flags" + } + + if [info exists TOOL_OPTIONS] { + lappend args "additional_flags=$TOOL_OPTIONS" + } + lappend args "compiler=$GCJ_UNDER_TEST" + + return $args +} + + +# +# Run the test specified by srcfile and resultfile. compile_args and +# exec_args are additional arguments to be passed in when compiling and +# running the testcase, respectively. +# +proc test_libjava_from_source { options srcfile compile_args inpfile resultfile exec_args } { + global base_dir + global LIBJAVA + global LIBGC + global srcdir subdir objdir + global TOOL_OPTIONS + global GCJ_UNDER_TEST + global tmpdir + global runtests + + set errname [file rootname [file tail $srcfile]] + if {! [runtest_file_p $runtests $errname]} { + return + } + + set args [libjava_arguments] + # Add the --main flag + lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]" + if { $compile_args != "" } { + lappend args "additional_flags=$compile_args" + } + + regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out + set executable "${objdir}/$out" + if { $compile_args != "" } { + set errname "$errname $compile_args" + } + + if { [target_compile $srcfile "$executable" executable $args] != "" } { + fail "$errname compilation from source" + setup_xfail "*-*-*" + fail "$errname execution from source compiled test" + setup_xfail "*-*-*" + fail "$errname output from source compiled test" + return; + } + pass "$errname compilation from source" + + if { $exec_args == "no-exec" } { + return + } + + set result [libjava_load $executable "$exec_args" "$inpfile"]; + set status [lindex $result 0]; + set output [lindex $result 1]; + $status "$errname execution from source compiled test" + if { $status != "pass" } { + setup_xfail "*-*-*" + fail "$errname output from source compiled test" + return; + } + + verbose "resultfile is $resultfile" + set id [open $resultfile r]; + set expected "" + append expected [read $id]; + regsub -all "\r" "$output" "" output; + regsub "\n*$" $expected "" expected + regsub "\n*$" $output "" output + regsub "^\n*" $expected "" expected + regsub "^\n*" $output "" output + regsub -all "\[ \t\]\[ \t\]*" $expected " " expected + regsub -all "\[ \t\]*\n\n*" $expected "\n" expected + regsub -all "\[ \t\]\[ \t\]*" $output " " output + regsub -all "\[ \t\]*\n\n*" $output "\n" output + verbose "expected is $expected" + verbose "actual is $output" + set passed 0; + if {$options == "regexp_match"} { + if [regexp $expected $output] { + set passed 1; + } + } else { + if { $expected == $output } { + set passed 1; + } + } + if { $passed == 1 } { + pass "$errname output from source compiled test" + } else { + clone_output "expected was $expected" + clone_output "output was $output" + fail "$errname output from source compiled test" + } + close $id; +} + +# +# Run the test specified by srcfile and resultfile. compile_args and +# exec_args are additional arguments to be passed in when compiling and +# running the testcase, respectively. +# +proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile exec_args } { + global base_dir + global LIBJAVA + global LIBGC + global srcdir subdir objdir + global TOOL_OPTIONS + global GCJ_UNDER_TEST + global tmpdir + global runtests + + set errname [file rootname [file tail $srcfile]] + if {! [runtest_file_p $runtests $errname]} { + return + } + + # bytecompile files with Sun's compiler for now. + set bc_ok [bytecompile_file $srcfile $objdir] + if {! $bc_ok} then { + fail "$errname byte compilation" + setup_xfail "*-*-*" + fail "$errname compilation from bytecode" + setup_xfail "*-*-*" + fail "$errname execution from bytecode->native test" + setup_xfail "*-*-*" + fail "$errname output from bytecode->native test" + return + } + pass "$errname byte compilation" + + # Find name to use for --main, and name of all class files. + set jvscan [find_jvscan] + verbose "jvscan is $jvscan" + set main_name [string trim \ + [target_compile $srcfile "" none \ + "compiler=$jvscan additional_flags=--print-main"]] + verbose "main name is $main_name" + set class_out [string trim \ + [target_compile $srcfile "" none \ + "compiler=$jvscan additional_flags=--list-class"]] + verbose "class list is $class_out" + # FIXME: As of Wed Feb 24 1999, `jv-scan --list-class' prints + # nothing if the file contains an interface and not a class. I + # believe this is a jv-scan bug. + if {$class_out == ""} then { + set class_files [file rootname [file tail $srcfile]].class + } else { + # Turn "a b" into "a.class b.class". + set class_files [join [split [string trim $class_out]] ".class "].class + } + + # Initial arguments. + set args [libjava_arguments] + + # Usually it is an error for a test program not to have a `main' + # method. However, for no-exec tests it is ok. + if {$main_name == ""} { + if {$exec_args != "no-exec"} { + perror "No `main' given in program $errname" + return + } else { + set type object + set executable [file rootname [file tail $srcfile]].o + } + } else { + set type executable + lappend args "additional_flags=--main=$main_name" + set executable "${objdir}/$main_name" + } + + if { $compile_args != "" } { + lappend args "additional_flags=$compile_args" + } + + if { $compile_args != "" } { + set errname "$errname $compile_args" + } + + if { [target_compile $class_files "$executable" $type $args] != "" } { + fail "$errname compilation from bytecode" + setup_xfail "*-*-*" + if {$exec_args != "no-exec"} { + fail "$errname execution from bytecode->native test" + setup_xfail "*-*-*" + fail "$errname output from bytecode->native test" + } + return; + } + pass "$errname compilation from bytecode" + + if { $exec_args == "no-exec" } { + return + } + + set result [libjava_load $executable "$exec_args" "$inpfile"]; + set status [lindex $result 0]; + set output [lindex $result 1]; + $status "$errname execution from bytecode->native test" + if { $status != "pass" } { + setup_xfail "*-*-*" + fail "$errname output from bytecode->native test" + return; + } + + verbose "resultfile is $resultfile" + set id [open $resultfile r]; + set expected "" + append expected [read $id]; + regsub -all "\r" "$output" "" output; + regsub "\n*$" $expected "" expected + regsub "\n*$" $output "" output + regsub "^\n*" $expected "" expected + regsub "^\n*" $output "" output + regsub -all "\[ \t\]\[ \t\]*" $expected " " expected + regsub -all "\[ \t\]*\n\n*" $expected "\n" expected + regsub -all "\[ \t\]\[ \t\]*" $output " " output + regsub -all "\[ \t\]*\n\n*" $output "\n" output + verbose "expected is $expected" + verbose "actual is $output" + set passed 0; + if {$options == "regexp_match"} { + if [regexp $expected $output] { + set passed 1; + } + } else { + if { $expected == $output } { + set passed 1; + } + } + if { $passed == 1 } { + pass "$errname output from bytecode->native test" + } else { + clone_output "expected was $expected" + clone_output "output was $output" + fail "$errname output from bytecode->native test" + } + close $id; +} + +# +# Run the test specified by srcfile and resultfile. compile_args and +# exec_args are additional arguments to be passed in when compiling and +# running the testcase, respectively. +# +proc test_libjava { options srcfile compile_args inpfile resultfile exec_args } { + test_libjava_from_source $options $srcfile $compile_args $inpfile $resultfile $exec_args + test_libjava_from_javac $options $srcfile $compile_args $inpfile $resultfile $exec_args + } + +# +# libjava_version -- extract and print the version number of libjavap +# +proc default_libjava_version {} { +} + +proc default_libjava_start { } { +} diff --git a/libjava/testsuite/libjava.compile/Case.java b/libjava/testsuite/libjava.compile/Case.java new file mode 100644 index 00000000000..c5eb1d51947 --- /dev/null +++ b/libjava/testsuite/libjava.compile/Case.java @@ -0,0 +1,15 @@ +// Simple compiler test. + +public class Case +{ + public static int foo (int i, support.Case x) + { + switch (i) + { + case x.A: + return 1; + default: + return 0; + } + } +} diff --git a/libjava/testsuite/libjava.compile/Semi.java b/libjava/testsuite/libjava.compile/Semi.java new file mode 100644 index 00000000000..39b3edc84b8 --- /dev/null +++ b/libjava/testsuite/libjava.compile/Semi.java @@ -0,0 +1,8 @@ +// Simple compiler test. + +public class Semi +{ + Semi () { }; +} + + diff --git a/libjava/testsuite/libjava.compile/Statics.java b/libjava/testsuite/libjava.compile/Statics.java new file mode 100644 index 00000000000..b86a57c409e --- /dev/null +++ b/libjava/testsuite/libjava.compile/Statics.java @@ -0,0 +1,7 @@ +// Simple compiler test. + +public interface Statics { + + public static final int OwnerGrabButtonMask = 1<<24; + +} diff --git a/libjava/testsuite/libjava.compile/Twice.java b/libjava/testsuite/libjava.compile/Twice.java new file mode 100644 index 00000000000..d80760f4dd5 --- /dev/null +++ b/libjava/testsuite/libjava.compile/Twice.java @@ -0,0 +1,14 @@ +// Simple compiler test. + +public class Twice +{ + Twice (boolean q) + { + if (q) + for (int p = 0; p < 10; p++); + else + for (int p = 0; p < 10; p++); + } +} + + diff --git a/libjava/testsuite/libjava.compile/Where.java b/libjava/testsuite/libjava.compile/Where.java new file mode 100644 index 00000000000..08fcc78b1d6 --- /dev/null +++ b/libjava/testsuite/libjava.compile/Where.java @@ -0,0 +1,12 @@ +// Simple compiler test. + +public final class Where implements support.Waldo +{ + int WhereIsWaldo () + { + // The compiler should find 'here' in support.Waldo. + return here; + } +} + + diff --git a/libjava/testsuite/libjava.compile/euc_comment1.java b/libjava/testsuite/libjava.compile/euc_comment1.java new file mode 100644 index 00000000000..bb556236eac --- /dev/null +++ b/libjava/testsuite/libjava.compile/euc_comment1.java @@ -0,0 +1,5 @@ +public class euc_comment1 { + public static void main(String[] args) { + /* ÆþÎÏ */ + } +} diff --git a/libjava/testsuite/libjava.compile/euc_comment2.java b/libjava/testsuite/libjava.compile/euc_comment2.java new file mode 100644 index 00000000000..9a9426f8005 --- /dev/null +++ b/libjava/testsuite/libjava.compile/euc_comment2.java @@ -0,0 +1,5 @@ +public class euc_comment2 { + public static void main(String[] args) { + // ÆþÎÏ + } +} diff --git a/libjava/testsuite/libjava.compile/euc_comment3.java b/libjava/testsuite/libjava.compile/euc_comment3.java new file mode 100644 index 00000000000..b0f35d09d34 --- /dev/null +++ b/libjava/testsuite/libjava.compile/euc_comment3.java @@ -0,0 +1,5 @@ +public class euc_comment3 { + public static void main(String[] args) { + // ÆþÎÏ + } +} diff --git a/libjava/testsuite/libjava.compile/perc.java b/libjava/testsuite/libjava.compile/perc.java new file mode 100644 index 00000000000..8dc2f6f01fb --- /dev/null +++ b/libjava/testsuite/libjava.compile/perc.java @@ -0,0 +1,9 @@ +// This generates code that `gcj -C' doesn't like. + +public class perc +{ + public static void main (String[] args) + { + System.out.println (27.0 % 10.0); + } +} diff --git a/libjava/testsuite/libjava.compile/sjis_comment1.java b/libjava/testsuite/libjava.compile/sjis_comment1.java new file mode 100644 index 00000000000..26132821960 --- /dev/null +++ b/libjava/testsuite/libjava.compile/sjis_comment1.java @@ -0,0 +1,5 @@ +public class sjis_comment1 { + public static void main(String[] args) { + /* “ü—Í */ + } +} diff --git a/libjava/testsuite/libjava.compile/sjis_comment2.java b/libjava/testsuite/libjava.compile/sjis_comment2.java new file mode 100644 index 00000000000..d4ae92f191b --- /dev/null +++ b/libjava/testsuite/libjava.compile/sjis_comment2.java @@ -0,0 +1,5 @@ +public class sjis_comment2 { + public static void main(String[] args) { + // “ü—Í + } +} diff --git a/libjava/testsuite/libjava.compile/sjis_comment3.java b/libjava/testsuite/libjava.compile/sjis_comment3.java new file mode 100644 index 00000000000..7370c4e444d --- /dev/null +++ b/libjava/testsuite/libjava.compile/sjis_comment3.java @@ -0,0 +1,5 @@ +public class sjis_comment3 { + public static void main(String[] args) { + // “ü—Í + } +} diff --git a/libjava/testsuite/libjava.compile/support/Case.java b/libjava/testsuite/libjava.compile/support/Case.java new file mode 100644 index 00000000000..709b47aca5a --- /dev/null +++ b/libjava/testsuite/libjava.compile/support/Case.java @@ -0,0 +1,6 @@ +package support; + +public class Case +{ + public static final int A = 9; +} diff --git a/libjava/testsuite/libjava.compile/support/Waldo.java b/libjava/testsuite/libjava.compile/support/Waldo.java new file mode 100644 index 00000000000..e28829d7af5 --- /dev/null +++ b/libjava/testsuite/libjava.compile/support/Waldo.java @@ -0,0 +1,7 @@ +package support; + +public interface Waldo { + + public static final int here = 9; + +} diff --git a/libjava/testsuite/libjava.compile/test.exp b/libjava/testsuite/libjava.compile/test.exp new file mode 100644 index 00000000000..db6aef19bb3 --- /dev/null +++ b/libjava/testsuite/libjava.compile/test.exp @@ -0,0 +1,10 @@ +global srcdir subdir + +catch "glob -nocomplain ${srcdir}/${subdir}/*.java" srcfiles +verbose "srcfiles are $srcfiles" + +set prefix "" +foreach x $srcfiles { + test_libjava $options "$x" "" "" "" "no-exec" + test_libjava $options "$x" "-O" "" "" "no-exec" +} diff --git a/libjava/testsuite/libjava.lang/Array_1.java b/libjava/testsuite/libjava.lang/Array_1.java new file mode 100644 index 00000000000..1fcf04eeb4d --- /dev/null +++ b/libjava/testsuite/libjava.lang/Array_1.java @@ -0,0 +1,18 @@ +// Test of array stuff. Technically this probably isn't in java.lang. + +public class Array_1 +{ + public static void main (String[] args) + { + int x[][] = { { 1, 2}, null }; + + System.out.println(Cloneable.class.isInstance(x)); + + // This example is from the Java Spec book. + int y[][] = (int[][]) x.clone(); + System.out.println(x == y); + System.out.println(x[0] == y[0] && x[1] == y[1]); + + System.out.println(x.getClass().getSuperclass()); + } +} diff --git a/libjava/testsuite/libjava.lang/Array_1.out b/libjava/testsuite/libjava.lang/Array_1.out new file mode 100644 index 00000000000..3cc754d2ef9 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Array_1.out @@ -0,0 +1,4 @@ +true +false +true +class java.lang.Object diff --git a/libjava/testsuite/libjava.lang/Finalize_1.java b/libjava/testsuite/libjava.lang/Finalize_1.java new file mode 100644 index 00000000000..b1a4d9575f2 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Finalize_1.java @@ -0,0 +1,28 @@ +// Finalize.java - Test code for finalizers. + +import java.io.*; +import java.util.*; +import java.lang.Runtime; + +public final class Finalize_1 +{ + public static void main (String[] args) + { + Finalize_1 f; + Runtime t; + + t = Runtime.getRuntime (); + + for (int i = 0; i < 3; ++i) + f = new Finalize_1 (); + f = null; + + t.gc (); + t.runFinalization (); + } + + public void finalize () throws Throwable + { + System.out.print ("Finalize "); + } +} diff --git a/libjava/testsuite/libjava.lang/Finalize_1.out b/libjava/testsuite/libjava.lang/Finalize_1.out new file mode 100644 index 00000000000..45b1f96bfa0 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Finalize_1.out @@ -0,0 +1 @@ +Finalize Finalize Finalize diff --git a/libjava/testsuite/libjava.lang/Float_1.java b/libjava/testsuite/libjava.lang/Float_1.java new file mode 100644 index 00000000000..cb147ee8aca --- /dev/null +++ b/libjava/testsuite/libjava.lang/Float_1.java @@ -0,0 +1,52 @@ +/* + +Date: 25 Aug 1998 16:04:00 -0000 +From: Andrew Haley <aph@pasanda.cygnus.co.uk> +To: java-project@cygnus.com +Subject: Help: vtable problem? + +My little program: + +----------------------------------------------------------------------- +import java.lang.*; + + public class widget + { + public static void main (String argv[]) + { + int test = Float.floatToIntBits((float)2.0); + String s = Integer.toHexString(test); + + System.out.print (s+"\n"); + } + + } +----------------------------------------------------------------------- +prints out + +40000000 + +with Sun's interpreter, but prints out + +true + +when compiled with gcj; PrintStream dispatches a string arg as a +boolean rather than as a String. I've tried to rebuild everything. + +? + +Thanks, +Andrew. + +*/ + +public class Float_1 +{ + public static void main (String argv[]) + { + int test = Float.floatToIntBits((float)2.0); + String s = Integer.toHexString(test); + + System.out.print (s+"\n"); + } +} diff --git a/libjava/testsuite/libjava.lang/Float_1.out b/libjava/testsuite/libjava.lang/Float_1.out new file mode 100644 index 00000000000..52f3f6a7451 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Float_1.out @@ -0,0 +1 @@ +40000000 diff --git a/libjava/testsuite/libjava.lang/Invoke_1.java b/libjava/testsuite/libjava.lang/Invoke_1.java new file mode 100644 index 00000000000..bc4678301ce --- /dev/null +++ b/libjava/testsuite/libjava.lang/Invoke_1.java @@ -0,0 +1,27 @@ +// Test of failing method invocation. + +public class Invoke_1 +{ + public void call_me () + { + System.out.println ("no"); + } + + public static Invoke_1 get_i () + { + return null; + } + + public static void main (String[] args) + { + Invoke_1 i = get_i (); + try + { + i.call_me (); + } + catch (NullPointerException ok) + { + System.out.println ("ok"); + } + } +} diff --git a/libjava/testsuite/libjava.lang/Invoke_1.out b/libjava/testsuite/libjava.lang/Invoke_1.out new file mode 100644 index 00000000000..9766475a418 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Invoke_1.out @@ -0,0 +1 @@ +ok diff --git a/libjava/testsuite/libjava.lang/Synch.java b/libjava/testsuite/libjava.lang/Synch.java new file mode 100644 index 00000000000..15e2d26b4a5 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Synch.java @@ -0,0 +1,17 @@ +public class Synch +{ + public synchronized void s() + { + // This call to notify() isn't supposed to cause a + // java.lang.IllegalMonitorStateException. + notify (); + } + + public static void main (String[] args) + { + (new Synch()).s(); + System.out.println ("Ok"); + } +} + + diff --git a/libjava/testsuite/libjava.lang/Synch.out b/libjava/testsuite/libjava.lang/Synch.out new file mode 100644 index 00000000000..7326d960397 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Synch.out @@ -0,0 +1 @@ +Ok diff --git a/libjava/testsuite/libjava.lang/Thread_1.java b/libjava/testsuite/libjava.lang/Thread_1.java new file mode 100644 index 00000000000..932afa5dd73 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_1.java @@ -0,0 +1,182 @@ +// Various thread tests. + +public class Thread_1 extends Thread +{ + // The group for the workers. + static ThreadGroup subgroup; + + // Which piece of test code to try. + static int test_case; + + // Names of the tests. + static final int JOIN_GOOD = 0; + static final int JOIN_TIMEOUT = 1; + static final int JOIN_INTERRUPTED = 2; + static final int THREAD_EXIT = 3; + + // True if this is normal; false if daemon. + boolean normal; + // The other thread in the test. + Thread_1 other; + // True when the thread has entered run(). + boolean started; + + public void run () + { + try + { + if (normal) + { + System.out.println ("test " + test_case); + // Tell the main thread to start the daemon thread. + synchronized (this) + { + started = true; + notify (); + } + // Now wait for daemon to start. + synchronized (other) + { + while (! other.started) + other.wait (); + } + switch (test_case) + { + case JOIN_GOOD: + other.join (); + System.out.println ("joined"); + break; + case JOIN_TIMEOUT: + other.join (10); + System.out.println (other.isAlive()); + other.join (); + break; + case JOIN_INTERRUPTED: + other.join (); + System.out.println ("joined"); + break; + case THREAD_EXIT: + // Nothing. + break; + + default: + System.out.println ("failure"); + break; + } + } + else + { + // Let the normal thread start first. + synchronized (other) + { + while (! other.started) + other.wait(); + } + // Tell normal thread that we've started. + synchronized (this) + { + started = true; + notify (); + } + switch (test_case) + { + case JOIN_GOOD: + System.out.println ("daemon done"); + break; + case JOIN_TIMEOUT: + sleep (50); + break; + case JOIN_INTERRUPTED: + other.interrupt (); + break; + case THREAD_EXIT: + // Wait for a while. However, don't wait indefinitely + // -- we want this thread to terminate so that the + // process won't hang if there is a bug. + sleep (10000); + System.out.println ("daemon still alive"); + break; + + default: + System.out.println ("failure"); + break; + } + } + } + catch (InterruptedException e) + { + System.out.println ("interrupted"); + } + } + + public void setOther (Thread_1 x) + { + other = x; + } + + Thread_1 (String name, boolean x) + { + super (subgroup, name); + normal = x; + started = false; + setDaemon (! normal); + } + + // Run a single test. + static Thread_1 doit (int what) + { + // FIXME: we used to just use the same threads each time. That + // didn't work -- must debug. + Thread_1 dt = new Thread_1 ("daemon", false); + Thread_1 nt = new Thread_1 ("normal", true); + + dt.setOther(nt); + nt.setOther(dt); + + test_case = what; + try + { + nt.start(); + dt.start(); + + // Don't wait for the threads if we're doing the exit test. + if (what != THREAD_EXIT) + { + nt.join (); + dt.join (); + } + } + catch (InterruptedException e) + { + System.out.println ("caught bad exception"); + } + + return dt; + } + + public static void main (String[] args) + { + subgroup = new ThreadGroup ("sub"); + + doit (JOIN_GOOD); + + System.out.println ("active count = " + subgroup.activeCount ()); + + Thread_1 dt = doit (JOIN_TIMEOUT); + // Make sure that joining a dead thread works. + System.out.println ("still alive: " + dt.isAlive ()); + try + { + dt.join (); + } + catch (InterruptedException e) + { + System.out.println ("exception caught"); + } + + doit (JOIN_INTERRUPTED); + + // This test must come last. + doit (THREAD_EXIT); + } +} diff --git a/libjava/testsuite/libjava.lang/Thread_1.out b/libjava/testsuite/libjava.lang/Thread_1.out new file mode 100644 index 00000000000..1bd7a0124d9 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_1.out @@ -0,0 +1,10 @@ +test 0 +daemon done +joined +active count = 2 +test 1 +true +still alive: false +test 2 +interrupted +test 3 diff --git a/libjava/testsuite/libjava.lang/Throw_1.java b/libjava/testsuite/libjava.lang/Throw_1.java new file mode 100644 index 00000000000..4a0780aec06 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Throw_1.java @@ -0,0 +1,25 @@ +// Some tests of `throw'. + +public class Throw_1 +{ + public static Throwable get () + { + return null; + } + + public static void main (String[] args) + { + Throwable t = get (); + try + { + throw t; + } + catch (NullPointerException y) + { + } + catch (Throwable x) + { + System.out.println ("no"); + } + } +} diff --git a/libjava/testsuite/libjava.lang/Throw_1.out b/libjava/testsuite/libjava.lang/Throw_1.out new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/libjava/testsuite/libjava.lang/Throw_1.out diff --git a/libjava/testsuite/libjava.lang/test.exp b/libjava/testsuite/libjava.lang/test.exp new file mode 100644 index 00000000000..cfe9cf5069c --- /dev/null +++ b/libjava/testsuite/libjava.lang/test.exp @@ -0,0 +1,34 @@ +global srcdir subdir + +catch "glob -nocomplain ${srcdir}/${subdir}/*.out" srcfiles +verbose "srcfiles are $srcfiles" + +set prefix "" +foreach x $srcfiles { + regsub "\\.out$" $x "" prefix + set bname [file tail $prefix] + set args "" + if [file exists $srcdir/$subdir/${bname}.arg] { + set id [open "$srcdir/$subdir/${bname}.arg" r]; + set args [read -nonewline $id]; + close $id; + } + if [file exists $srcdir/$subdir/${bname}.xpo] { + set resfile "$srcdir/$subdir/${bname}.xpo" + set options "regexp_match" + } else { + set resfile "${prefix}.out" + set options "" + } + + if [file exists ${prefix}.inp] { + set inpfile ${prefix}.inp + } else { + set inpfile "" + } + + verbose "inpfile is $inpfile" + + test_libjava $options "${prefix}.java" "" $inpfile $resfile $args + test_libjava $options "${prefix}.java" "-O" $inpfile $resfile $args +} diff --git a/libjava/testsuite/libjava.mauve/DejaGNUTestHarness.java b/libjava/testsuite/libjava.mauve/DejaGNUTestHarness.java new file mode 100644 index 00000000000..5c1cf5ec7c9 --- /dev/null +++ b/libjava/testsuite/libjava.mauve/DejaGNUTestHarness.java @@ -0,0 +1,31 @@ +// Copyright (c) 1998, 1999 Cygnus Solutions + +// Written by Tom Tromey <tromey@cygnus.com> + +import gnu.testlet.*; + +public class DejaGNUTestHarness extends SimpleTestHarness +{ + static String dejasrcdir; + + public String getSourceDirectory () + { + return dejasrcdir; + } + + private DejaGNUTestHarness () + { + super (/* verbose */ true, /* debug */ false); + } + + public static void main (String[] args) + { + dejasrcdir = args.length > 0 ? args[0] : ""; + DejaGNUTestHarness harness = new DejaGNUTestHarness (); + // This might seem weird, given that we check args.length above. + // However, in some cases the expect code rewrites this runtest + // invocation to have an explicit name for the test to run. + harness.runtest (args[1]); + System.exit(harness.done()); + } +} diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp new file mode 100644 index 00000000000..7d5e71e7965 --- /dev/null +++ b/libjava/testsuite/libjava.mauve/mauve.exp @@ -0,0 +1,355 @@ +# Copyright (C) 1998, 1999 Cygnus Solutions. +# Written by Tom Tromey <tromey@cygnus.com>. +# Incorporate Mauve into libjava's DejaGNU test suite framework. + +# FIXME: should be able to compile from source as well as from .class. + + +# Compute list of files to compile. Returns list of all files +# representing classes that must be tested. Result parameter `uses' +# maps source file names onto list of objects required for link. +proc mauve_compute_uses {aName} { + upvar $aName uses + global env + + set fd [open classes r] + set line [read $fd] + close $fd + + foreach item [split $line] { + if {$item == ""} then { + continue + } + set item [join [split $item .] /].java + + # Look for Uses line in source file. + set fd [open $env(MAUVEDIR)/$item r] + set ufiles [list $item] + set dir [file dirname $item] + while {[gets $fd sline] != -1} { + if {[regsub -- {^// Uses:} $sline {} sline]} then { + foreach uf [split $sline] { + if {$uf != ""} then { + lappend ufiles $dir/$uf + } + } + } + } + close $fd + + set uses($item) {} + foreach file $ufiles { + set file [file rootname $file].o + lappend uses($item) $file + } + } + + return [lsort [array names uses]] +} + +# Run all the Mauve tests. +proc test_mauve {} { + global srcdir subdir env + + if {! [info exists env(MAUVEDIR)]} then { + verbose "MAUVEDIR not set; not running Mauve tests" + return + } + + # Run in subdir so we don't overwrite our own Makefile. + catch {system "rm -rf mauve-build"} + file mkdir mauve-build + # Some weirdness to set srcdir correctly. + set here [pwd] + cd $srcdir + set full_srcdir [pwd] + cd $here/mauve-build + + if {[catch {system "$env(MAUVEDIR)/configure --with-gcj"} msg]} then { + fail "Mauve configure" + verbose "configure failed with $msg" + return + } + pass "Mauve configure" + + # Copy appropriate tags file locally. + set fd [open $full_srcdir/../mauve-libgcj r] + set c [read $fd] + close $fd + set fd [open mauve-libgcj w] + puts -nonewline $fd $c + close $fd + + if {[catch {system "make KEYS=libjava classes.stamp"} msg]} then { + fail "Mauve build" + verbose "build failed with $msg" + return + } + pass "Mauve build" + + set srcfile $full_srcdir/$subdir/DejaGNUTestHarness.java + if {! [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]]} then { + fail "Compile DejaGNUTestHarness.java" + return + } + pass "Compile DejaGNUTestHarness.java" + + # Compute list of files to test, and also all files to build. + set choices [mauve_compute_uses uses] + + # Compute flags to use to do the build. + set compile_args [libjava_arguments] + set link_args [concat $compile_args \ + [list "additional_flags=--main=DejaGNUTestHarness"]] + + set ok 1 + set objlist {} + foreach base {DejaGNUTestHarness gnu/testlet/SimpleTestHarness gnu/testlet/TestHarness gnu/testlet/Testlet gnu/testlet/ResourceNotFoundException gnu/testlet/config} { + set file $base.class + set obj $base.o + if {[target_compile [pwd]/$file $obj object $compile_args] != ""} then { + fail "Compile $obj" + set ok 0 + } else { + pass "Compile $obj" + } + lappend objlist $obj + } + if {! $ok} then { + return + } + + set Executable DejaGNUTestHarness + foreach file $choices { + # Turn `java/lang/Foo.java' into `java.lang.Foo'. + set class [file rootname $file] + regsub -all -- / $class . class + + set ok 1 + foreach obj $uses($file) { + if {! [file exists $obj]} then { + verbose "compiling $obj for test of $class" + set srcfile [file rootname $obj].class + if {[target_compile [pwd]/$srcfile $obj object $compile_args] + != ""} then { + fail "Compile $obj for $class" + set ok 0 + break + } + pass "Compile $obj for $class" + } + } + if {! $ok} then { + continue + } + + if {[target_compile [concat $uses($file) $objlist] \ + $Executable executable $link_args] != ""} then { + fail "Link for $class" + continue + } + pass "Link for $class" + + set result [libjava_load [pwd]/DejaGNUTestHarness \ + "$env(MAUVEDIR) $class" ""] + if {[lindex $result 0] != "pass"} then { + fail "Execute for $class" + continue + } + + # Test for an exception thrown in the test harness itself. This + # isn't enough to test for all faults in the test harness, but + # it's better than nothing. + set output [lindex $result 1]; + if [regexp "Exception: " $output] then { + fail $output + continue + } + + pass "Execute for $class" + + # Extract pass/failure info from output. + foreach line [split [lindex $result 1] \n] { + if {[regexp -- {^(PASS|FAIL): (.*)$} $line ignore what msg]} then { + if {$what == "PASS"} then { + pass $msg + } else { + fail $msg + } + } + } + } +} + +# Run all the Mauve tests in a sim environment. In this case, the +# program cannot use argv[] because there's no way to pass in the +# command line, so tha name of the class to test is substituted by +# patching the source of the DejaGNUTestHarness. +proc test_mauve_sim {} { + global srcdir subdir env + + if {! [info exists env(MAUVEDIR)]} then { + verbose "MAUVEDIR not set; not running Mauve tests" + return + } + + # Run in subdir so we don't overwrite our own Makefile. + catch {system "rm -rf mauve-build"} + file mkdir mauve-build + # Some weirdness to set srcdir correctly. + set here [pwd] + cd $srcdir + set full_srcdir [pwd] + cd $here/mauve-build + + if {[catch {system "$env(MAUVEDIR)/configure --with-gcj"} msg]} then { + fail "Mauve configure" + verbose "configure failed with $msg" + return + } + pass "Mauve configure" + + # Copy appropriate tags file locally. + set fd [open $full_srcdir/../mauve-libgcj r] + set c [read $fd] + close $fd + set fd [open mauve-libgcj w] + puts -nonewline $fd $c + close $fd + + if {[catch {system "make KEYS=libjava classes.stamp"} msg]} then { + fail "Mauve build" + verbose "build failed with $msg" + return + } + pass "Mauve build" + + # Compute list of files to test, and also all files to build. + set choices [mauve_compute_uses uses] + + # Compute flags to use to do the build. + set compile_args [libjava_arguments] + set link_args [concat $compile_args \ + [list "additional_flags=--main=DejaGNUTestHarness"]] + + set ok 1 + set objlist {} + foreach base {gnu/testlet/SimpleTestHarness gnu/testlet/TestHarness \ + gnu/testlet/Testlet gnu/testlet/ResourceNotFoundException \ + gnu/testlet/config} { + set file $base.class + set obj $base.o + if {[target_compile [pwd]/$file $obj object $compile_args] != ""} then { + fail "Compile $obj" + set ok 0 + } else { + pass "Compile $obj" + } + lappend objlist $obj + } + if {! $ok} then { + return + } + + lappend objlist gnu/testlet/DejaGNUTestHarness.o + + set Executable DejaGNUTestHarness + foreach file $choices { + # Turn `java/lang/Foo.java' into `java.lang.Foo'. + + set class [file rootname $file] + regsub -all -- / $class . class + + set ok 1 + foreach obj $uses($file) { + if {! [file exists $obj]} then { + verbose "compiling $obj for test of $class" + set srcfile [file rootname $obj].class + if {[target_compile [pwd]/$srcfile $obj object $compile_args] + != ""} then { + fail "Compile $obj for $class" + set ok 0 + break + } + pass "Compile $obj for $class" + } + } + if {! $ok} then { + continue + } + + set infile $full_srcdir/$subdir/DejaGNUTestHarness.java + set srcfile DejaGNUTestHarness.java + set f [open $infile r] + set d [open gnu/testlet/$srcfile w] + while {[gets $f line] >= 0} { + if [regexp {harness\.runtest \(args\[1\]\)} $line] then { + regsub {args\[1\]} $line "\"$class\"" out + } else { + set out $line + } + puts $d $out + } + close $f + close $d + + if {! [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \ + $env(MAUVEDIR):[pwd]]} then { + fail "Compile DejaGNUTestHarness.java" + return + } + + if {[target_compile gnu/testlet/DejaGNUTestHarness.class \ + gnu/testlet/DejaGNUTestHarness.o object $compile_args] + != ""} then { + fail "Compile DejaGNUTestHarness.java" + continue + } + + if {[target_compile [concat $uses($file) $objlist] \ + $Executable executable $link_args] != ""} then { + fail "Link for $class" + continue + } + pass "Link for $class" + + set result [libjava_load [pwd]/DejaGNUTestHarness \ + "$env(MAUVEDIR) $class" ""] + if {[lindex $result 0] != "pass"} then { + fail "Execute for $class" + continue + } + + # Test for an exception thrown in the test harness itself. This + # isn't enough to test for all faults in the test harness, but + # it's better than nothing. + set output [lindex $result 1]; + if [regexp "Exception: " $output] then { + fail $output + continue + } + + pass "Execute for $class" + + # Extract pass/failure info from output. + foreach line [split [lindex $result 1] \n] { + if {[regexp -- {^(PASS|FAIL): (.*)$} $line ignore what msg]} then { + if {$what == "PASS"} then { + pass $msg + } else { + fail $msg + } + } + } + } +} + +# The test_mauve* procs will change the current directory. It's +# simpler to fix this up here than to keep track of this in the procs. +set here [pwd] +if { [board_info target exists is_simulator] } { + test_mauve_sim +} else { + test_mauve +} +cd $here |