[svn:parrot] r44768 - branches/ops_pct/compilers/opsc/t

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Mar 8 19:56:43 UTC 2010


Author: bacek
Date: Mon Mar  8 19:56:42 2010
New Revision: 44768
URL: https://trac.parrot.org/parrot/changeset/44768

Log:
Rename test files.

Added:
   branches/ops_pct/compilers/opsc/t/05-oplib.t
      - copied, changed from r44767, branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t
   branches/ops_pct/compilers/opsc/t/06-opsfile.t
      - copied, changed from r44767, branches/ops_pct/compilers/opsc/t/05-opsfile.t
   branches/ops_pct/compilers/opsc/t/07-emitter.t
      - copied, changed from r44767, branches/ops_pct/compilers/opsc/t/06-emitter.t
Deleted:
   branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t
   branches/ops_pct/compilers/opsc/t/05-opsfile.t
   branches/ops_pct/compilers/opsc/t/06-emitter.t

Deleted: branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t	Mon Mar  8 19:56:42 2010	(r44767)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,36 +0,0 @@
-#!./parrot-nqp
-
-# Checking for OpLib num and skip files parsing.
-
-pir::load_bytecode("compilers/opsc/opsc.pbc");
-
-plan(6);
-
-my @files := ('src/ops/core.ops', 'src/ops/math.ops');
-
-my $lib := Ops::OpLib.new.BUILD(
-    :files(@files),
-    :num_file('src/ops/ops.num'),
-    :skip_file('src/ops/ops.skip'),
-);
-
-$lib.parse_ops();
-
-# 84 core
-# 116 math
-ok(+($lib.ops_past) == 84 + 116, "ops file parsed");
-say("# count " ~+$lib.ops_past);
-#_dumper($lib.ops_past);
-
-# It's 1258 currently. But testing for exact match isn't nessary.
-ok( $lib.max_op_num > 1200, "ops.num file parsed");
-
-# Check couple random ops.
-ok( $lib.optable<end> == 0, "'end' have code 0");
-ok( $lib.optable<set_addr_p_i> == 42, "'set_addr_p_i' have code 42");
-
-ok( $lib.skiptable<abs_i_ic>,       "'abs_i_ic' in skiptable");
-ok( $lib.skiptable<ne_nc_nc_ic>,    "'ne_nc_nc_ic' in skiptable");
-#_dumper($lib.skiptable);
-
-# vim: expandtab shiftwidth=4 ft=perl6:

Copied and modified: branches/ops_pct/compilers/opsc/t/05-oplib.t (from r44767, branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t)
==============================================================================
--- branches/ops_pct/compilers/opsc/t/04-oplib_parse_ops.t	Mon Mar  8 19:56:02 2010	(r44767, copy source)
+++ branches/ops_pct/compilers/opsc/t/05-oplib.t	Mon Mar  8 19:56:42 2010	(r44768)
@@ -8,7 +8,7 @@
 
 my @files := ('src/ops/core.ops', 'src/ops/math.ops');
 
-my $lib := Ops::OpLib.new.BUILD(
+my $lib := Ops::OpLib.new(
     :files(@files),
     :num_file('src/ops/ops.num'),
     :skip_file('src/ops/ops.skip'),

Deleted: branches/ops_pct/compilers/opsc/t/05-opsfile.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/05-opsfile.t	Mon Mar  8 19:56:42 2010	(r44767)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,41 +0,0 @@
-#!./parrot-nqp
-
-pir::load_bytecode("compilers/opsc/opsc.pbc");
-pir::load_bytecode("nqp-settings.pbc");
-
-plan(8);
-
-my $f := Ops::File.new();
-ok($f, "Empty Ops::File created");
-
-my @files := <
-    src/ops/core.ops
-    src/ops/math.ops
->;
-
-$f := Ops::File.new(|@files);
-
-my @ops := $f.ops;
-# 84 core
-# 116 math
-# We can generate more than 1 Ops::Op per op due args expansion.
-say( "# Parsed " ~ + at ops);
-ok( @ops > 84 + 116, "Ops parsed correctly");
-
-my $op := @ops[0];
-#_dumper($op);
-# First op should be C<end> and has code 0.
-ok($op.name eq 'end',   "First op is end");
-ok($op<code> == 0,      "... with code 0");
-
-$op := @ops[(+ at ops)-1];
-ok($op.name eq 'fact',  "Last op is fact");
-ok($op<code> > 84 + 116,    "... with non zero code");
-
-my $version := join(' ', |$f.version);
-ok( $version ~~ /^\d+ \s \d+ \s \d+$/, "Version parsed");
-say("# $version");
-
-ok( $f.preamble ~~ /pmc_parrotlibrary.h/, "Preamble preserved");
-
-# vim: expandtab shiftwidth=4 ft=perl6:

Deleted: branches/ops_pct/compilers/opsc/t/06-emitter.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/06-emitter.t	Mon Mar  8 19:56:42 2010	(r44767)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,106 +0,0 @@
-#! ./parrot-nqp
-
-pir::load_bytecode("compilers/opsc/opsc.pbc");
-pir::load_bytecode("nqp-settings.pbc");
-
-plan(20);
-
-my $trans := Ops::Trans::C.new();
-
-my @files := <
-    src/ops/io.ops
-    src/ops/sys.ops
-    src/ops/cmp.ops
->;
-
-my $f := Ops::File.new(|@files);
-my $emitter := Ops::Emitter.new(
-    :ops_file($f), :trans($trans), :script('ops2c'),
-    :flags(
-        hash( dir => 'tmp/', core => 1 )
-    ),
-);
-
-ok( $emitter, "Emitter created");
-ok( $emitter<include> eq 'parrot/oplib/core_ops.h', 'Include is correct');
-say('# ' ~ $emitter<include>);
-ok( $emitter<header> ~~ /^tmp/, 'header file in tmp');
-say('# ' ~ $emitter<header>);
-
-#$emitter.print_c_header_file();
-
-my $fh := pir::new__Ps('StringHandle');
-$fh.open('header.h', 'w');
-$emitter.emit_c_header_file($fh);
-
-$fh.close();
-my $header := $fh.readall();
-
-ok($header ~~ /define \s PARROT_OPLIB_CORE_OPS_H_GUARD/, 'Guard generated');
-ok($header ~~ /endif/, 'Close guard generated');
-ok($header ~~ /DO \s NOT \s EDIT \s THIS \s FILE/, 'Preamble generated');
-ok($header ~~ /Parrot_DynOp_core_ \d+ _ \d+ _ \d+/, '... and contains init_func');
-ok($header ~~ /Parrot_sysinfo_s_i/, 'We have proper names of ops functions');
-
-# Testing C emitting.
-#$emitter.print_c_source_file();
-
-$fh := pir::new__Ps('StringHandle');
-$fh.open('core.c', 'w');
-$emitter.emit_c_source_file($fh);
-
-$fh.close();
-my $source := $fh.readall();
-
-ok($source ~~ /DO \s NOT \s EDIT \s THIS \s FILE/, 'Preamble generated');
-ok($source ~~ /Parrot_pcc_get_constants/, 'defines from Trans::C generated');
-ok($source ~~ /io_private.h/, 'Preamble from io.ops preserved');
-
-ok($source ~~ /static \s int \s get_op/, 'Trans::C preamble generated');
-
-ok($source ~~ /PARROT_FUNCTION_CORE/, 'Trans::C core_type preserved');
-ok($source ~~ /static \s size_t \s hash_str/, 'Trans::C op_lookup preserved');
-
-ok($source ~~ /'PREG(1)'/, 'Trans::C arg translation works');
-ok($source ~! /'OP_SIZE'/, 'Trans::C translates OP_SIZE');
-
-# "eq"
-ok($source ~~ /'0,' \s '0,' \s '1'/, "Labels handled correctly");
-
-my $op_body := '
-inline op do_stuff(invar PMC)
-{
-    restart ADDRESS(234);
-}';
-my $new_body := translate_op_body($trans, $op_body);
-my $restart_addr_ok := $new_body ~~ /'return' \s '(' 'opcode_t' \s '*' ')' \s '234'/;
-ok($restart_addr_ok, "restart ADDRESS() translated ok");
-
-$op_body := '
-inline op branch(in LABEL) :base_loop :flow {
-    goto OFFSET($1);
-}';
-$new_body := translate_op_body($trans, $op_body);
-$restart_addr_ok := $new_body ~~ /'return (opcode_t *) cur_opcode + IREG(1);'/;
-ok($restart_addr_ok, "goto OFFSET() and \$1 translated ok");
-ok($new_body ~~ /'PARROT_JUMP_RELATIVE'/, "jump flags generated");
-
-#say($source);
-
-sub translate_op_body($trans, $body) {
-    my $file  := Ops::File.new_str($body);
-    my $emitter := Ops::Emitter.new(
-        :ops_file($file),
-        :trans($trans),
-        :script("opsc"),
-        :flags( hash(core => '1') )
-    );
-
-    my $sh := pir::new__Ps('StringHandle');
-    $sh.open('your_bank_account_information.txt', 'w');
-    $emitter.emit_c_source_file($sh);
-    $sh.close();
-    $sh.readall();
-}
-
-# vim: expandtab shiftwidth=4 ft=perl6:

Copied and modified: branches/ops_pct/compilers/opsc/t/06-opsfile.t (from r44767, branches/ops_pct/compilers/opsc/t/05-opsfile.t)
==============================================================================

Copied and modified: branches/ops_pct/compilers/opsc/t/07-emitter.t (from r44767, branches/ops_pct/compilers/opsc/t/06-emitter.t)
==============================================================================


More information about the parrot-commits mailing list