annotate erlang/erldc/test/linkload_SUITE.erl @ 47:44045db8fa5f

PyCObject/PyCapsule not usable as type annotation
author Tassilo Philipp
date Fri, 13 Nov 2020 18:04:05 +0100
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 %% Copyright (c) 2014 Erik Mackdanz <erikmack@gmail.com>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 %% Permission to use, copy, modify, and distribute this software for any
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 %% purpose with or without fee is hereby granted, provided that the above
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 %% copyright notice and this permission notice appear in all copies.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 -module(linkload_SUITE).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 -compile(export_all).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 -define(VMSZ, 1024).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 all() ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 [create_vm,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 create_vm_badsz,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 load_lib,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 no_such_lib,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 bad_lib,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 bad_sym,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 bad_sym_2,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 load_sym
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 ].
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 create_vm(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 {ok,Vm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 true = is_binary(Vm).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 create_vm_badsz(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 {error,bad_vm_size} = dyncall:new_call_vm("Hello badarg").
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 load_lib(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 {ok,Lib} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 true = is_binary(Lib).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 no_such_lib(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 {error,lib_not_found} = dyncall:load_library("foobarbaz").
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 bad_lib(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 {error,invalid_lib} = dyncall:load_library(12).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 bad_sym(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 {ok,Lib} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 {error,symbol_not_found} = dyncall:find_symbol(Lib,"bogussymbol").
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 bad_sym_2(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 {ok,Lib} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 {error,invalid_symbol} = dyncall:find_symbol(Lib,9).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 load_sym(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 {ok,Lib} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 {ok,_Partner} = dyncall:find_symbol(Lib,"sqrt").
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61