Test patches for OS/2
[p5sagit/p5-mst-13.2.git] / os2 / OS2 / REXX / t / rx_dllld.t
1 BEGIN {
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
11 use OS2::REXX;
12
13 $path = $ENV{LIBPATH} || $ENV{PATH} or die;
14 foreach $dir (split(';', $path)) {
15   next unless -f "$dir/YDBAUTIL.DLL";
16   $found = "$dir/YDBAUTIL.DLL";
17   last;
18 }
19 $found or die "1..0\n#Cannot find YDBAUTIL.DLL\n";
20
21 print "1..5\n";
22
23 $module = DynaLoader::dl_load_file($found) or die "not ok 1\n# load\n";
24 print "ok 1\n";
25
26 $address = DynaLoader::dl_find_symbol($module, "RXPROCID") 
27   or die "not ok 2\n# find\n";
28 print "ok 2\n";
29
30 $result = OS2::REXX::_call("RxProcId", $address) or die "not ok 3\n# REXX";
31 print "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";
36 print "# pid=$pid, ppid=$ppid, ssid=$ssid\n";