Ticket #386 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

Failure in t/dynpmc/foo.t if parrot directory has an extension

Reported by: mikehh Owned by:
Priority: normal Milestone:
Component: none Version: trunk
Severity: medium Keywords:
Cc: rg@… Language:
Patch status: Platform:

Description

While working on TT#380 testing builds with and without the --optimize flag I copied my parrot directory to a new directory parrot.noopt and found that while the test I was working on (t/pmc/exceptionhandler.t passed all 8 tests as opposed to only 6 tests with the optimize flag set) the third test in t/dynpmc/foo.t was failing.

At a later revision the other test passed but t/dynpmc/foo.t was still failing, but passing in the --optimized build. None of the other smolder tests seemed to be failing this test - with or without the --optimize. If fact my AMD64 build was passing and that does not build with --optimize.

I did a clean checkout into parrot.nopt and still had a failure. Then I built my regular parrot directory without the --optimize and the test passed.

mhk@mhk-desktop:~/parrot.nopt$ cat .parrot_current_rev
37055
mhk@mhk-desktop:~/parrot.nopt$ date
Sun Mar  1 00:32:52 GMT 2009
mhk@mhk-desktop:~/parrot.nopt$ prove --verbose t/dynpmc/foo.t
t/dynpmc/foo.t ..
1..9
ok 1 - get_integer
ok 2 - loadlib with relative pathname, no ext
not ok 3 - loadlib with absolute pathname, no ext

#   Failed test 'loadlib with absolute pathname, no ext'
#   at t/dynpmc/foo.t line 57.
# Exited with error code: 1
# Received:
# Class 'Foo' not found
# current instr.: 'main' pc 16 (/home/mhk/parrot.nopt/t/dynpmc/foo_3.pir:15)
#
# Expected:
# 42
#
ok 4 - loadlib with relative pathname & ext
ok 5 - loadlib with absolute pathname & ext
ok 6 - inherited add
ok 7 - Foo subclass isa Integer
ok 8 - .HLL 1
ok 9 - .HLL 2
# Looks like you failed 1 test of 9.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/9 subtests

Test Summary Report
-------------------
t/dynpmc/foo.t (Wstat: 256 Tests: 9 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
Files=1, Tests=9,  0 wallclock secs ( 0.04 usr  0.01 sys +  0.21 cusr  0.11 csys =  0.37 CPU)
Result: FAIL
mhk@mhk-desktop:~/parrot.nopt$

mhk@mhk-desktop:~/parrot$ cat .parrot_current_rev
37055
mhk@mhk-desktop:~/parrot$ date
Sun Mar  1 00:11:05 GMT 2009
mhk@mhk-desktop:~/parrot$ prove --verbose t/dynpmc/foo.t
t/dynpmc/foo.t ..
1..9
ok 1 - get_integer
ok 2 - loadlib with relative pathname, no ext
ok 3 - loadlib with absolute pathname, no ext
ok 4 - loadlib with relative pathname & ext
ok 5 - loadlib with absolute pathname & ext
ok 6 - inherited add
ok 7 - Foo subclass isa Integer
ok 8 - .HLL 1
ok 9 - .HLL 2
ok
All tests successful.
Files=1, Tests=9,  1 wallclock secs ( 0.04 usr  0.00 sys +  0.21 cusr  0.12 csys =  0.37 CPU)
Result: PASS
mhk@mhk-desktop:~/parrot$

Looking at the generated pir files from the test the only difference between test 3 and test 5 for instance is in adding the extension. Also the relative path in test 2 passes. At this stage the only possible problen area I can see is in loadlib - which inlines Parrot_load_lib.

foo_3.pir in directory t/dynpmc/

.sub main :main
    ## get cwd in $S0.
    .include "iglobals.pasm"
    $P11 = getinterp
    $P12 = $P11[.IGLOBALS_CONFIG_HASH]
    $S0 = $P12["prefix"]

    ## convert cwd to an absolute pathname without the extension, and load it.
    ## this should always find the version in the build directory, since that's
    ## the only place "make test" will work.
    $S0 = concat "/runtime/parrot/dynext/foo"
    loadlib $P1, $S0

    ## ensure that we can still make Foo instances.
    $P1 = new "Foo"
    $I1 = $P1
    print $I1
    print "\n"
.end

foo_5.pir

.sub main :main
    ## get cwd in $S0, load_ext in $S1.
    .include "iglobals.pasm"
    $P11 = getinterp
    $P12 = $P11[.IGLOBALS_CONFIG_HASH]
    $S0 = $P12["prefix"]
    $S1 = $P12["load_ext"]

    ## convert $S0 to an absolute pathname with extension, and load it.
    ## this should always find the version in the build directory, since that's
    ## the only place "make test" will work.
    $S0 = concat $S0, "/runtime/parrot/dynext/foo"
    $S0 = concat $S0, $S1
    loadlib $P1, $S0

    ## ensure that we can still make Foo instances.
    $P1 = new "Foo"
    $I1 = $P1
    print $I1
    print "\n"
.end

and foo_2.pir

.sub main :main
    ## load a relative pathname without the extension.  loadlib will convert the
    ## '/' characters to '\\' on windows.
    $S0 = "runtime/parrot/dynext/foo"
    loadlib $P1, $S0

    ## ensure that we can still make Foo instances.
    $P1 = new "Foo"
    $I1 = $P1
    print $I1
    print "\n"
.end

The only conclusion I can reach at the moment is that loadlib is getting confused with the extension - parrot.nopt - in the directory without having the extension added as in test 5 - which passes.

If I copy parrot.nopt to parrot_nopt and rebuild - make realclean, perl Configure.pl, make - the test passes.

At this stage a workaround is not to use extensions in the parrot directory, but this needs further investigation.

Attachments

split_path.diff Download (0.5 KB) - added by rg 6 years ago.

Change History

Changed 6 years ago by rg

  • cc rg@… added

That's an interesting bug ... and a simple fix. I'm kind of surprised the original author actually thought of the possibility of directory names containing a dot, but only excluded it for version numbers. Well, I'm attaching a patch. It doesn't break any tests for me and fixes the described problem.

Changed 6 years ago by rg

Changed 5 years ago by allison

  • status changed from new to closed
  • resolution set to fixed

Patch applied in r37210. Thanks!

Resolving this ticket.

Allison

Note: See TracTickets for help on using tickets.