20000317 sourceware import
This commit is contained in:
82
libgloss/testsuite/libgloss.all/.gdbinit
Normal file
82
libgloss/testsuite/libgloss.all/.gdbinit
Normal file
@ -0,0 +1,82 @@
|
||||
define wec-test
|
||||
set height 0
|
||||
set remotedebug 0
|
||||
echo Running array test...
|
||||
load array-w89k.x
|
||||
run
|
||||
echo Running double test...
|
||||
load double-w89k.x
|
||||
run
|
||||
echo Running float test...
|
||||
load float-w89k.x
|
||||
run
|
||||
echo Running func test...
|
||||
load func-w89k.x
|
||||
run
|
||||
echo Running io test...
|
||||
load io-w89k.x
|
||||
run
|
||||
echo Running math test...
|
||||
load math-w89k.x
|
||||
run
|
||||
echo Running memory test...
|
||||
load memory-w89k.x
|
||||
run
|
||||
echo Running div test...
|
||||
load div-w89k.x
|
||||
run
|
||||
echo Running struct test...
|
||||
load struct-w89k.x
|
||||
run
|
||||
echo Running printf test...
|
||||
load printf-w89k.x
|
||||
run
|
||||
echo Running varargs test...
|
||||
load varargs-w89k.x
|
||||
run
|
||||
echo Running varargs2 test...
|
||||
load varargs2-w89k.x
|
||||
run
|
||||
end
|
||||
|
||||
define oki-test
|
||||
set height 0
|
||||
set remotedebug 0
|
||||
echo Running array test...
|
||||
load array-op50n.x
|
||||
run
|
||||
echo Running double test...
|
||||
load double-op50n.x
|
||||
run
|
||||
echo Running float test...
|
||||
load float-op50n.x
|
||||
run
|
||||
echo Running func test...
|
||||
load func-op50n.x
|
||||
run
|
||||
echo Running io test...
|
||||
load io-op50n.x
|
||||
run
|
||||
echo Running math test...
|
||||
load math-op50n.x
|
||||
run
|
||||
echo Running memory test...
|
||||
load memory-op50n.x
|
||||
run
|
||||
echo Running div test...
|
||||
load div-op50n.x
|
||||
run
|
||||
echo Running struct test...
|
||||
load struct-op50n.x
|
||||
run
|
||||
echo Running printf test...
|
||||
load printf-op50n.x
|
||||
run
|
||||
echo Running varargs test...
|
||||
load varargs-op50n.x
|
||||
run
|
||||
echo Running varargs2 test...
|
||||
load varargs2-op50n.x
|
||||
run
|
||||
end
|
||||
|
221
libgloss/testsuite/libgloss.all/Makefile.in
Normal file
221
libgloss/testsuite/libgloss.all/Makefile.in
Normal file
@ -0,0 +1,221 @@
|
||||
srcdir = .
|
||||
OBJROOT =
|
||||
SRCROOT =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
#
|
||||
# this is for code to support embedded testing
|
||||
#
|
||||
SUPPORT=support.o
|
||||
|
||||
#
|
||||
# to add a new test, put it's name here, and list the objects
|
||||
# required too.
|
||||
TESTS= misc.x float.x io.x memory.x double.x math.x func.x div.x \
|
||||
printf.x varargs.x varargs2.x array.x struct.x misc.x
|
||||
|
||||
CFLAGS= -g
|
||||
LDFLAGS_FOR_TARGET= -g
|
||||
LIBS_FOR_TARGET = ${SUPPORT} ${LIBC_FOR_TARGET} ${LIBGCC_FOR_TARGET} \
|
||||
${LIBC_FOR_TARGET}
|
||||
|
||||
#### Host, target, and site specific Makefile fragments come in here.
|
||||
###
|
||||
|
||||
#
|
||||
# This attempts to build the binaries. Ideally these are getting built
|
||||
# under control of DejaGnu, but it's nice to build these for times
|
||||
# when testing needs to be done by hand.
|
||||
#
|
||||
all: support.o ${TESTS}
|
||||
|
||||
#
|
||||
# we create a false implicit rule to make a binary ".x" file from
|
||||
# an object file. this also makes us an srecord and a dissasmbly
|
||||
# cause if something goes wrong, we'll need them.
|
||||
#
|
||||
.SUFFIXES: .x
|
||||
.o.x:
|
||||
for script in ${SCRIPTS}; do \
|
||||
echo Building $@ for $${script}... ; \
|
||||
echo Link Line is ${LD_FOR_TARGET} \
|
||||
${LDFLAGS_FOR_TARGET} $< -L${OBJROOT}/libgloss/${GLOSSDIR} \
|
||||
-T${srcdir}/../../${GLOSSDIR}/$${script}.ld \
|
||||
${SUPPORT} -o $*-$${script} $(LIBS_FOR_TARGET); \
|
||||
${LD_FOR_TARGET} ${LDFLAGS_FOR_TARGET} $< -L${OBJROOT}/libgloss/${GLOSSDIR} \
|
||||
-T${srcdir}/../../${GLOSSDIR}/$${script}.ld \
|
||||
${SUPPORT} -o $*-$${script}.x $(LIBS_FOR_TARGET); \
|
||||
if [ -s $*-$${script}.x ] ; then \
|
||||
echo "Making an srecord for $@..." ; \
|
||||
${OBJCOPY_FOR_TARGET} -O srec $*-$${script}.x $*-$${script}.srec ; \
|
||||
echo "Making an disassembly file for $@..." ; \
|
||||
rm -f $*-$${script}.dis ; \
|
||||
${OBJDUMP_FOR_TARGET} -d $*-$${script}.x > $*-$${script}.dis ; \
|
||||
else \
|
||||
rm $*-$${script}.x ; \
|
||||
echo "WARNING: $*-$${script} didn't build." ; \
|
||||
fi ; \
|
||||
touch $@ ; \
|
||||
done
|
||||
|
||||
#
|
||||
# here's all the dependancies. This is a little messy cause we want
|
||||
# dependancies to work for the rule we just defined. this isn't
|
||||
# tottally ideal cause if one of the architectures doesn't build. it
|
||||
# relinks for all of the scrip0t files.
|
||||
#
|
||||
array.o: ${srcdir}/array.c
|
||||
array.x: array-w89k.x array-op50n.x
|
||||
array-w89k.x: array.o
|
||||
array-op50n.x: array.o
|
||||
float.o: ${srcdir}/float.c
|
||||
float.x: float-w89k.x float-op50n.x
|
||||
float-w89k.x: float.o
|
||||
float-op50n.x: float.o
|
||||
io.o: ${srcdir}/io.c
|
||||
io.x: io-w89k.x io-op50n.x
|
||||
io-w89k.x: io.o
|
||||
io-op50n.x: io.o
|
||||
memory.o: ${srcdir}/memory.c
|
||||
memory.x: memory-w89k.x memory-op50n.x
|
||||
memory-w89k.x: memory.o
|
||||
memory-op50n.x: memory.o
|
||||
double.o: ${srcdir}/double.c
|
||||
double.x: double-w89k.x double-op50n.x
|
||||
double-w89k.x: double.o
|
||||
double-op50n.x: double.o
|
||||
math.o: ${srcdir}/math.c
|
||||
math.x: math-w89k.x math-op50n.x
|
||||
math-w89k.x: math.o
|
||||
math-op50n.x: math.o
|
||||
misc.o: ${srcdir}/misc.c
|
||||
misc.x: misc-w89k.x misc-op50n.x
|
||||
misc-w89k.x: misc.o
|
||||
misc-op50n.x: misc.o
|
||||
func.o: ${srcdir}/func.c
|
||||
func.x: func-w89k.x func-op50n.x
|
||||
func-w89k.x: func.o
|
||||
func-op50n.x: func.o
|
||||
div.o: ${srcdir}/div.c
|
||||
div.x: div-w89k.x div-op50n.x
|
||||
div-w89k.x: div.o
|
||||
div-op50n.x: div.o
|
||||
struct.o: ${srcdir}/struct.c
|
||||
struct.x: struct-w89k.x struct-op50n.x
|
||||
struct-w89k.x: struct.o
|
||||
struct-op50n.x: struct.o
|
||||
printf.o: ${srcdir}/printf.c
|
||||
printf.x: printf-w89k.x printf-op50n.x
|
||||
printf-w89k.x: printf.o
|
||||
printf-op50n.x: printf.o
|
||||
varargs.o: ${srcdir}/varargs.c
|
||||
varargs.x: varargs-w89k.x varargs-op50n.x
|
||||
varargs-w89k.x: varargs.o
|
||||
varargs-op50n.x: varargs.o
|
||||
varargs2.o: ${srcdir}/varargs2.c
|
||||
varargs2.x: varargs2-w89k.x varargs2-op50n.x
|
||||
varargs2-w89k.x: varargs2.o
|
||||
varargs2-op50n.x: varargs.o
|
||||
misc.o: ${srcdir}/misc.c
|
||||
misc.x: misc-w89k.x misc-op50n.x
|
||||
misc-w89k.x: misc.o
|
||||
misc-op50n.x: misc.o
|
||||
|
||||
#
|
||||
# this attempts to build these test cases on a DOS box
|
||||
#
|
||||
DOSLIBS= ../lib/soft-flo/libc.a ../lib/soft-flo/libgcc.a ../lib/soft-flo/libc.a
|
||||
LIBDIR= -L../lib
|
||||
dos:
|
||||
gcc -msoft-float -c support.c
|
||||
gcc -msoft-float -c io.c
|
||||
gcc -msoft-float -c float.c
|
||||
gcc -msoft-float -c memory.c
|
||||
gcc -msoft-float -c double.c
|
||||
gcc -msoft-float -c func.c
|
||||
gcc -msoft-float -c array.c
|
||||
gcc -msoft-float -c math.c
|
||||
gcc -msoft-float -c div.c
|
||||
gcc -msoft-float -c struct.c
|
||||
gcc -msoft-float -c printf.c
|
||||
gcc -msoft-float -c varargs.c
|
||||
gcc -msoft-float -c varargs2.c
|
||||
gcc -msoft-float -c misc.c
|
||||
ld ${LIBDIR} io.o -Tw89k.ld -o io-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec io-wec.x io-wec.sre
|
||||
ld ${LIBDIR} io.o -Top50n.ld -o io-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec io-oki.x io-oki.sre
|
||||
ld ${LIBDIR} func.o -Tw89k.ld -o func-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec func-wec.x func-wec.sre
|
||||
ld ${LIBDIR} func.o -Top50n.ld -o func-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec func-oki.x func-oki.sre
|
||||
ld ${LIBDIR} math.o -Tw89k.ld -o math-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec math-wec.x math-wec.sre
|
||||
gcc ${LIBDIR} math.o -Top50n.ld -o math-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec math-oki.x math-oki.sre
|
||||
gcc ${LIBDIR} float.o -Tw89k.ld -o flot-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec flot-wec.x flot-wec.sre
|
||||
gcc ${LIBDIR} float.o -Top50n.ld -o flot-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec flot-oki.x flot-oki.sre
|
||||
gcc ${LIBDIR} memory.o -Tw89k.ld -o mem-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec mem-wec.x mem-wec.sre
|
||||
gcc ${LIBDIR} memory.c -Top50n.ld -o mem-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec mem-oki.x mem-oki.sre
|
||||
gcc ${LIBDIR} double.o -Tw89k.ld -o doub-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec mem-wec.x doub-wec.sre
|
||||
gcc ${LIBDIR} double.o -Top50n.ld -o doub-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec doub-oki.x doub-oki.sre
|
||||
gcc ${LIBDIR} array.o -Tw89k.ld -o arry-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec arry-wec.x arry-wec.sre
|
||||
gcc ${LIBDIR} array.o -Top50n.ld -o arry-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec arry-oki.x arry-oki.sre
|
||||
gcc ${LIBDIR} div.o -Tw89k.ld -o div-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec div-wec.x div-wec.sre
|
||||
gcc ${LIBDIR} div.o -Top50n.ld -o div-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec div-oki.x div-oki.sre
|
||||
gcc ${LIBDIR} printf.o -Tw89k.ld -o printf-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec printf-wec.x printf-wec.sre
|
||||
gcc ${LIBDIR} printf.o -Top50n.ld -o printf-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec printf-oki.x printf-oki.sre
|
||||
gcc ${LIBDIR} struct.o -Tw89k.ld -o struct-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec struct-wec.x struct-wec.sre
|
||||
gcc ${LIBDIR} struct.o -Top50n.ld -o struct-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec struct-oki.x struct-oki.sre
|
||||
gcc ${LIBDIR} varargs.o -Tw89k.ld -o args-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec args-wec.x args-wec.sre
|
||||
gcc ${LIBDIR} varargs.o -Top50n.ld -o args-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec args-oki.x args-oki.sre
|
||||
gcc ${LIBDIR} varargs2.o -Tw89k.ld -o arg2-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec arg2-wec.x arg2-wec.sre
|
||||
gcc ${LIBDIR} varargs2.o -Top50n.ld -o arg2-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec arg2-oki.x arg2-oki.sre
|
||||
gcc ${LIBDIR} misc.o -Tw89k.ld -o misc-wec.x support.o ${DOSLIBS}
|
||||
objcopy -O srec misc-wec.x misc-wec.sre
|
||||
gcc ${LIBDIR} misc.o -Top50n.ld -o misc-oki.x support.o ${DOSLIBS}
|
||||
objcopy -O srec misc-oki.x misc-oki.sre
|
||||
|
||||
# this is a minimalist testing API for these test cases to keep the
|
||||
# outout standardized enough to help with automated testing.
|
||||
support.o: ${srcdir}/../config/support.c
|
||||
rootme=`pwd | sed -e 's@/[^/]*$$@@'`; \
|
||||
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $<
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status a.out
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag)
|
||||
$(SHELL) config.status
|
||||
|
||||
|
18
libgloss/testsuite/libgloss.all/array.c
Normal file
18
libgloss/testsuite/libgloss.all/array.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* WinBond bug report
|
||||
|
||||
this is a compile test. At one time static arrays over 500 elements
|
||||
didn't work. We'll test both global and local array. If it compiles at
|
||||
all, it it passes.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
static short aa[64][64];
|
||||
static int bb[500];
|
||||
|
||||
main()
|
||||
{
|
||||
static short cc[64][64];
|
||||
static int dd[500];
|
||||
pass ("large arrays");
|
||||
fflush(stdout);
|
||||
}
|
54
libgloss/testsuite/libgloss.all/configure.in
Normal file
54
libgloss/testsuite/libgloss.all/configure.in
Normal file
@ -0,0 +1,54 @@
|
||||
# This file is a shell script fragment that supplies the information
|
||||
# necessary to tailor a template configure script into the configure
|
||||
# script appropriate for this directory. For more information, check
|
||||
# any existing configure script.
|
||||
|
||||
srctrigger=io.c
|
||||
srcname="libgloss testsuite"
|
||||
target_dependent=true
|
||||
|
||||
# per-host:
|
||||
|
||||
# This is basically a hack so that we don't have to replicate the same
|
||||
# defines in all the Makefiles. We put a standard set of definitions
|
||||
# in host/any, and use them everywhere except DOS, which is braindead.
|
||||
|
||||
host_makefile_frag=../../config/default.mh
|
||||
case "${host}" in
|
||||
i[3456]86-*-go32)
|
||||
host_makefile_frag=../../config/dos.mh
|
||||
;;
|
||||
esac
|
||||
|
||||
# per-target:
|
||||
case "${target}" in
|
||||
m68*-unknown-*)
|
||||
target_makefile_frag=../config/m68k.mt
|
||||
;;
|
||||
hppa*-*-pro*)
|
||||
target_makefile_frag=../config/hppa.mt
|
||||
;;
|
||||
sparclite-*-*)
|
||||
target_makefile_frag=../config/sparcl.mt
|
||||
;;
|
||||
mips*-*-*)
|
||||
target_makefile_frag=../config/mips.mt
|
||||
;;
|
||||
esac
|
||||
|
||||
# post-target:
|
||||
|
||||
case ${srcdir} in
|
||||
.)
|
||||
;;
|
||||
*)
|
||||
grep "source ${srcdir}/.gdbinit" .gdbinit >/dev/null 2>/dev/null || \
|
||||
echo "source ${srcdir}/.gdbinit" >> .gdbinit
|
||||
esac
|
||||
|
||||
objroot=`pwd | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'`
|
||||
srcroot=`echo $srcdir | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'`
|
||||
sed -e "s:^OBJROOT[ ]*=.*$:OBJROOT = ${objroot}:" -e "s:^SRCROOT[ ]*=.*$:SRCROOT = ${srcroot}:" \
|
||||
${Makefile} > Makefile.tem
|
||||
rm -f ${Makefile}
|
||||
mv Makefile.tem ${Makefile}
|
35
libgloss/testsuite/libgloss.all/div.c
Normal file
35
libgloss/testsuite/libgloss.all/div.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* WinBond bug report
|
||||
|
||||
Please don't use "gcc -O3 -S hello.c" command, because it
|
||||
will optimize "i/5" to be "2" in compile time.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#define TESTSEED 10
|
||||
|
||||
main ()
|
||||
{
|
||||
int a1,b1,c1;
|
||||
long a2,b2,c2;
|
||||
double a3,b3,c3;
|
||||
float a4,b4,c4;
|
||||
char buf[20];
|
||||
|
||||
/* integer tests */
|
||||
for (a1 = 1; a1 < 16; a1++) {
|
||||
b1 = TESTSEED/a1;
|
||||
c1 = TESTSEED%a1;
|
||||
printf ("%d/%d = %d, ^ = %d\n", TESTSEED, a1, b1, c1);
|
||||
if ((c1 + (a1 * b1)) == TESTSEED) {
|
||||
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
||||
pass (buf);
|
||||
} else {
|
||||
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
||||
fail (buf);
|
||||
}
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
33
libgloss/testsuite/libgloss.all/double.c
Normal file
33
libgloss/testsuite/libgloss.all/double.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* Oki bug report [OKI001](gcc008_1)
|
||||
|
||||
The following program is not executed.
|
||||
error messages are as follow.
|
||||
|
||||
illegal trap: 0x12 pc=d000d954
|
||||
d000d954 08000240 NOP
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
extern double dcall ();
|
||||
|
||||
main ()
|
||||
{
|
||||
double d1, d2, d3;
|
||||
int i;
|
||||
|
||||
d1 = dcall (1.);
|
||||
printf ("d1 = %e\n", d1);
|
||||
|
||||
pass ("double [OKI001]");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
double
|
||||
dcall (d)
|
||||
double d;
|
||||
{
|
||||
int Zero = 0;
|
||||
return d + Zero;
|
||||
}
|
||||
|
||||
|
20
libgloss/testsuite/libgloss.all/float.c
Normal file
20
libgloss/testsuite/libgloss.all/float.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
float a,b,c;
|
||||
|
||||
a = 0.11;
|
||||
b = 3.12;
|
||||
c = a+b;
|
||||
|
||||
printf ("Print float, result with 'f' = %f\n", c);
|
||||
printf ("Print float, result with 'e' = %e\n", c);
|
||||
printf ("Print float, result with 'E' = %E\n", c);
|
||||
printf ("Print float, result with 'g' = %g\n", c);
|
||||
printf ("Print float, result with 'G' = %G\n", c);
|
||||
|
||||
pass ("float");
|
||||
fflush (stdout);
|
||||
}
|
||||
|
26
libgloss/testsuite/libgloss.all/func.c
Normal file
26
libgloss/testsuite/libgloss.all/func.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* Oki bug report [OKI002](gcc008_2)
|
||||
|
||||
The following program is not executed.
|
||||
Error message is as follow.
|
||||
|
||||
illegal trap: 0x12 pc=d000d954
|
||||
d000d954 08000240 NOP
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int func (int, ...);
|
||||
|
||||
void main ()
|
||||
{
|
||||
func (2, 1., 2., 3.);
|
||||
pass ("func [OKI002]");
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
int func (int i, ...)
|
||||
{
|
||||
return (i);
|
||||
}
|
71
libgloss/testsuite/libgloss.all/io.c
Normal file
71
libgloss/testsuite/libgloss.all/io.c
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
io.c -- Test the serial I/O.
|
||||
*/
|
||||
|
||||
#define BUFSIZE 80
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
char buf[100];
|
||||
char *tmp;
|
||||
int result;
|
||||
|
||||
/* test the lowest level output function */
|
||||
result = outbyte ('&');
|
||||
if (result != 0x0) {
|
||||
pass ("outbyte");
|
||||
} else {
|
||||
fail ("outbyte");
|
||||
}
|
||||
|
||||
/* try writing a string */
|
||||
result = write ("Write Test:\n", 12);
|
||||
print ("result was ");
|
||||
putnum (result);
|
||||
outbyte ('\n');
|
||||
if (result == 12) {
|
||||
pass ("write");
|
||||
} else {
|
||||
fail ("write");
|
||||
}
|
||||
|
||||
/* try the print() function too */
|
||||
result = print ("Print Test:\n");
|
||||
print ("result was ");
|
||||
putnum (result);
|
||||
outbyte ('\n');
|
||||
if (result == 12) {
|
||||
pass ("print");
|
||||
} else {
|
||||
fail ("print");
|
||||
}
|
||||
|
||||
/* try the iprintf() function too */
|
||||
result = print ("Iprintf Test:\n");
|
||||
print ("result was ");
|
||||
putnum (result);
|
||||
outbyte ('\n');
|
||||
if (result == 14) {
|
||||
pass ("iprintf");
|
||||
} else {
|
||||
fail ("iprintf");
|
||||
}
|
||||
|
||||
/* try to read a string */
|
||||
print ("Type 5 characters");
|
||||
|
||||
result = 0;
|
||||
result = read (0, buf, 5);
|
||||
print (buf);
|
||||
if (result == 5) {
|
||||
pass ("read");
|
||||
} else {
|
||||
fail ("read");
|
||||
}
|
||||
|
||||
/* clear everything out */
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
|
88
libgloss/testsuite/libgloss.all/math.c
Normal file
88
libgloss/testsuite/libgloss.all/math.c
Normal file
@ -0,0 +1,88 @@
|
||||
/* Oki bug report [OKI004](gcc005)
|
||||
|
||||
The following computation is no work.
|
||||
-1 / 1 => 1 (correct -1)
|
||||
-1 % 2 => 1 (correct -1)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main ()
|
||||
{
|
||||
long l1, l2, l6;
|
||||
auto long l3;
|
||||
long oza1, oza2, oza;
|
||||
|
||||
l1 = 1;
|
||||
l2 = 2;
|
||||
l3 = -1;
|
||||
l6 = 6;
|
||||
|
||||
/*** test 1 ***/
|
||||
oza = ((l3 / ((l1)--)) | (l6 <= (l3 % l2)));
|
||||
printf ("test 1 has a result of %d.\n", oza);
|
||||
if (oza != -1)
|
||||
fail ("divide test [OKI004]");
|
||||
else
|
||||
pass ("divide test [OKI004]");
|
||||
|
||||
l1 = 1;
|
||||
/*** test 2 ***/
|
||||
oza1 = (l3 / ((l1)--));
|
||||
oza2 = (l6 <= (l3 % l2));
|
||||
oza = oza1 | oza2;
|
||||
|
||||
printf ("test 2 has a result of %d.\n", oza);
|
||||
if (oza != -1)
|
||||
fail ("modulos test [OKI004]");
|
||||
else
|
||||
pass ("modulos test [OKI004]");
|
||||
fflush (stdout);
|
||||
|
||||
test_1();
|
||||
}
|
||||
|
||||
/*
|
||||
32760 / (1) = 32760
|
||||
32760 / (-1) = 32760 -------> ERROR, same as you said.
|
||||
32760 / (2) = 16380
|
||||
32760 / (-2) = -2147467268 ----> ERROR
|
||||
32760 / (3) = 10920
|
||||
32760 / (-3) = -1431644845 ----> ERROR
|
||||
32760 / (4) = 8190
|
||||
32760 / (-4) = -8190
|
||||
*/
|
||||
test_1()
|
||||
{
|
||||
int value, i, j;
|
||||
|
||||
i = 32760;
|
||||
j = 1;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
j = -1;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
|
||||
j = 2;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
j = -2;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
|
||||
j = 3;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
j = -3;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
|
||||
j = 4;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
j = -4;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
}
|
||||
|
38
libgloss/testsuite/libgloss.all/memory.c
Normal file
38
libgloss/testsuite/libgloss.all/memory.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* WinBond bug report
|
||||
|
||||
malloc() returns 0x0.
|
||||
|
||||
test the memory calls. These test sbrk(), which is part of glue.c
|
||||
for most architectures.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#define BUFSIZE 80
|
||||
|
||||
main()
|
||||
{
|
||||
char *buf;
|
||||
char *tmp;
|
||||
char *result;
|
||||
|
||||
/* see if we can get some memory */
|
||||
buf = (char *)malloc(BUFSIZE);
|
||||
if (buf != 0x0) {
|
||||
pass ("malloc");
|
||||
} else {
|
||||
fail ("malloc");
|
||||
}
|
||||
|
||||
/* see if we can realloc it */
|
||||
tmp = buf;
|
||||
result = (char *)realloc (buf, BUFSIZE+100);
|
||||
if ((buf != 0x0) && (result != 0x0)) {
|
||||
pass ("realloc");
|
||||
} else {
|
||||
fail ("realloc");
|
||||
}
|
||||
|
||||
/* see if we can free it up. FIXME: how to test free ?*/
|
||||
free (buf);
|
||||
fflush (stdout);
|
||||
}
|
167
libgloss/testsuite/libgloss.all/misc.c
Normal file
167
libgloss/testsuite/libgloss.all/misc.c
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* this file contains misc bug reports from WinBond.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#if unix
|
||||
#define pass(x) printf("PASS: %s\n", x);
|
||||
#define fail(x) printf("FAIL: %s\n", x);
|
||||
#endif
|
||||
|
||||
/*
|
||||
The compare operation is error. Because the constant value 1.0 is
|
||||
not correct. It seems compare with 0 in this statement.
|
||||
|
||||
HP-UX native:
|
||||
dist is 0.301
|
||||
PASS: float compare
|
||||
*cp = be9a1cac, *cp1 = be9a1cac
|
||||
PASS: float multiple 1
|
||||
PASS: float multiple 2
|
||||
32760 / (-2) = -16380
|
||||
PASS: float divide 1
|
||||
32760 / (-1) = -32760
|
||||
PASS: float divide 1
|
||||
These test only pass if the output matches:
|
||||
Correct output is
|
||||
1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0
|
||||
1.0 = 1.000000E+00, 0.3010 = 3.010000E-01, -1.0 = -1.000000E+00
|
||||
These test only pass if the outut matches:
|
||||
Correct output is
|
||||
ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
|
||||
ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
|
||||
|
||||
|
||||
Test run on Oki:
|
||||
|
||||
dist is 0
|
||||
PASS: float compare
|
||||
*cp = be9a1cac, *cp1 = be9a1cac
|
||||
PASS: float multiple 1
|
||||
PASS: float multiple 2
|
||||
32760 / (-2) = -2147467268
|
||||
PASS: float divide 1
|
||||
32760 / (-1) = 32760
|
||||
PASS: float divide 1
|
||||
These test only pass if the output matches:
|
||||
Correct output is
|
||||
1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0
|
||||
1.0 = 1.586860E-318, 0.3010 = -1.009091E-303, -1.0 = 5.290504E-315
|
||||
These test only pass if the outut matches:
|
||||
Correct output is
|
||||
ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
|
||||
ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315
|
||||
|
||||
*/
|
||||
|
||||
main()
|
||||
{
|
||||
float dist = 0.3010;
|
||||
|
||||
printf ("dist is %G\n", dist);
|
||||
if ( dist < 1.0 ) {
|
||||
pass ("float compare");
|
||||
} else {
|
||||
fail ("float compare");
|
||||
}
|
||||
|
||||
test_1();
|
||||
test_2();
|
||||
test_3();
|
||||
test_4();
|
||||
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/*
|
||||
* *cp = be9a1cac, *cp1 = 00000000
|
||||
*/
|
||||
test_1()
|
||||
{
|
||||
float i, ans, ans1;
|
||||
unsigned int *cp=&ans, *cp1=&ans1;
|
||||
|
||||
i = 0.3010;
|
||||
ans = (-1.0) * 0.3010 * 1.0; /* OK */
|
||||
ans1 = (-1.0) * i * 1.0; /* Disaster */
|
||||
printf ("*cp = %08x, *cp1 = %08x\n", *cp, *cp1);
|
||||
|
||||
if (*cp != 0xbe9a1cac) {
|
||||
fail ("float multiple 1");
|
||||
} else {
|
||||
pass ("float multiple 1");
|
||||
}
|
||||
|
||||
if (*cp1 != 0xbe9a1cac) {
|
||||
fail ("float multiple 2");
|
||||
} else {
|
||||
pass ("float multiple 2");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Positive integer divide Negative integer may get interesting result.
|
||||
For examples:
|
||||
EX1: 32760 / (-2) = -2147467268
|
||||
*/
|
||||
test_2()
|
||||
{
|
||||
int value, i, j;
|
||||
|
||||
i = 32760;
|
||||
j = -2;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
|
||||
if (value != -16380) {
|
||||
fail ("float divide 1");
|
||||
} else {
|
||||
pass ("float divide 1");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
EX2: 32760 / (-1) = 32760
|
||||
*/
|
||||
test_3()
|
||||
{
|
||||
int value, i, j;
|
||||
|
||||
i = 32760;
|
||||
j = -1;
|
||||
value = i / (j);
|
||||
printf ("%d / (%d) = %d\n", i, j, value);
|
||||
|
||||
if (value != -32760) {
|
||||
fail ("float divide 1");
|
||||
} else {
|
||||
pass ("float divide 1");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
The data output format %e, %E, %g, %G in printf() can not work.
|
||||
Please test the following example:
|
||||
|
||||
1.0 = 1.000000E+00, 0.3010 = 3.009999E-01, -1.0 = -1.000000E+00
|
||||
ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315
|
||||
*/
|
||||
test_4()
|
||||
{
|
||||
float ans, ans1, ans2;
|
||||
|
||||
ans = 1.0;
|
||||
ans1 = 0.3010;
|
||||
ans2 = -1.0;
|
||||
|
||||
printf ("These test only pass if the output matches:\nCorrect output is\n1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0\n");
|
||||
printf ("1.0 = %E, 0.3010 = %E, -1.0 = %E\n", 1.0, 0.3010, -1.0);
|
||||
printf ("These test only pass if the outut matches:\nCorrect output is\nans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00\n");
|
||||
printf ("ans = %E, ans1 = %E, ans2 = %E\n", ans, ans1, ans2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
31
libgloss/testsuite/libgloss.all/printf.c
Normal file
31
libgloss/testsuite/libgloss.all/printf.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Oki bug report [OKI006]
|
||||
|
||||
The following program is no work.
|
||||
|
||||
illegal trap: 0x12 pc=d000d954
|
||||
d000d954 08000240 NOP
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
print ("\r\nDemo Program Start\r\n");
|
||||
printf ("Value = %d, %d\r\n", 2, 1);
|
||||
pass ("printf [OKI006]");
|
||||
|
||||
/* Oki bug report [OKI007]
|
||||
|
||||
iprintf is no work.
|
||||
"Value = 2, 1" string is not displayed.
|
||||
|
||||
break instruction trap (9) pc=4003c
|
||||
0004003c 00000000 BREAK 0x0,0x0
|
||||
*/
|
||||
print ("\r\nDemo Program Start\r\n");
|
||||
iprintf ("Value = %d, %d\r\n", 2, 1);
|
||||
pass ("iprintf [OKI007]");
|
||||
fflush (stdout);
|
||||
}
|
65
libgloss/testsuite/libgloss.all/struct.c
Normal file
65
libgloss/testsuite/libgloss.all/struct.c
Normal file
@ -0,0 +1,65 @@
|
||||
/* Oki bug report, no number. Here's the output the error generates.
|
||||
|
||||
gcc -c -g -ansi oki008.c -o oki008.o -msoft-float
|
||||
oki008.c: In function `Proc0':
|
||||
oki008.c:50: internal error--insn does not satisfy its constraints:
|
||||
(insn 37 35 24 (set (mem:DF (post_inc:DF (reg:SI 1 %r1)))
|
||||
(reg:DF 48 %fr12)) 94 {reload_outdf+2} (nil)
|
||||
(nil))
|
||||
gcc: Internal compiler error: program cc1 got fatal signal 6
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef int Enumeration;
|
||||
typedef int OneToFifty;
|
||||
typedef char String30[31];
|
||||
struct Record
|
||||
{
|
||||
struct Record *PtrComp;
|
||||
Enumeration Discr;
|
||||
Enumeration EnumComp;
|
||||
OneToFifty IntComp;
|
||||
String30 StringComp;
|
||||
};
|
||||
|
||||
typedef struct Record RecordType;
|
||||
typedef RecordType * RecordPtr;
|
||||
typedef int boolean;
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
char buf[0x10000];
|
||||
char *pbuf = buf;
|
||||
|
||||
char *_malloc(size)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = pbuf;
|
||||
pbuf += size;
|
||||
if (pbuf >= &buf[sizeof (buf)]) {
|
||||
printf("_malloc error\n");
|
||||
return (0);
|
||||
}
|
||||
return (p);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
Proc0();
|
||||
pass ("struct");
|
||||
fflush (stdout);
|
||||
return (0);
|
||||
}
|
||||
|
||||
RecordPtr PtrGlbNext;
|
||||
|
||||
Proc0()
|
||||
{
|
||||
extern char *_malloc();
|
||||
|
||||
register unsigned int i;
|
||||
|
||||
PtrGlbNext = (RecordPtr) _malloc(sizeof(RecordType));
|
||||
}
|
46
libgloss/testsuite/libgloss.all/varargs.c
Normal file
46
libgloss/testsuite/libgloss.all/varargs.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* Oki bug report [OKI013]
|
||||
|
||||
Variable argments test failed.
|
||||
|
||||
Execution result.
|
||||
val1, val2 = 1, 0
|
||||
val1, val2 = 2, 0
|
||||
val1, val2 = 3, 0
|
||||
|
||||
Note, this tests for ANSI style varargs.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int func(int, ...);
|
||||
|
||||
main()
|
||||
{
|
||||
func(2, 1., 2., 3.);
|
||||
}
|
||||
|
||||
func(int i, ...)
|
||||
{
|
||||
va_list p;
|
||||
int j;
|
||||
|
||||
va_start(p, i);
|
||||
for (j = 1; j <= 3; ++j){
|
||||
dequals(__LINE__, (double)j, va_arg(p, double));
|
||||
}
|
||||
va_end(p);
|
||||
return (i);
|
||||
}
|
||||
|
||||
dequals(int line, double val1, double val2)
|
||||
{
|
||||
iprintf ("val1, val2 = %d, %d\n", (int)val1, (int)val2);
|
||||
if(val1 == val2)
|
||||
pass ("varargs [OKI013]");
|
||||
else
|
||||
fail ("varargs [OKI013]");
|
||||
|
||||
fflush (stdout);
|
||||
return;
|
||||
}
|
48
libgloss/testsuite/libgloss.all/varargs2.c
Normal file
48
libgloss/testsuite/libgloss.all/varargs2.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* Oki bug report [OKI013]
|
||||
|
||||
Variable argments test failed.
|
||||
|
||||
Execution result.
|
||||
val1, val2 = 1, 0
|
||||
val1, val2 = 2, 0
|
||||
val1, val2 = 3, 0
|
||||
|
||||
Note, this test case for for traditional style C code.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
int func();
|
||||
|
||||
main()
|
||||
{
|
||||
func(1., 2., 3.);
|
||||
}
|
||||
|
||||
func(va_alist)
|
||||
va_dcl
|
||||
{
|
||||
va_list p;
|
||||
double val1, val2;
|
||||
int j;
|
||||
|
||||
va_start(p);
|
||||
for (j = 1; j <= 3; ++j){
|
||||
dequals((double)j, va_arg(p, double));
|
||||
}
|
||||
va_end(p);
|
||||
return (p);
|
||||
}
|
||||
|
||||
dequals(double val1, double val2)
|
||||
{
|
||||
iprintf ("val1 is %d, val2 is %d\n", (int)val1, (int)val2);
|
||||
if (val1 == val2)
|
||||
pass ("varargs2 [OKI013]");
|
||||
else
|
||||
fail ("varargs2 [OKI013]");
|
||||
|
||||
fflush (stdout);
|
||||
return;
|
||||
}
|
Reference in New Issue
Block a user