[svn:parrot] r47044 - in branches/ops_massacre: . config/gen/config_pm config/gen/makefiles examples/pasm runtime/parrot/library runtime/parrot/library/HTTP runtime/parrot/library/LWP t/dynoplibs

plobsing at svn.parrot.org plobsing at svn.parrot.org
Thu May 27 04:00:31 UTC 2010


Author: plobsing
Date: Thu May 27 04:00:30 2010
New Revision: 47044
URL: https://trac.parrot.org/parrot/changeset/47044

Log:
fix library_tests

Modified:
   branches/ops_massacre/MANIFEST
   branches/ops_massacre/config/gen/config_pm/config_pir.in
   branches/ops_massacre/config/gen/makefiles/root.in
   branches/ops_massacre/examples/pasm/cat.pasm
   branches/ops_massacre/runtime/parrot/library/HTTP/Message.pir
   branches/ops_massacre/runtime/parrot/library/LWP/Protocol.pir
   branches/ops_massacre/runtime/parrot/library/parrotlib.pir
   branches/ops_massacre/t/dynoplibs/io.t

Modified: branches/ops_massacre/MANIFEST
==============================================================================
--- branches/ops_massacre/MANIFEST	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/MANIFEST	Thu May 27 04:00:30 2010	(r47044)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Tue May 25 09:26:39 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu May 27 02:06:52 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1663,6 +1663,7 @@
 t/dynoplibs/bit.t                                           [test]
 t/dynoplibs/debug.t                                         [test]
 t/dynoplibs/deprecated.t                                    [test]
+t/dynoplibs/io.t                                            [test]
 t/dynoplibs/math.t                                          [test]
 t/dynoplibs/obscure.t                                       [test]
 t/dynoplibs/sysinfo.t                                       [test]
@@ -1806,7 +1807,6 @@
 t/op/inf_nan.t                                              [test]
 t/op/integer.t                                              [test]
 t/op/interp.t                                               [test]
-t/op/io.t                                                   [test]
 t/op/jit.t                                                  [test]
 t/op/jitn.t                                                 [test]
 t/op/lexicals.t                                             [test]

Modified: branches/ops_massacre/config/gen/config_pm/config_pir.in
==============================================================================
--- branches/ops_massacre/config/gen/config_pm/config_pir.in	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/config/gen/config_pm/config_pir.in	Thu May 27 04:00:30 2010	(r47044)
@@ -40,8 +40,6 @@
 =cut
 
 .include "interpinfo.pasm"
-.include "stat.pasm"
-.loadlib 'sys_ops'
 .loadlib 'os'
 
 .sub _config
@@ -49,10 +47,14 @@
     prefix = interpinfo .INTERPINFO_RUNTIME_PREFIX
 
     $S0 = concat prefix, "/runtime"
+
     $P0 = new ['OS']
-    $P1 = $P0.'stat'($S0)
-    $I0 = $P1[.STAT_EXISTS]
-    if $I0 goto L1
+    push_eh file_not_found
+        # OS.stat throws on file not found
+        $P0.'stat'($S0)
+        goto L1
+    pop_eh
+  file_not_found:
     conf_file = "@libdir@@versiondir@/include/config.fpmc"
     goto L2
   L1:

Modified: branches/ops_massacre/config/gen/makefiles/root.in
==============================================================================
--- branches/ops_massacre/config/gen/makefiles/root.in	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/config/gen/makefiles/root.in	Thu May 27 04:00:30 2010	(r47044)
@@ -648,6 +648,8 @@
 
 $(LIBRARY_DIR)/osutils.pbc: $(DYNEXT_DIR)/io_ops$(LOAD_EXT)
 
+$(LIBRARY_DIR)/Config/JSON.pbc: $(DYNEXT_DIR)/io_ops$(LOAD_EXT) $(DYNEXT_DIR)/sys_ops$(LOAD_EXT)
+
 # constant string support
 .c.str : # suffix rule (limited support)
 	$(PERL) $(BUILD_TOOLS_DIR)/c2str.pl $< > $@

Modified: branches/ops_massacre/examples/pasm/cat.pasm
==============================================================================
--- branches/ops_massacre/examples/pasm/cat.pasm	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/examples/pasm/cat.pasm	Thu May 27 04:00:30 2010	(r47044)
@@ -19,6 +19,8 @@
 
 =cut
 
+.loadlib 'io_ops'
+
 	getstdin P0
 	getstdout P1
 REDO:

Modified: branches/ops_massacre/runtime/parrot/library/HTTP/Message.pir
==============================================================================
--- branches/ops_massacre/runtime/parrot/library/HTTP/Message.pir	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/runtime/parrot/library/HTTP/Message.pir	Thu May 27 04:00:30 2010	(r47044)
@@ -20,8 +20,9 @@
 
 .namespace ['HTTP';'Date']
 
-.include 'tm.pasm'
+.loadlib 'io_ops'  # XXX avoids segfaults for some reason
 .loadlib 'sys_ops'
+.include 'tm.pasm'
 
 .sub 'time2str'
     .param int time

Modified: branches/ops_massacre/runtime/parrot/library/LWP/Protocol.pir
==============================================================================
--- branches/ops_massacre/runtime/parrot/library/LWP/Protocol.pir	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/runtime/parrot/library/LWP/Protocol.pir	Thu May 27 04:00:30 2010	(r47044)
@@ -86,7 +86,6 @@
 .namespace ['LWP';'Protocol';'file']
 
 .include 'stat.pasm'
-.loadlib 'io_ops'
 
 .sub '' :init :load :anon
     $P0 = subclass ['LWP';'Protocol'], ['LWP';'Protocol';'file']
@@ -158,8 +157,13 @@
     .local string path
     path = url.'path'()
 
-    $I0 = stat path, .STAT_EXISTS
-    if $I0 goto L1
+    $P0 = new ['OS']
+    push_eh FILE_NOT_FOUND
+        $P1 = $P0.'stat'(path) # OS.stat throws on file not found
+    pop_eh
+    goto L1
+
+  FILE_NOT_FOUND:
     $P0 = box RC_NOT_FOUND
     setattribute response, 'code', $P0
     $S0 = "File `" . path
@@ -170,12 +174,12 @@
   L1:
 
     .local int mtime
-    mtime = stat path, .STAT_MODIFYTIME
+    mtime = $P1[.STAT_MODIFYTIME]
     $P0 = get_hll_global ['HTTP';'Date'], 'time2str'
     $S0 = $P0(mtime)
     response.'push_header'('Last-Modified', $S0)
     .local int filesize
-    filesize = stat path, .STAT_FILESIZE
+    filesize = $P1[.STAT_FILESIZE]
     response.'push_header'('Content-Length', filesize)
 
     if method == 'HEAD' goto L2
@@ -239,8 +243,13 @@
     .local string path
     path = url.'path'()
 
-    $I0 = stat path, .STAT_EXISTS
-    if $I0 goto L1
+    $P0 = new ['OS']
+    push_eh FILE_NOT_FOUND
+        $P0.'stat'(path) # OS.stat throws on file not found
+    pop_eh
+    goto L1
+
+  FILE_NOT_FOUND:
     $P0 = box RC_NOT_FOUND
     setattribute response, 'code', $P0
     $S0 = "File `" . path

Modified: branches/ops_massacre/runtime/parrot/library/parrotlib.pir
==============================================================================
--- branches/ops_massacre/runtime/parrot/library/parrotlib.pir	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/runtime/parrot/library/parrotlib.pir	Thu May 27 04:00:30 2010	(r47044)
@@ -129,36 +129,45 @@
 .sub dynext_location
     .param string request
     .param string ext
+
+    .local pmc    os
     .local string name
 
+    os = new ['OS']
+
     name = request
-    $P0 = new ['OS']
-    $I0 = $P0.'stat'(name, 0)
-    if $I0 goto END
+    push_eh FILE_NOT_FOUND_1
+    # OS.stat throws on file not found
+    os.'stat'(name)
+    goto END
 
+FILE_NOT_FOUND_1:
     name = concat request, ext
-    $P0 = new ['OS']
-    $I0 = $P0.'stat'(name, 0)
-    if $I0 goto END
+    push_eh FILE_NOT_FOUND_2
+    os.'stat'(name)
+    goto END
 
+FILE_NOT_FOUND_2:
     name = concat "runtime/parrot/dynext/", request
-    $P0 = new ['OS']
-    $I0 = $P0.'stat'(name, 0)
-    if $I0 goto END
+    push_eh FILE_NOT_FOUND_3
+    os.'stat'(name)
+    goto END
 
+FILE_NOT_FOUND_3:
     name = concat "runtime/parrot/dynext/", request
     name = concat name, ext
-    $P0 = new ['OS']
-    $I0 = $P0.'stat'(name, 0)
-    if $I0 goto END
+    push_eh FILE_NOT_FOUND_4
+    os.'stat'(name)
+    goto END
 
+FILE_NOT_FOUND_4:
     # file not found, give the OS a chance to locate it
     name = concat request, ext
+    .return (name)
 
 END:
-    .begin_return
-    .set_return name
-    .end_return
+    pop_eh
+    .return (name)
 .end
 
 
@@ -194,11 +203,16 @@
 
     $S0 = concat path, name
     $P0 = new ['OS']
-    $P1 = $P0.'stat'($S0)
-    $I0 = $P1[0]
-    if $I0 goto OK
+    push_eh FILE_NOT_FOUND
+        # OS.stat throws on file not found
+        $P0.'stat'($S0)
+    pop_eh
+    goto END
+
+FILE_NOT_FOUND:
     null $S0
-OK:
+
+END:
     .begin_return
     .set_return $S0
     .end_return

Modified: branches/ops_massacre/t/dynoplibs/io.t
==============================================================================
--- branches/ops_massacre/t/dynoplibs/io.t	Thu May 27 03:42:20 2010	(r47043)
+++ branches/ops_massacre/t/dynoplibs/io.t	Thu May 27 04:00:30 2010	(r47044)
@@ -29,7 +29,8 @@
     open_null_filename()
     open_null_mode()
     open_pipe_for_reading()
-    open_pipe_for_writing()
+    getfd_fdopen()
+    open_pipe_for_writing() # must be last (doesn't use test_more)
 .end
 
 .sub open_delegates_to_filehandle_pmc
@@ -167,17 +168,14 @@
 .end
 
 # TT #1178
-.sub main :main
+.sub 'getfd_fdopen'
     getstdout $P0
     $I0 = $P0.'get_fd'()
     fdopen $P1, $I0, 'w'
     $I0 = defined $P1
     ok($I0, 'get_fd()/fdopen')
     close $P1
-.end
 
-# TT # 1178
-.sub main :main
     getstdout $P0
     $I0 = $P0.'get_fd'()
     fdopen $P1, $I0, 'w'


More information about the parrot-commits mailing list