Ticket #950 (closed patch: done)

Opened 5 years ago

Last modified 5 years ago

[PATCH]: Convert Perl tests to use test_more.pir for t/op/gc.t

Reported by: jrtayloriv Owned by: dukeleto
Priority: trivial Milestone:
Component: testing Version: 1.5.0
Severity: low Keywords: tests
Cc: Language:
Patch status: new Platform: all

Description

I have started converting the tests from t/op/gc.t so that they use PIR instead of PASM, and use test_more.pir instead of Perl.

I can't use test_more.pir and the Test.pm functions in the same file, so I split the tests up into two files, so that I can convert the tests incrementally instead of having to do them all at once.

The two files are:

(1) t/op/gc.t -- all of the new test_more.pir tests
(2) t/op/gc_perl.t -- all of the old tests from the original gc.t that I haven't converted yet.

This is just for while I am converting them, and ultimately gc_perl.t would disappear once everything is in PIR and using test_more.pir

Attachments

gc.t.patch Download (13.4 KB) - added by jrtayloriv 5 years ago.
gc_perl.t Download (7.7 KB) - added by jrtayloriv 5 years ago.
gc.t Download (3.0 KB) - added by jrtayloriv 5 years ago.
gc.t--broken Download (4.9 KB) - added by jrtayloriv 5 years ago.
tests fail and prevent later tests from running
gc-new.t Download (4.9 KB) - added by dukeleto 5 years ago.
This version passes all tests
gc.t--patch Download (17.4 KB) - added by jrtayloriv 5 years ago.
Finished version
gc.2.t Download (9.9 KB) - added by jrtayloriv 5 years ago.

Change History

Changed 5 years ago by jrtayloriv

Changed 5 years ago by jrtayloriv

Changed 5 years ago by jrtayloriv

  • attachment gc.t Download added

Changed 5 years ago by dukeleto

This is a great start jrtayloriv++, how much longer do you think it will take you to finish converting the tests? I am wondering if it is worth splitting the file, or just waiting until you are done.

Changed 5 years ago by jrtayloriv

dukeleto --

I am not sure how long it will take me.

I am still learning PIR/PASM and Test::More -- I am not sure what the best way is to convert some of the tests, and in some cases I'm not sure how to convert them at all, at this point. I figured that by splitting the tests into two files, then I could still post up what I had done and if I got stuck and could go no further, it would at least take a few minutes of busy work off of someone else's hands, since they would only have to finish up whatever tests I had left over.

Also, for larger files which have many more tests, such as t/op/string.t, it would be nice if someone doesn't have to sit down and convert them all at once. Having two files would enable people to just convert a test or two at a time and go about their merry way. Might motivate more people to convert tests, who might not have the time to sit down and do 50-150 of them.

By coming up with a standard naming conventions for the files that are undergoing this conversion, and by putting a prominent notice in each file so that test writers know which file to put their tests in (and to remind them to just go ahead and write them in PIR) -- I think it could be done in a pretty straightforward manner.

But, if it is a problem to do have the files split up, then by all means don't do it. I will just wait to post up a patch until I have figured out how to do it.

Sorry for the confusion, and thank you for bearing with me while I figure this all out.

--jrtayloriv

Changed 5 years ago by coke

In the tcl spec test suite, you see a lot of

foo.test

foo-old.test

And while I haven't any of their -old tests go away, I think this is
the right direction. Have "foo.t" be the parrot-native style, have
foo-old.t be the original perl version.

When doing the initial split, be sure to do an svn copy so we preserve history.

Changed 5 years ago by jrtayloriv

I'm currently having trouble with one of the tests that I have converted from PASM to PIR -- regsave_marked() ("fail if regsave is not marked").

Currently, running 'prove -v t/op/gc.t' on my copy is giving the following error:

t/op/gc.t .. 
1..117
Null PMC access in set_string_native()
current instr.: 'regsave_marked' pc 127 (t/op/gc.t:45)
called from Sub 'main' pc 38 (t/op/gc.t:26)
Dubious, test returned 1 (wstat 256, 0x100)
Failed 117/117 subtests 

Test Summary Report
-------------------
t/op/gc.t (Wstat: 256 Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 117 tests but ran 0.
Files=1, Tests=0,  0 wallclock secs ( 0.02 usr +  0.01 sys =  0.03 CPU)
Result: FAIL

I have attached the gc.t file that is causing this problem with the name "gc.t--broken".

I tried to look at the what is happening in the test with gdb, but got lost fairly quickly ... here's what I got:

jrt4@localhost ~/code/parrot-test2 $ gdb parrot
GNU gdb 6.8
This GDB was configured as "x86_64-pc-linux-gnu"...
(gdb) break null_pmc_access
Function "null_pmc_access" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (null_pmc_access) pending.
(gdb) run t/op/gc.t
Starting program: /home/jrt4/code/parrot-test2/parrot t/op/gc.t
[Thread debugging using libthread_db enabled]
1..117
[New Thread 0x7f273439b6f0 (LWP 25071)]
[Switching to Thread 0x7f273439b6f0 (LWP 25071)]

Breakpoint 1, null_pmc_access (interp=0x155a080, index=224) at ./src/pmc/null.pmc:25
25      {
(gdb) bt
#0  null_pmc_access (interp=0x155a080, index=224) at ./src/pmc/null.pmc:25
#1  0x00007f2733e6717e in Parrot_Null_set_string_native (interp=0x155a080, pmc=<value optimized out>, value=0x16be5c8) at ./src/pmc/null.c:2269
#2  0x00007f2733d907aa in Parrot_set_p_sc (cur_opcode=0x169dbe8, interp=0x155a080) at src/ops/set.ops:186
#3  0x00007f2733e193dd in runops_slow_core (interp=0x155a080, pc=0x169dbe8) at src/runcore/cores.c:462
#4  0x00007f2733e184f2 in runops_int (interp=0x155a080, offset=0) at src/runcore/main.c:987
#5  0x00007f2733dd353e in runops (interp=0x155a080, offs=<value optimized out>) at src/call/ops.c:119
#6  0x00007f2733dd3748 in runops_args (interp=0x155a080, sub=0x16277b0, obj=<value optimized out>, meth_unused=<value optimized out>, sig=0x7f2733f1cbb4 "vP", ap=0x7fff358fdd60) at src/call/ops.c:269
#7  0x00007f2733dd446a in Parrot_runops_fromc_args (interp=0x155a080, sub=0xe0, sig=0x7f2733f1cbb4 "vP") at src/call/ops.c:338
#8  0x00007f2733f0ab05 in imcc_run (interp=0x155a080, sourcefile=0x7fff358ff2fa "t/op/gc.t", argc=1, argv=0x7fff358fdfb0) at compilers/imcc/main.c:801
#9  0x0000000000400c22 in main (argc=1, argv=0x7fff358fdfb0) at src/main.c:60

If there is anything further I should do in gdb, please let me know.

Any idea if I've done something wrong here, or if this is some sort of bug?

--jrtayloriv

Changed 5 years ago by jrtayloriv

Bah ... amongst several other stupid mistakes, I forgot a "newclass" in one of the instructions -- I'll post up a working version once I get everything straightened out.

--jrtayloriv

Changed 5 years ago by jrtayloriv

tests fail and prevent later tests from running

Changed 5 years ago by jrtayloriv

The current version of gc.t--broken (attached) fails and causes the following errors:

jrt4@localhost ~/code/parrot-test2 $ prove -v t/op/gc.t 
t/op/gc.t .. 
1..117
not ok 1
not ok 2
# Have: 
# Want: hello
# Have: 
# Want: hello
Could not find non-existent sub sweep_1
current instr.: 'main' pc 42 (t/op/gc.t:27)
Dubious, test returned 1 (wstat 256, 0x100)
Failed 117/117 subtests 

Test Summary Report
-------------------
t/op/gc.t (Wstat: 256 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 117 tests but ran 2.
Files=1, Tests=2,  0 wallclock secs ( 0.02 usr +  0.01 sys =  0.03 CPU)
Result: FAIL

Changed 5 years ago by dukeleto

This version passes all tests

Changed 5 years ago by dukeleto

  • owner set to dukeleto

Changed 5 years ago by dukeleto

  • status changed from new to assigned

Changed 5 years ago by jrtayloriv

Finished version

Changed 5 years ago by jrtayloriv

Changed 5 years ago by dukeleto

  • status changed from assigned to closed
  • resolution set to done

Patch applied as r40836, jrtayloriv++

Note: See TracTickets for help on using tickets.