[svn:parrot] r38299 - in branches/pmc_pct: . compilers/pmc/t
cotto at svn.parrot.org
cotto at svn.parrot.org
Fri Apr 24 13:12:05 UTC 2009
Author: cotto
Date: Fri Apr 24 13:12:05 2009
New Revision: 38299
URL: https://trac.parrot.org/parrot/changeset/38299
Log:
[pmc_pct] add a test to try parsing all pmcs and dynpmcs
Added:
branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t
Modified:
branches/pmc_pct/MANIFEST
Modified: branches/pmc_pct/MANIFEST
==============================================================================
--- branches/pmc_pct/MANIFEST Fri Apr 24 13:09:33 2009 (r38298)
+++ branches/pmc_pct/MANIFEST Fri Apr 24 13:12:05 2009 (r38299)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Apr 19 13:39:13 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Apr 24 13:11:31 2009 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -191,6 +191,31 @@
compilers/pirc/t/macro.t [test]
compilers/pirc/t/stmts.t [test]
compilers/pirc/t/subflags.t [test]
+compilers/pmc/README.pod []doc
+compilers/pmc/TODO [pmc]
+compilers/pmc/pmc.pir [pmc]
+compilers/pmc/src/builtins.pir [pmc]
+compilers/pmc/src/parser/actions.pm [pmc]
+compilers/pmc/src/parser/grammar.pg [pmc]
+compilers/pmc/t/01-parse.t [test]
+compilers/pmc/t/02-parse-all-pmcs.t [test]
+compilers/pmc/t/data/class.pmc [test]
+compilers/pmc/t/data/class00.pmc [test]
+compilers/pmc/t/data/class01.pmc [test]
+compilers/pmc/t/data/class02.pmc [test]
+compilers/pmc/t/data/class03.pmc [test]
+compilers/pmc/t/data/class04.pmc [test]
+compilers/pmc/t/data/class05.pmc [test]
+compilers/pmc/t/data/class06.pmc [test]
+compilers/pmc/t/data/class07.pmc [test]
+compilers/pmc/t/data/class08.pmc [test]
+compilers/pmc/t/data/class09.pmc [test]
+compilers/pmc/t/data/class10.pmc [test]
+compilers/pmc/t/data/class11.pmc [test]
+compilers/pmc/t/data/class12.pmc [test]
+compilers/pmc/t/data/class13.pmc [test]
+compilers/pmc/t/data/class14.pmc [test]
+compilers/pmc/t/data/class15.pmc [test]
compilers/tge/README []doc
compilers/tge/TGE.pir [tge]
compilers/tge/TGE/Compiler.pir [tge]
@@ -326,6 +351,7 @@
config/gen/makefiles/pct.in []
config/gen/makefiles/pge.in []
config/gen/makefiles/pirc.in []
+config/gen/makefiles/pmc.in []
config/gen/makefiles/root.in []
config/gen/makefiles/tge.in []
config/gen/opengl.pm []
@@ -1454,8 +1480,8 @@
src/pmc/undef.pmc [devel]src
src/pmc/unmanagedstruct.pmc [devel]src
src/pmc_freeze.c []
-src/runcore/main.c []
src/runcore/cores.c []
+src/runcore/main.c []
src/runcore/trace.c []
src/scheduler.c []
src/spf_render.c []
Added: branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t Fri Apr 24 13:12:05 2009 (r38299)
@@ -0,0 +1,104 @@
+#!parrot
+
+
+.sub 'main' :main
+.include 'test_more.pir'
+load_bytecode 'compilers/pmc/pmc.pbc'
+ .local int total
+ .local pmc os, all_files, pmc_files, dynpmc_files, it
+
+ all_files = new ['ResizablePMCArray']
+ pmc_files = get_pmcs_from_dir('src/pmc/')
+ dynpmc_files = get_pmcs_from_dir('src/dynpmc/')
+
+ #prepend the arrays to all_files
+ splice all_files, pmc_files, 0, 0
+ splice all_files, dynpmc_files, 0, 0
+
+ total = elements all_files
+ all_files.'sort'()
+
+ plan(total)
+ test_parse(all_files)
+
+.end
+
+.sub get_pmcs_from_dir
+ .param string dir
+ .local pmc files, filtered_files, os, it
+
+ os = new ['OS']
+ files = os.'readdir'(dir)
+ filtered_files = new ['ResizablePMCArray']
+
+ .local int len, is_pmc, total
+ .local string filename, filename_end
+
+ #filter out anything that doesn't end in .pmc
+ it = iter files
+ iter_start:
+ unless it goto iter_done
+ filename = shift it
+
+ len = length filename
+ unless len > 4 goto iter_start
+
+ filename_end = substr filename, -4
+ is_pmc = iseq filename_end, ".pmc"
+ unless is_pmc goto iter_start
+
+ filename = dir . filename
+ push filtered_files, filename
+ goto iter_start
+
+ iter_done:
+ .return (filtered_files)
+.end
+
+.sub 'test_parse'
+ .param pmc pmc_list
+ .local int i
+ .local pmc it
+
+ it = iter pmc_list
+ iter_start:
+ unless it goto iter_done
+ $S0 = shift it
+ test_parse_one($S0)
+ goto iter_start
+ iter_done:
+
+.end
+
+.sub 'test_parse_one'
+ .param string file
+ $S0 = _slurp(file)
+ .local pmc compiler
+ compiler = compreg 'PMC'
+ push_eh fail
+ compiler.'parse'($S0)
+ pop_eh
+ ok(1, file)
+ .return ()
+ fail:
+ pop_eh
+ ok(0, file)
+.end
+
+.sub '_slurp'
+ .param string file
+ .local pmc pio
+ pio = open file
+ $S0 = pio.'readall'()
+ close pio
+ .return ($S0)
+.end
+
+# Don't forget to update plan!
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
More information about the parrot-commits
mailing list