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