Many changes. Not quite there yet.
This commit is contained in:
15
libffi/testsuite/Makefile.am
Normal file
15
libffi/testsuite/Makefile.am
Normal file
@@ -0,0 +1,15 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign dejagnu
|
||||
|
||||
# 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@
|
||||
|
||||
228
libffi/testsuite/Makefile.in
Normal file
228
libffi/testsuite/Makefile.in
Normal file
@@ -0,0 +1,228 @@
|
||||
# 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 = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SHELL = @SHELL@
|
||||
TARGET = @TARGET@
|
||||
TARGETDIR = @TARGETDIR@
|
||||
VERSION = @VERSION@
|
||||
libffi_basedir = @libffi_basedir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign dejagnu
|
||||
|
||||
# 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 = ../fficonfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
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 '## 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-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
|
||||
-rm -f libtool
|
||||
|
||||
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-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:
|
||||
1
libffi/testsuite/config/default.exp
Normal file
1
libffi/testsuite/config/default.exp
Normal file
@@ -0,0 +1 @@
|
||||
load_lib "standard.exp"
|
||||
44
libffi/testsuite/lib/libffi.exp
Normal file
44
libffi/testsuite/lib/libffi.exp
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (C) 2001 Red Hat, Inc.
|
||||
|
||||
load_lib "libgloss.exp"
|
||||
|
||||
global tmpdir
|
||||
|
||||
if ![info exists tmpdir] {
|
||||
set tmpdir "/tmp"
|
||||
}
|
||||
|
||||
proc test_libffi {src} {
|
||||
|
||||
global tmpdir srcdir
|
||||
|
||||
set executable $tmpdir/[file tail [file rootname $src].x]
|
||||
|
||||
regsub "^$srcdir/?" $src "" testcase
|
||||
# If we couldn't rip $srcdir out of `src' then just do the best we can.
|
||||
# The point is to reduce the unnecessary noise in the logs. Don't strip
|
||||
# out too much because different testcases with the same name can confuse
|
||||
# `test-tool'.
|
||||
if [string match "/*" $testcase] {
|
||||
set testcase "[file tail [file dirname $src]]/[file tail $src]"
|
||||
}
|
||||
|
||||
remote_file build delete $executable;
|
||||
verbose "Testing $testcase" 1
|
||||
|
||||
set comp_output [target_compile $src $executable executable "additional_flags=-g additional_flags=-I$srcdir/../include libs=../.libs/libffi.a"]
|
||||
|
||||
set result [libffi_load "$executable" "" ""]
|
||||
set status [lindex $result 0];
|
||||
set output [lindex $result 1];
|
||||
|
||||
$status "$testcase"
|
||||
|
||||
if { $status == "pass" } {
|
||||
remote_file build delete $executable;
|
||||
}
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# tcl-indent-level:4
|
||||
# End:
|
||||
13
libffi/testsuite/libffi.call/call.exp
Normal file
13
libffi/testsuite/libffi.call/call.exp
Normal file
@@ -0,0 +1,13 @@
|
||||
global srcdir subdir
|
||||
|
||||
catch "glob -nocomplain ${srcdir}/${subdir}/*.c" srcfiles
|
||||
verbose "srcfiles are $srcfiles"
|
||||
|
||||
set prefix ""
|
||||
foreach x $srcfiles {
|
||||
test_libffi $x
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# tcl-indent-level:4
|
||||
# End:
|
||||
4
libffi/testsuite/libffi.call/ffitest.h
Normal file
4
libffi/testsuite/libffi.call/ffitest.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#include <ffi.h>
|
||||
|
||||
#define CHECK(x) !(x) ? abort() : 0
|
||||
|
||||
55
libffi/testsuite/libffi.call/float.c
Normal file
55
libffi/testsuite/libffi.call/float.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "ffitest.h"
|
||||
|
||||
static int floating(int a, float b, double c, long double d, int e)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = (int) ((float)a/b + ((float)c/(float)d));
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[5];
|
||||
void *values[5];
|
||||
int si1, si2;
|
||||
float f;
|
||||
double d;
|
||||
long double ld;
|
||||
int rint __attribute__((aligned(8)));
|
||||
|
||||
args[0] = &ffi_type_sint;
|
||||
values[0] = &si1;
|
||||
args[1] = &ffi_type_float;
|
||||
values[1] = &f;
|
||||
args[2] = &ffi_type_double;
|
||||
values[2] = &d;
|
||||
args[3] = &ffi_type_longdouble;
|
||||
values[3] = &ld;
|
||||
args[4] = &ffi_type_sint;
|
||||
values[4] = &si2;
|
||||
|
||||
/* Initialize the cif */
|
||||
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5,
|
||||
&ffi_type_sint, args) == FFI_OK);
|
||||
|
||||
si1 = 6;
|
||||
f = 3.14159;
|
||||
d = (double)1.0/(double)3.0;
|
||||
ld = 2.71828182846L;
|
||||
si2 = 10;
|
||||
|
||||
floating (si1, f, d, ld, si2);
|
||||
|
||||
ffi_call(&cif, FFI_FN(floating), &rint, values);
|
||||
|
||||
printf ("%d vs %d\n", rint, floating (si1, f, d, ld, si2));
|
||||
|
||||
CHECK(rint == floating(si1, f, d, ld, si2));
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
63
libffi/testsuite/libffi.call/many.c
Normal file
63
libffi/testsuite/libffi.call/many.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "ffitest.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
static float many(float f1,
|
||||
float f2,
|
||||
float f3,
|
||||
float f4,
|
||||
float f5,
|
||||
float f6,
|
||||
float f7,
|
||||
float f8,
|
||||
float f9,
|
||||
float f10,
|
||||
float f11,
|
||||
float f12,
|
||||
float f13)
|
||||
{
|
||||
#if 0
|
||||
printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
|
||||
(double) f1, (double) f2, (double) f3, (double) f4, (double) f5,
|
||||
(double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
|
||||
(double) f11, (double) f12, (double) f13);
|
||||
#endif
|
||||
|
||||
return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[13];
|
||||
void *values[13];
|
||||
float fa[13];
|
||||
float f, ff;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 13; i++)
|
||||
{
|
||||
args[i] = &ffi_type_float;
|
||||
values[i] = &fa[i];
|
||||
fa[i] = (float) i;
|
||||
}
|
||||
|
||||
/* Initialize the cif */
|
||||
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13,
|
||||
&ffi_type_float, args) == FFI_OK);
|
||||
|
||||
ffi_call(&cif, FFI_FN(many), &f, values);
|
||||
|
||||
ff = many(fa[0], fa[1],
|
||||
fa[2], fa[3],
|
||||
fa[4], fa[5],
|
||||
fa[6], fa[7],
|
||||
fa[8], fa[9],
|
||||
fa[10],fa[11],fa[12]);
|
||||
|
||||
if (f - ff < FLT_EPSILON)
|
||||
exit(0);
|
||||
else
|
||||
abort();
|
||||
}
|
||||
38
libffi/testsuite/libffi.call/strlen.c
Normal file
38
libffi/testsuite/libffi.call/strlen.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "ffitest.h"
|
||||
|
||||
static size_t my_strlen(char *s)
|
||||
{
|
||||
return (strlen(s));
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[1];
|
||||
void *values[1];
|
||||
int rint __attribute__((aligned(8)));
|
||||
char *s;
|
||||
|
||||
args[0] = &ffi_type_pointer;
|
||||
values[0] = (void*) &s;
|
||||
|
||||
/* Initialize the cif */
|
||||
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
||||
&ffi_type_sint, args) == FFI_OK);
|
||||
|
||||
s = "a";
|
||||
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
||||
CHECK(rint == 1);
|
||||
|
||||
s = "1234567";
|
||||
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
||||
CHECK(rint == 7);
|
||||
|
||||
s = "1234567890123456789012345";
|
||||
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
||||
CHECK(rint == 25);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user