xref: /openbsd-src/gnu/usr.bin/perl/os2/OS2/OS2-REXX/t/rx_dllld.t (revision b39c515898423c8d899e35282f4b395f7cad3298)
1BEGIN {
2    chdir 't' if -d 't/lib';
3    @INC = '../lib' if -d 'lib';
4    require Config; import Config;
5    if (-d 'lib' and $Config{'extensions'} !~ /\bOS2(::|\/)REXX\b/) {
6	print "1..0\n";
7	exit 0;
8    }
9}
10
11use OS2::REXX;
12
13$path = $ENV{LIBPATH} || $ENV{PATH} or die;
14foreach $dir (split(';', $path)) {
15  next unless -f "$dir/RXU.DLL";
16  $found = "$dir/RXU.DLL";
17  last;
18}
19$found or print "1..0 # skipped: cannot find RXU.DLL\n" and exit;
20
21print "1..5\n";
22
23$module = DynaLoader::dl_load_file($found) or die "not ok 1\n# load\n";
24print "ok 1\n";
25
26$address = DynaLoader::dl_find_symbol($module, "RXPROCID")
27  or die "not ok 2\n# find\n";
28print "ok 2\n";
29
30$result = OS2::REXX::_call("RxProcId", $address) or die "not ok 3\n# REXX";
31print "ok 3\n";
32
33($pid, $ppid, $ssid) = split(/\s+/, $result);
34$pid == $$ ? print "ok 4\n" : print "not ok 4\n# pid\n";
35$ssid == 1 ? print "ok 5\n" : print "not ok 5\n# pid\n";
36print "# pid=$pid, ppid=$ppid, ssid=$ssid\n";
37