File: actions_internal_tests.ml

package info (click to toggle)
libguestfs 1%3A1.44.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,932 kB
  • sloc: ansic: 458,017; ml: 51,424; sh: 13,191; java: 9,578; makefile: 7,931; cs: 6,328; haskell: 5,674; python: 3,871; perl: 3,528; erlang: 2,446; xml: 1,347; ruby: 350; pascal: 257; javascript: 157; lex: 135; yacc: 128; cpp: 10
file content (176 lines) | stat: -rw-r--r-- 6,783 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
(* libguestfs
 * Copyright (C) 2009-2020 Red Hat Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *)

(* Please read generator/README first. *)

open Types

(* These test functions are used in the language binding tests. *)

let test_all_args = [
  String (PlainString, "str");
  OptString "optstr";
  StringList (PlainString, "strlist");
  Bool "b";
  Int "integer";
  Int64 "integer64";
  String (FileIn, "filein");
  String (FileOut, "fileout");
  BufferIn "bufferin";
]

let test_all_optargs = [
  OBool "obool";
  OInt "oint";
  OInt64 "oint64";
  OString "ostring";
  OStringList "ostringlist";
]

let test_all_rets = [
  (* except for RErr, which is tested thoroughly elsewhere *)
  "internal_test_rint",         RInt "valout";
  "internal_test_rint64",       RInt64 "valout";
  "internal_test_rbool",        RBool "valout";
  "internal_test_rconststring", RConstString "valout";
  "internal_test_rconstoptstring", RConstOptString "valout";
  "internal_test_rstring",      RString (RPlainString, "valout");
  "internal_test_rstringlist",  RStringList (RPlainString, "valout");
  "internal_test_rstruct",      RStruct ("valout", "lvm_pv");
  "internal_test_rstructlist",  RStructList ("valout", "lvm_pv");
  "internal_test_rhashtable",   RHashtable (RPlainString, RPlainString, "valout");
  "internal_test_rbufferout",   RBufferOut "valout";
]

let test_functions = [
  { defaults with
    name = "internal_test";
    style = RErr, test_all_args, test_all_optargs;
    visibility = VBindTest; cancellable = true;
    blocking = false;
    shortdesc = "internal test function - do not use";
    longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
parameter type correctly.

It echos the contents of each parameter to stdout (by default)
or to a file (if C<guestfs_internal_test_set_output> was called).

You probably don't want to call this function." };

  { defaults with
    name = "internal_test_only_optargs";
    style = RErr, [], [OInt "test"];
    visibility = VBindTest; cancellable = true;
    blocking = false;
    shortdesc = "internal test function - do not use";
    longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle no args, some
optargs correctly.

It echos the contents of each parameter to stdout (by default)
or to a file (if C<guestfs_internal_test_set_output> was called).

You probably don't want to call this function." };

  { defaults with
    name = "internal_test_63_optargs";
    style = RErr, [], [OInt "opt1"; OInt "opt2"; OInt "opt3"; OInt "opt4"; OInt "opt5"; OInt "opt6"; OInt "opt7"; OInt "opt8"; OInt "opt9"; OInt "opt10"; OInt "opt11"; OInt "opt12"; OInt "opt13"; OInt "opt14"; OInt "opt15"; OInt "opt16"; OInt "opt17"; OInt "opt18"; OInt "opt19"; OInt "opt20"; OInt "opt21"; OInt "opt22"; OInt "opt23"; OInt "opt24"; OInt "opt25"; OInt "opt26"; OInt "opt27"; OInt "opt28"; OInt "opt29"; OInt "opt30"; OInt "opt31"; OInt "opt32"; OInt "opt33"; OInt "opt34"; OInt "opt35"; OInt "opt36"; OInt "opt37"; OInt "opt38"; OInt "opt39"; OInt "opt40"; OInt "opt41"; OInt "opt42"; OInt "opt43"; OInt "opt44"; OInt "opt45"; OInt "opt46"; OInt "opt47"; OInt "opt48"; OInt "opt49"; OInt "opt50"; OInt "opt51"; OInt "opt52"; OInt "opt53"; OInt "opt54"; OInt "opt55"; OInt "opt56"; OInt "opt57"; OInt "opt58"; OInt "opt59"; OInt "opt60"; OInt "opt61"; OInt "opt62"; OInt "opt63"];
    visibility = VBindTest; cancellable = true;
    blocking = false;
    shortdesc = "internal test function - do not use";
    longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle the full range
of 63 optargs correctly.  (Note that 63 is not an absolute limit
and it could be raised by changing the XDR protocol).

It echos the contents of each parameter to stdout (by default)
or to a file (if C<guestfs_internal_test_set_output> was called).

You probably don't want to call this function." }

] @ List.flatten (
  List.map (
    fun (name, ret) -> [
      { defaults with
        name = name;
        style = ret, [String (PlainString, "val")], [];
        visibility = VBindTest;
        blocking = false;
        shortdesc = "internal test function - do not use";
        longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
return type correctly.

It converts string C<val> to the return type.

You probably don't want to call this function." };
      { defaults with
        name = name ^ "err";
        style = ret, [], [];
        visibility = VBindTest;
        blocking = false;
        shortdesc = "internal test function - do not use";
        longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
return type correctly.

This function always returns an error.

You probably don't want to call this function." }
    ]
  ) test_all_rets
)

let test_support_functions = [
  { defaults with
    name = "internal_test_set_output";
    style = RErr, [String (PlainString, "filename")], [];
    visibility = VBindTest;
    blocking = false;
    shortdesc = "internal test function - do not use";
    longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
parameter type correctly.

It sets the output file used by C<guestfs_internal_test>.

You probably don't want to call this function." };

  { defaults with
    name = "internal_test_close_output";
    style = RErr, [], [];
    visibility = VBindTest;
    blocking = false;
    shortdesc = "internal test function - do not use";
    longdesc = "\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
parameter type correctly.

It closes the output file previously opened by
C<guestfs_internal_test_set_output>.

You probably don't want to call this function." };
]