• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1This package contains a test suite for libffi.
2
3This test suite can be compiled with a C compiler. No need for 'expect'
4or some other package that is often not installed.
5
6The test suite consists of 81 C functions, each with a different signature.
7* test-call verifies that calling each function directly produces the same
8  results as calling the function indirectly through 'ffi_call'.
9* test-callback verifies that calling each function directly produces the same
10  results as calling a function that is a callback (object build by
11  'ffi_prep_closure_loc') and simulates the original function.
12
13Each direct or indirect invocation should produce one line of output to
14stdout. A correct output consists of paired lines, such as
15
16void f(void):
17void f(void):
18int f(void):->99
19int f(void):->99
20int f(int):(1)->2
21int f(int):(1)->2
22int f(2*int):(1,2)->3
23int f(2*int):(1,2)->3
24...
25
26The Makefile then creates two files:
27* failed-call, which consists of the non-paired lines of output of
28  'test-call',
29* failed-callback, which consists of the non-paired lines of output of
30  'test-callback'.
31
32The test suite passes if both failed-call and failed-callback come out
33as empty.
34
35
36How to use the test suite
37-------------------------
38
391. Modify the Makefile's variables
40   prefix = the directory in which libffi was installed
41   CC = the C compiler, often with options such as "-m32" or "-m64"
42        that enforce a certain ABI,
43   CFLAGS = optimization options (need to change them only for non-GCC
44            compilers)
452. Run "make". If it fails already in "test-call", run also
46   "make check-callback".
473. If this failed, inspect the output files.
48
49
50How to interpret the results
51----------------------------
52
53The failed-call and failed-callback files consist of paired lines:
54The first line is the result of the direct invocation.
55The second line is the result of invocation through libffi.
56
57For example, this output
58
59uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->255
60uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->0
61
62indicates that the arguments were passed correctly, but the return
63value came out wrong.
64
65And this output
66
67float f(17*float,3*int,L):(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,6,7,8,561,1105,1729,2465,2821,6601)->15319.1
68float f(17*float,3*int,L):(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,-140443648,10,268042216,-72537980,-140443648,-140443648,-140443648,-140443648,-140443648)->-6.47158e+08
69
70indicates that integer arguments that come after 17 floating-point arguments
71were not passed correctly.
72
73
74Credits
75-------
76
77The test suite is based on the one of GNU libffcall-2.0.
78Authors: Bill Triggs, Bruno Haible
79