Debian Codegraph @

testsuite/libffi.bhaible/README

raw
1 This package contains a test suite for libffi.
2
3 This test suite can be compiled with a C compiler. No need for 'expect'
4 or some other package that is often not installed.
5
6 The 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
13 Each direct or indirect invocation should produce one line of output to
14 stdout. A correct output consists of paired lines, such as
15
16 void f(void):
17 void f(void):
18 int f(void):->99
19 int f(void):->99
20 int f(int):(1)->2
21 int f(int):(1)->2
22 int f(2*int):(1,2)->3
23 int f(2*int):(1,2)->3
24 ...
25
26 The 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
32 The test suite passes if both failed-call and failed-callback come out
33 as empty.
34
35
36 How to use the test suite
37 -------------------------
38
39 1. 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)
45 2. Run "make". If it fails already in "test-call", run also
46 "make check-callback".
47 3. If this failed, inspect the output files.
48
49
50 How to interpret the results
51 ----------------------------
52
53 The failed-call and failed-callback files consist of paired lines:
54 The first line is the result of the direct invocation.
55 The second line is the result of invocation through libffi.
56
57 For example, this output
58
59 uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->255
60 uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->0
61
62 indicates that the arguments were passed correctly, but the return
63 value came out wrong.
64
65 And this output
66
67 float 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
68 float 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
70 indicates that integer arguments that come after 17 floating-point arguments
71 were not passed correctly.
72
73
74 Credits
75 -------
76
77 The test suite is based on the one of GNU libffcall-2.0.
78 Authors: Bill Triggs, Bruno Haible