go-v8 icon indicating copy to clipboard operation
go-v8 copied to clipboard

Testsuite does not work

Open surma opened this issue 11 years ago • 1 comments

Hey :)

I just started working with (and on) go-v8 and I'm currently unable to run the test suite. I usually hate opening issues without including a fix, but I feel I'm not knowledgable enough about v8 to fix this v8-specific problem on my own. I was hoping we could take a stab at it together.

Symptoms

I'm working on 2 system:

  • Ubuntu 12.10, go version 1.0.3, libv8 3.8.9.20-2
  • Mac OS X 10.8.2, go version 1.0.3, libv8 3.16.14

On both systems the test suite fails like this.

Analysis

After some investigation I found, that this test fails as well (even if executed separately):

func TestMultipleContexts(t *testing.T) {
    _ = NewContext()
    _ = NewContext()
}

The first NewContext() call works just fine (and I get a working context in which JavaScript can be executed etc. But if I want to instantiate a second context it fails before the actual C++ constructor is being called.

It turns out that if I comment Line 118 in v8wrap.cc the error disappears.

class V8Context {
  // ...
  private:
    // ...
    //v8::HandleScope handle_scope_; 
    // ...
}

I tried to reason what this member variable is for, but it is never used and looking at the corresponding commit didn't help either. It seems though that the implicit initialization of this member variable is causing v8 to abort.

After commenting that line, I can now instantiate a second context. But the tests still fail. Differently, though:

  • OS X
-- FAIL: TestAddFunc (0.00 seconds)
v8_test.go:68:  Unexpected arg 0 type, expecting float64
        panic: interface conversion: interface is string, not float64 [recovered]
    panic: interface conversion: interface is string, not float64
  • Ubuntu
--- FAIL: TestAddFunc (0.00 seconds)
v8_test.go:63:  Unexpected arg 0 type, expecting float64
        unexpected fault address 0xfffffffffffffffb
throw: fault
[signal 0xb code=0x1 addr=0xfffffffffffffffb pc=0x7fb53be77693]

I hope, you can help me with this :)

surma avatar Mar 12 '13 16:03 surma

Could you please try this in latest?

mattn avatar Aug 19 '13 10:08 mattn