mamod / JavaScript-Duktape

Perl interface to Duktape embeddable javascript engine
MIT License
8 stars 4 forks source link

Installation fails on OS X/perlbrew #1

Closed jomo666 closed 9 years ago

jomo666 commented 9 years ago

Hello, this is THE MODULE for what I looking for long time. Would be nice to get it work on OS X. ;) The "make test" failed. Attached the output from the prove -bv and the perl information.

$ prove -bv
t/perl-data.t .. 
{"f":false,"num":9,"n":null,"t":true,"str":"Hello"}
ok 1 - success from javascript land
ok 2 - success from javascript land
ok 3 - success from javascript land
ok 4 - success from javascript land
ok 5 - success from javascript land
ok 6 - success from javascript land
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14 - success from javascript land
ok 15 - success from javascript land
ok 16 - success from javascript land
Duktape (top=1): undefined
1..16
Destroying 0x7fe3ba0163a0
ok
t/prop.t ....... 
ok 1 - prop value
ok 2 - return value
1..2
Destroying 0x7fcf404a2720
ok
t/safe-call.t .. 
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6 - Error: From Perl at t/safe-call.t line 26.
# 
ok 7
ok 8
ok 9
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_6e63f.xs, line 144.
All 9 subtests passed 
t/trycatch.t ... 
ok 1
ok 2
ok 3
ok 4 - last stack element should be an error
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_6e63f.xs, line 144.
All 4 subtests passed 
t/uncaught.t ... 
ok 1 - duktape uncaught error at t/uncaught.t line 26.
# 
ok 2 - called once
ok 3 - Error On Top
1 (top=0):
ok 4 - duktape uncaught error at t/uncaught.t line 46.
# 
ok 5 - called once
ok 6 - Error on Top
2 (top=0):
ok 7 - 
ok 8 - called once
ok 9 - Error is on top
ok 10 - 
ok 11 - called once
ok 12 - Error is on top
Duktape (top=1): Error: Died at t/uncaught.t line 18.

ok 13 - Error: Died at t/uncaught.t line 18.
# 
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_6e63f.xs, line 144.
All 13 subtests passed 
t/use.t ........ 
ok 1
1..1
Destroying 0x7f8070e51a40
ok

Test Summary Report
-------------------
t/safe-call.t (Wstat: 6 Tests: 9 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/trycatch.t (Wstat: 6 Tests: 4 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/uncaught.t (Wstat: 6 Tests: 13 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
Files=6, Tests=45, 32 wallclock secs ( 0.07 usr  0.03 sys + 27.41 cusr  1.16 csys = 28.67 CPU)
Result: FAIL

The system: Darwin tango.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

Perl:

$ perl -V
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:

  Platform:
    osname=darwin, osvers=14.3.0, archname=darwin-thread-multi-2level
    uname='darwin tango.local 14.3.0 darwin kernel version 14.3.0: mon mar 23 11:59:05 pdt 2015; root:xnu-2782.20.48~5release_x86_64 x86_64 '
    config_args='-de -Dprefix=/Users/clt/perl5/perlbrew/perls/perl-5.20.2 -Dcc=clang -Duse64bitall -Dusethreads -DDEBUGGING -Dusemultiplicity -Accflags=-DPERL_USE_SAFE_PUTENV -Aeval:scriptdir=/Users/clt/perl5/perlbrew/perls/perl-5.20.2/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='clang', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3 -g',
    cppflags='-no-cpp-precomp -arch x86_64 -fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.49)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 clang -arch x86_64', ldflags =' -arch x86_64 -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /opt/local/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_TRACK_MEMPOOL PERL_USE_SAFE_PUTENV
                        USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API
  Built under darwin
  Compiled at May 13 2015 21:55:38
  %ENV:
    PERLBREW_BASHRC_VERSION="0.73"
    PERLBREW_HOME="/Users/clt/.perlbrew"
    PERLBREW_MANPATH="/Users/clt/perl5/perlbrew/perls/perl-5.20.2/man"
    PERLBREW_PATH="/Users/clt/perl5/perlbrew/bin:/Users/clt/perl5/perlbrew/perls/perl-5.20.2/bin"
    PERLBREW_PERL="perl-5.20.2"
    PERLBREW_ROOT="/Users/clt/perl5/perlbrew"
    PERLBREW_VERSION="0.73"
  @INC:
    /Users/clt/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/darwin-thread-multi-2level
    /Users/clt/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2
    /Users/clt/perl5/perlbrew/perls/perl-5.20.2/lib/5.20.2/darwin-thread-multi-2level
    /Users/clt/perl5/perlbrew/perls/perl-5.20.2/lib/5.20.2
    .
mamod commented 9 years ago

@jomo666 thank you for reporting this, I don't have OS X but luckily I could reproduce this issue, I'm going to work on it and ping you once fixed. Please note that this release is a development release and I'm still working on it, API is not likely to be broken though. I'll keep this issue opened until I fix it, thanks again.

mamod commented 9 years ago

@jomo666 ping :) can you please test and confirm if this has been fixed? the failure was due to testing from perl build with debugging enabled -DDEBUGGING, not OSX related issue, but since I have no access to OSX at all it will be awesome if I make sure if everything is working just fine on all platforms, thanks.

jomo666 commented 9 years ago

Thank you for the quick response. Unfortunately, here are still some errors. If I could help somewhat (e.g. if you can tell me, what I should (somewhat) check more deeply, i could try, but i'm not very skilled developer.)

E.g. I could try recompile perl with some different flags, or with the default ones. (now, for example i have the use64bitall non-default setting also the -DDEBUGGING and such - check above the perl -V).

Really would be nice to get this working on OS X + perlbrew, because this could be long-awaited and the only working JS from perl solution. (The v8 and the SpiderMonkey are unmaintained ages..) The JE works, but it is (of course) slow... :) I have access to OS X and Freebsd (not tried yet install on fbsd).

Here is the output:

$ prove -bv
t/eval-function.t .. 
called
ok 1 - Died at t/eval-function.t line 27.
#   ...propagated at t/eval-function.t line 29.
# 
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
All 1 subtests passed 
t/perl-data.t ...... 
{"f":false,"str":"Hello","n":null,"num":9,"t":true}
ok 1 - success from javascript land
ok 2 - success from javascript land
ok 3 - success from javascript land
ok 4 - success from javascript land
ok 5 - success from javascript land
ok 6 - success from javascript land
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14
ok 15
ok 16 - success from javascript land
ok 17 - success from javascript land
ok 18 - success from javascript land
Duktape (top=1): undefined
1..18
ok
t/prop.t ........... 
ok 1 - prop value
ok 2 - return value
1..2
ok
t/safe-call.t ...... 
ok 1
ok 2
ok 3
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
All 3 subtests passed 
t/trycatch.t ....... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
No subtests run 
t/uncaught.t ....... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
No subtests run 
t/use.t ............ 
ok 1
1..1
ok

Test Summary Report
-------------------
t/eval-function.t (Wstat: 6 Tests: 1 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/safe-call.t    (Wstat: 6 Tests: 3 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/trycatch.t     (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/uncaught.t     (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
Files=7, Tests=25,  4 wallclock secs ( 0.07 usr  0.02 sys +  0.80 cusr  0.12 csys =  1.01 CPU)
Result: FAIL
mamod commented 9 years ago

Thanks again, and sorry for the late, in fact it's better to try with your current perl build, I need to know why it fails with your exact build as other cpan testers shows that all darwin tests success except with perl 5.8.8

I'm in the process of cleaning the code, I'll be grateful if you try prove -rb or just plain perl Makefile.PL make && make test

Because there are some 300 more tests in the API folder :)

jomo666 commented 9 years ago

Okay, so:

JavaScript-Duktape-master $ perl Makefile.PL 
Generating a Unix-style Makefile
Writing Makefile for JavaScript::Duktape
Writing MYMETA.yml and MYMETA.json
tango:JavaScript-Duktape-master clt$ make
cp lib/JavaScript/Duktape/C/duktape_wrap.c blib/lib/JavaScript/Duktape/C/duktape_wrap.c
cp lib/JavaScript/Duktape/C/duktape.c blib/lib/JavaScript/Duktape/C/duktape.c
cp lib/JavaScript/Duktape/C/ppport.h blib/lib/JavaScript/Duktape/C/ppport.h
cp lib/JavaScript/Duktape/C/libPath.pm blib/lib/JavaScript/Duktape/C/libPath.pm
cp lib/JavaScript/Duktape.pm blib/lib/JavaScript/Duktape.pm
cp README.pod blib/lib/JavaScript/README.pod
cp lib/JavaScript/Duktape/C/typemap blib/lib/JavaScript/Duktape/C/typemap
cp lib/JavaScript/Duktape/C/FunctionsMap.pl blib/lib/JavaScript/Duktape/C/FunctionsMap.pl
cp lib/JavaScript/Duktape/C/duktape.h blib/lib/JavaScript/Duktape/C/duktape.h
Manifying 3 pod documents
JavaScript-Duktape-master $ make test
PERL_DL_NONLAZY=1 "/Users/clt/perl5/perlbrew/perls/perl-5.20.2/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/eval-function.t t/perl-data.t t/prop.t t/safe-call.t t/trycatch.t t/uncaught.t t/use.t t/api/base64.t t/api/c-constructor.t t/api/call-prop.t t/api/charcodeat.t t/api/check-type.t t/api/compile.t t/api/dev-cfunc-name.t t/api/dup.t t/api/eval-string.t t/api/hex.t t/api/internal-key-access.t t/api/internal-property-basics.t t/api/multithread.t t/api/pcall-method.t t/api/pcall-perl-function.t t/api/pcall-prop.t t/api/pcall.t t/api/pcompile-nofile.t t/api/push_this.t t/api/require-lstring.t t/api/safe-call.t t/api/safe-to-string.t t/api/ttt.t
t/api/base64.t .................... ok    
t/api/c-constructor.t ............. ok   
t/api/call-prop.t ................. ok    
t/api/charcodeat.t ................ ok    
t/api/check-type.t ................ ok    
t/api/compile.t ................... ok    
t/api/dev-cfunc-name.t ............ ok    
t/api/dup.t ....................... ok    
t/api/eval-string.t ............... ok    
t/api/hex.t ....................... ok    
t/api/internal-key-access.t ....... ok   
t/api/internal-property-basics.t .. ok   
t/api/multithread.t ............... ok   
t/api/pcall-method.t .............. ok   
t/api/pcall-perl-function.t ....... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
t/api/pcall-perl-function.t ....... No subtests run 
t/api/pcall-prop.t ................ ok    
t/api/pcall.t ..................... ok   
t/api/pcompile-nofile.t ........... ok    
t/api/push_this.t ................. 1/? # skip -- #skip - this binding: type=8, value='DEADBEEF'
t/api/push_this.t ................. ok    
t/api/require-lstring.t ........... ok    
t/api/safe-call.t ................. ok   
t/api/safe-to-string.t ............ ok    
t/api/ttt.t ....................... ok   
t/eval-function.t ................. 1/? Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
t/eval-function.t ................. All 1 subtests passed 
t/perl-data.t ..................... ok    
t/prop.t .......................... ok   
t/safe-call.t ..................... 1/? Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
t/safe-call.t ..................... All 3 subtests passed 
t/trycatch.t ...................... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
t/trycatch.t ...................... No subtests run 
t/uncaught.t ...................... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
t/uncaught.t ...................... No subtests run 
t/use.t ........................... ok   

Test Summary Report
-------------------
t/api/pcall-perl-function.t     (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/eval-function.t               (Wstat: 6 Tests: 1 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/safe-call.t                   (Wstat: 6 Tests: 3 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/trycatch.t                    (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/uncaught.t                    (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
Files=30, Tests=315, 42 wallclock secs ( 0.20 usr  0.10 sys + 29.17 cusr  2.50 csys = 31.97 CPU)
Result: FAIL
Failed 5/30 test programs. 0/315 subtests failed.
make: *** [test_dynamic] Error 255

also, here is the verbose output

JavaScript-Duktape-master $ make test TEST_VERBOSE=1
PERL_DL_NONLAZY=1 "/Users/clt/perl5/perlbrew/perls/perl-5.20.2/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/eval-function.t t/perl-data.t t/prop.t t/safe-call.t t/trycatch.t t/uncaught.t t/use.t t/api/base64.t t/api/c-constructor.t t/api/call-prop.t t/api/charcodeat.t t/api/check-type.t t/api/compile.t t/api/dev-cfunc-name.t t/api/dup.t t/api/eval-string.t t/api/hex.t t/api/internal-key-access.t t/api/internal-property-basics.t t/api/multithread.t t/api/pcall-method.t t/api/pcall-perl-function.t t/api/pcall-prop.t t/api/pcall.t t/api/pcompile-nofile.t t/api/push_this.t t/api/require-lstring.t t/api/safe-call.t t/api/safe-to-string.t t/api/ttt.t
t/api/base64.t .................... 
ok 1 - *** test_encode (duk_safe_call)
ok 2 - base64 encode: Zm9v
ok 3 - top after: 2
ok 4 - ==> rc=0, result='undefined'
ok 5 - *** test_decode (duk_safe_call)
ok 6 - base64 decode: test string
ok 7 - top after: 2
ok 8 - ==> rc=0, result='undefined'
ok 9 - *** test_decode_invalid_char (duk_safe_call)
ok 10 - ==> rc=1, result='TypeError: base64 decode failed'
1..10
ok
t/api/c-constructor.t ............. 
ok 1 - *** test1 (duk_safe_call)
ok 2 - inherited value
ok 3 - top at end: 0
ok 4 - ==> rc=0, result='undefined'
1..4
ok
t/api/call-prop.t ................. 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - [object Object]
ok 3 - result=33
ok 4 - final top: 1
ok 5 - ==> rc=0, result='undefined'
ok 6 - *** test_2 (duk_safe_call)
ok 7 - [object Object]
ok 8 - ==> rc=1, result='Error: my error'
ok 9 - *** test_3 (duk_safe_call)
ok 10 - object 1 [object Number]
ok 11 - result=undefined
ok 12 - number 1 [object Number]
ok 13 - result=undefined
ok 14 - final top: 1
ok 15 - ==> rc=0, result='undefined'
1..15
ok
t/api/charcodeat.t ................ 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - i=0, n=19, charcode=102
ok 3 - i=1, n=19, charcode=111
ok 4 - i=2, n=19, charcode=111
ok 5 - i=3, n=19, charcode=4660
ok 6 - i=4, n=19, charcode=98
ok 7 - i=5, n=19, charcode=97
ok 8 - i=6, n=19, charcode=114
ok 9 - i=7, n=19, charcode=160
ok 10 - i=8, n=19, charcode=113
ok 11 - i=9, n=19, charcode=117
ok 12 - i=10, n=19, charcode=117
ok 13 - i=11, n=19, charcode=120
ok 14 - i=12, n=19, charcode=0
ok 15 - i=13, n=19, charcode=98
ok 16 - i=14, n=19, charcode=97
ok 17 - i=15, n=19, charcode=122
ok 18 - i=16, n=19, charcode=0
ok 19 - i=17, n=19, charcode=0
ok 20 - i=18, n=19, charcode=0
ok 21 - ==> rc=0, result='undefined'
ok 22 - *** test_2 (duk_safe_call)
ok 23 - ==> rc=1, result='TypeError: unexpected type'
1..23
ok
t/api/check-type.t ................ 
ok 1 - stack[0] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 2 - stack[1] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 3 - stack[2] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 4 - stack[3] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 5 - stack[4] --> DUK_TYPE_NUMBER=1 DUK_TYPE_NONE=0
ok 6 - stack[5] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 7 - stack[6] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 8 - stack[7] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 9 - stack[8] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 10 - stack[9] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 11 - stack[10] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 12 - stack[11] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=0
ok 13 - stack[12] --> DUK_TYPE_NUMBER=0 DUK_TYPE_NONE=1
1..13
ok
t/api/compile.t ................... 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - program
ok 3 - program result: 123.000000
ok 4 - final top: 0
ok 5 - ==> rc=0, result='undefined'
ok 6 - *** test_2 (duk_safe_call)
ok 7 - eval result: 5.000000
ok 8 - final top: 0
ok 9 - ==> rc=0, result='undefined'
ok 10 - *** test_3 (duk_safe_call)
ok 11 - function result: 11.000000
ok 12 - final top: 0
ok 13 - ==> rc=0, result='undefined'
ok 14 - *** test_4 (duk_safe_call)
ok 15 - compile result: SyntaxError: invalid object literal (line 3) (rc=1)
ok 16 - final top: 0
ok 17 - ==> rc=0, result='undefined'
1..17
ok
t/api/dev-cfunc-name.t ............ 
ok 1 - *** test_without_name (duk_safe_call)
ok 2 - my name is: ''
ok 3 - URIError: uri error (rc -106)
ok 4 -  anon  native strict preventsyield
ok 5 -  forEach  native strict preventsyield
ok 6 -  eval XXX preventsyield
ok 7 - ==> rc=0, result='undefined'
ok 8 - *** test_with_name (duk_safe_call)
ok 9 - my name is: 'my_func'
ok 10 - URIError: uri error (rc -106)
ok 11 -     my_func  native strict preventsyield
ok 12 -     forEach  native strict preventsyield
ok 13 -     eval XXX preventsyield
ok 14 - ==> rc=0, result='undefined'
1..14
ok
t/api/dup.t ....................... 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - 0: 123
ok 3 - 1: 234
ok 4 - 2: 123
ok 5 - 3: 123
ok 6 - final top: 4
ok 7 - ==> rc=0, result='undefined'
ok 8 - *** test_2a (duk_safe_call)
ok 9 - ==> rc=1, result='Error: invalid index'
ok 10 - *** test_2b (duk_safe_call)
ok 11 - ==> rc=1, result='Error: invalid index'
ok 12 - *** test_2c (duk_safe_call)
ok 13 - ==> rc=1, result='Error: invalid index'
ok 14 - *** test_3a (duk_safe_call)
ok 15 - ==> rc=1, result='Error: invalid index'
1..15
ok
t/api/eval-string.t ............... 
ok 1 - *** test_string (duk_safe_call)
ok 2 - Hello world!
ok 3 - return value is: 123.000000
ok 4 - result is: 'TESTSTRING'
ok 5 - Hello world!
ok 6 - return value is: 123 (rc=0)
ok 7 - return value is: Error: eval error (rc=1)
ok 8 - return value is: SyntaxError: invalid object literal (line 1) (rc=1)
ok 9 - top=0
ok 10 - Hello world!
ok 11 - top=0
ok 12 - Hello world!
ok 13 - no result, rc=0
ok 14 - top=0
ok 15 - no result, rc=1
ok 16 - top: 0
ok 17 - ==> rc=0, result='undefined'
ok 18 - *** test_lstring (duk_safe_call)
ok 19 - Hello world!
ok 20 - return value is: 123.000000
ok 21 - result is: 'TESTSTRING'
ok 22 - Hello world!
ok 23 - return value is: 123 (rc=0)
ok 24 - return value is: Error: eval error (rc=1)
ok 25 - return value is: SyntaxError: invalid object literal (line 1) (rc=1)
ok 26 - top=0
ok 27 - Hello world!
ok 28 - top=0
ok 29 - Hello world!
ok 30 - no result, rc=0
ok 31 - top=0
ok 32 - no result, rc=1
ok 33 - top: 0
ok 34 - ==> rc=0, result='undefined'
1..34
ok
t/api/hex.t ....................... 
ok 1 - *** test_encode (duk_safe_call)
ok 2 - hex encode: 666f6f
ok 3 - top after: 2
ok 4 - ==> rc=0, result='undefined'
ok 5 - *** test_decode (duk_safe_call)
ok 6 - hex decode: test string
ok 7 - top after: 2
ok 8 - ==> rc=0, result='undefined'
ok 9 - *** test_decode_odd_length (duk_safe_call)
ok 10 - ==> rc=1, result='TypeError: hex decode failed'
ok 11 - *** test_decode_invalid_char (duk_safe_call)
ok 12 - ==> rc=1, result='TypeError: hex decode failed'
1..12
ok
t/api/internal-key-access.t ....... 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - Date._Value: 123456
ok 3 - final top: 2
ok 4 - ==> rc=0, result='undefined'
1..4
ok
t/api/internal-property-basics.t .. 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - {foo:1," \xffbar":3}
ok 3 - final top: 1
ok 4 - ==> rc=0, result='undefined'
1..4
ok
t/api/multithread.t ............... 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - top: 1
ok 3 - ==> rc=1, result='ReferenceError: identifier 'aiee' undefined'
ok 4 - *** test_2 (duk_safe_call)
ok 5 - top: 1
ok 6 - ==> rc=1, result='ReferenceError: identifier 'zork' undefined'
1..6
ok
t/api/pcall-method.t .............. 
ok 1 - object 123
ok 2 - rc=0, result='21'
ok 3 - number 123
ok 4 - rc=0, result='21'
ok 5 - rc=1, result='Error: my error'
ok 6 - final top: 0
1..6
ok
t/api/pcall-perl-function.t ....... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
No subtests run 
t/api/pcall-prop.t ................ 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - me
ok 3 - rc=0, result='21'
ok 4 - ==> rc=0, result='undefined'
ok 5 - *** test_2 (duk_safe_call)
ok 6 - object 123
ok 7 - rc=0, result='21'
ok 8 - ==> rc=0, result='undefined'
ok 9 - *** test_3 (duk_safe_call)
ok 10 - number 123
ok 11 - rc=0, result='21'
ok 12 - ==> rc=0, result='undefined'
ok 13 - *** test_4 (duk_safe_call)
ok 14 - rc=1, result='Error: my error'
ok 15 - ==> rc=0, result='undefined'
ok 16 - *** test_5 (duk_safe_call)
ok 17 - rc=1, result='TypeError: invalid base value'
ok 18 - ==> rc=0, result='undefined'
ok 19 - *** test_6 (duk_safe_call)
ok 20 - rc=1, result='RangeError: getter error'
ok 21 - ==> rc=0, result='undefined'
ok 22 - *** test_7 (duk_safe_call)
ok 23 - rc=1, result='Error: invalid index'
ok 24 - ==> rc=0, result='undefined'
ok 25 - *** test_8 (duk_safe_call)
ok 26 - rc=1, result='TypeError: not callable'
ok 27 - ==> rc=0, result='undefined'
ok 28 - *** test_9 (duk_safe_call)
ok 29 - ==> rc=1, result='Error: invalid call args'
ok 30 - final top: 0
1..30
ok
t/api/pcall.t ..................... 
ok 1 - rc=0, result='21'
ok 2 - top after pop: 0
ok 3 - rc=1, result='Error: my error'
ok 4 - top after pop: 0
ok 5 - final top: 0
1..5
ok
t/api/pcompile-nofile.t ........... 
ok 1 - *** test_peval_file (duk_safe_call)
ok 2 - rc: 1
ok 3 - result: Error: no sourcecode
ok 4 - final top: 1
ok 5 - ==> rc=0, result='undefined'
ok 6 - *** test_peval_file_noresult (duk_safe_call)
ok 7 - rc: 1
ok 8 - final top: 0
ok 9 - ==> rc=0, result='undefined'
ok 10 - *** test_pcompile_file (duk_safe_call)
ok 11 - rc: 1
ok 12 - result: Error: no sourcecode
ok 13 - final top: 1
ok 14 - ==> rc=0, result='undefined'
1..14
ok
t/api/push_this.t ................. 
ok 1 - top: 11
ok 2 - this binding: type=1, value='undefined'
ok 3 - this binding: type=2, value='null'
ok 4 - this binding: type=3, value='true'
ok 5 - this binding: type=3, value='false'
ok 6 - this binding: type=4, value='123.456'
ok 7 - this binding: type=5, value='foo'
ok 8 - this binding: type=6, value='[object Object]'
ok 9 - this binding: type=6, value=''
ok 10 - this binding: type=7, value=''
1..10
# skip -- #skip - this binding: type=8, value='DEADBEEF'
ok
t/api/require-lstring.t ........... 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - string: foo (7)
ok 3 - string: foo
ok 4 - string: (0)
ok 5 - string:
ok 6 - ==> rc=0, result='undefined'
ok 7 - *** test_2 (duk_safe_call)
ok 8 - ==> rc=1, result='TypeError: not string'
ok 9 - *** test_3 (duk_safe_call)
ok 10 - ==> rc=1, result='TypeError: not string'
ok 11 - *** test_4 (duk_safe_call)
ok 12 - ==> rc=1, result='TypeError: not string'
1..12
ok
t/api/safe-call.t ................. 
ok 1 - 1st return value: 21
ok 2 - 2nd return value: undefined
ok 3 - error: Error: test_2 error
ok 4 - final top: 1
1..4
ok
t/api/safe-to-string.t ............ 
ok 1 - *** test_1 (duk_safe_call)
ok 2 - top=4
ok 3 - duk_safe_to_string[0] = '123'
ok 4 - top=4
ok 5 - duk_safe_to_string[1] = 'toString result'
ok 6 - top=4
ok 7 - duk_safe_to_string[2] = 'Error: toString error'
ok 8 - top=4
ok 9 - duk_safe_to_string[3] = 'Error'
ok 10 - top=4
ok 11 - duk_safe_to_lstring_null[0] = '123'
ok 12 - top=4
ok 13 - duk_safe_to_lstring_null[1] = 'toString result'
ok 14 - top=4
ok 15 - duk_safe_to_lstring_null[2] = 'Error: toString error'
ok 16 - top=4
ok 17 - duk_safe_to_lstring_null[3] = 'Error'
ok 18 - top=4
ok 19 - duk_safe_to_lstring[0] = '123', len 3
ok 20 - top=4
ok 21 - duk_safe_to_lstring[1] = 'toString result', len 15
ok 22 - top=4
ok 23 - duk_safe_to_lstring[2] = 'Error: toString error', len 21
ok 24 - top=4
ok 25 - duk_safe_to_lstring[3] = 'Error', len 5
ok 26 - top=4
ok 27 - duk_safe_to_lstring[0] = '123', len 3
ok 28 - top=4
ok 29 - duk_safe_to_lstring[1] = 'toString result', len 15
ok 30 - top=4
ok 31 - duk_safe_to_lstring[2] = 'Error: toString error', len 21
ok 32 - top=4
ok 33 - duk_safe_to_lstring[3] = 'Error', len 5
ok 34 - ==> rc=0, result='undefined'
1..34
ok
t/api/ttt.t ....................... 
ok 1 - *** test1 (duk_safe_call)
ok 2 - inherited value
ok 3 - top at end: 0
ok 4 - ==> rc=0, result='undefined'
1..4
ok
t/eval-function.t ................. 
called
ok 1 - Died at t/eval-function.t line 27.
#   ...propagated at t/eval-function.t line 29.
# 
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
All 1 subtests passed 
t/perl-data.t ..................... 
{"num":9,"f":false,"n":null,"str":"Hello","t":true}
ok 1 - success from javascript land
ok 2 - success from javascript land
ok 3 - success from javascript land
ok 4 - success from javascript land
ok 5 - success from javascript land
ok 6 - success from javascript land
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14
ok 15
ok 16 - success from javascript land
ok 17 - success from javascript land
ok 18 - success from javascript land
Duktape (top=1): undefined
1..18
ok
t/prop.t .......................... 
ok 1 - prop value
ok 2 - return value
1..2
ok
t/safe-call.t ..................... 
ok 1
ok 2
ok 3
Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
All 3 subtests passed 
t/trycatch.t ...................... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
No subtests run 
t/uncaught.t ...................... Assertion failed: (PL_top_env == &cur_env), function perl_duk_safe_call, file Vm_4bdf.xs, line 125.
No subtests run 
t/use.t ........................... 
ok 1
1..1
ok

Test Summary Report
-------------------
t/api/pcall-perl-function.t     (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/eval-function.t               (Wstat: 6 Tests: 1 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/safe-call.t                   (Wstat: 6 Tests: 3 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/trycatch.t                    (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
t/uncaught.t                    (Wstat: 6 Tests: 0 Failed: 0)
  Non-zero wait status: 6
  Parse errors: No plan found in TAP output
Files=30, Tests=315,  7 wallclock secs ( 0.20 usr  0.09 sys +  3.63 cusr  0.56 csys =  4.48 CPU)
Result: FAIL
Failed 5/30 test programs. 0/315 subtests failed.
make: *** [test_dynamic] Error 255

Also, switched off my perlbrew and tried the perl installed from the macports and you're right, - it is installed without any errors. Here is the output:

$ perl Makefile.PL 
Generating a Unix-style Makefile
Writing Makefile for JavaScript::Duktape
Writing MYMETA.yml and MYMETA.json
tango:JavaScript-Duktape-master clt$ make
cp lib/JavaScript/Duktape/C/ppport.h blib/lib/JavaScript/Duktape/C/ppport.h
cp lib/JavaScript/Duktape/C/duktape.h blib/lib/JavaScript/Duktape/C/duktape.h
cp README.pod blib/lib/JavaScript/README.pod
cp lib/JavaScript/Duktape/C/duktape_wrap.c blib/lib/JavaScript/Duktape/C/duktape_wrap.c
cp lib/JavaScript/Duktape/C/duktape.c blib/lib/JavaScript/Duktape/C/duktape.c
cp lib/JavaScript/Duktape.pm blib/lib/JavaScript/Duktape.pm
cp lib/JavaScript/Duktape/C/FunctionsMap.pl blib/lib/JavaScript/Duktape/C/FunctionsMap.pl
cp lib/JavaScript/Duktape/C/libPath.pm blib/lib/JavaScript/Duktape/C/libPath.pm
cp lib/JavaScript/Duktape/C/typemap blib/lib/JavaScript/Duktape/C/typemap
Manifying 3 pod documents
JavaScript-Duktape-master $ make test
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.16" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/eval-function.t t/perl-data.t t/prop.t t/safe-call.t t/trycatch.t t/uncaught.t t/use.t t/api/base64.t t/api/c-constructor.t t/api/call-prop.t t/api/charcodeat.t t/api/check-type.t t/api/compile.t t/api/dev-cfunc-name.t t/api/dup.t t/api/eval-string.t t/api/hex.t t/api/internal-key-access.t t/api/internal-property-basics.t t/api/multithread.t t/api/pcall-method.t t/api/pcall-perl-function.t t/api/pcall-prop.t t/api/pcall.t t/api/pcompile-nofile.t t/api/push_this.t t/api/require-lstring.t t/api/safe-call.t t/api/safe-to-string.t t/api/ttt.t
t/api/base64.t .................... ok    
t/api/c-constructor.t ............. ok   
t/api/call-prop.t ................. ok    
t/api/charcodeat.t ................ ok    
t/api/check-type.t ................ ok    
t/api/compile.t ................... ok    
t/api/dev-cfunc-name.t ............ ok    
t/api/dup.t ....................... ok    
t/api/eval-string.t ............... ok    
t/api/hex.t ....................... ok    
t/api/internal-key-access.t ....... ok   
t/api/internal-property-basics.t .. ok   
t/api/multithread.t ............... ok   
t/api/pcall-method.t .............. ok   
t/api/pcall-perl-function.t ....... ok   
t/api/pcall-prop.t ................ ok    
t/api/pcall.t ..................... ok   
t/api/pcompile-nofile.t ........... ok    
t/api/push_this.t ................. 1/? # skip -- #skip - this binding: type=8, value='DEADBEEF'
t/api/push_this.t ................. ok    
t/api/require-lstring.t ........... ok    
t/api/safe-call.t ................. ok   
t/api/safe-to-string.t ............ ok    
t/api/ttt.t ....................... ok   
t/eval-function.t ................. ok   
t/perl-data.t ..................... ok    
t/prop.t .......................... ok   
t/safe-call.t ..................... ok    
t/trycatch.t ...................... ok    
t/uncaught.t ...................... ok    
t/use.t ........................... ok   
All tests successful.
Files=30, Tests=354, 24 wallclock secs ( 0.18 usr  0.08 sys + 21.63 cusr  1.12 csys = 23.01 CPU)
Result: PASS

the macport's perl

JavaScript-Duktape-master $ perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=darwin, osvers=14.0.0, archname=darwin-thread-multi-2level
    uname='darwin tenten-slave.macports.org 14.0.0 darwin kernel version 14.0.0: fri sep 19 00:26:44 pdt 2014; root:xnu-2782.1.97~2release_x86_64 x86_64 '
    config_args='-Dinc_version_list=5.16.1/darwin-thread-multi-2level 5.16.1 5.16.0/darwin-thread-multi-2level 5.16.0 -des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin -Dcppflags=-I/opt/local/include -Dccflags=-pipe -Os  -Dldflags=-L/opt/local/lib -Wl,-headerpad_max_install_names  -Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrplib -Dcc=/usr/bin/clang -Dld=env MACOSX_DEPLOYMENT_TARGET=10.10 /usr/bin/clang -Dman1ext=1pm -Dman3ext=3pm -Dman1dir=/opt/local/share/man/man1p -Dman3dir=/opt/local/share/man/man3p -Dsitebin=/opt/local/libexec/perl5.16/sitebin -Dsiteman1dir=/opt/local/share/perl5.16/siteman/man1 -Dsiteman3dir=/opt/local/share/perl5.16/siteman/man3 -Dvendorbin=/opt/local/libexec/perl5.16 -Dvendorman1dir=/opt/local/share/perl5.16/man/man1 -Dvendorman3dir=/opt/local/share/perl5.16/man/man3 -Dpager=/usr/bin/less -sR -Dperlpath=/opt/local/bin/perl5.16 -Dstartperl=#!/opt/local/bin/perl5.16'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='/usr/bin/clang', ccflags ='-pipe -Os  -fno-common -DPERL_DARWIN -I/opt/local/include -fno-strict-aliasing -fstack-protector -I/opt/local/include',
    optimize='-O3',
    cppflags='-I/opt/local/include -pipe -Os  -fno-common -DPERL_DARWIN -I/opt/local/include -fno-strict-aliasing -fstack-protector -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.10 /usr/bin/clang', ldflags ='-L/opt/local/lib -Wl,-headerpad_max_install_names  -fstack-protector'
    libpth=/opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-L/opt/local/lib -Wl,-headerpad_max_install_names  -bundle -undefined dynamic_lookup -fstack-protector'

Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under darwin
  Compiled at Jan  8 2015 16:14:39
  %ENV:
    PERLBREW_BASHRC_VERSION="0.73"
    PERLBREW_HOME="/Users/clt/.perlbrew"
    PERLBREW_PATH="/Users/clt/perl5/perlbrew/bin"
    PERLBREW_ROOT="/Users/clt/perl5/perlbrew"
    PERLBREW_VERSION="0.73"
  @INC:
    /opt/local/lib/perl5/site_perl/5.16.3/darwin-thread-multi-2level
    /opt/local/lib/perl5/site_perl/5.16.3
    /opt/local/lib/perl5/vendor_perl/5.16.3/darwin-thread-multi-2level
    /opt/local/lib/perl5/vendor_perl/5.16.3
    /opt/local/lib/perl5/5.16.3/darwin-thread-multi-2level
    /opt/local/lib/perl5/5.16.3
    /opt/local/lib/perl5/site_perl
    /opt/local/lib/perl5/vendor_perl
    .

So, clearly - the problem is somewhere in my perlbrew's compile flags. Going to experiment a bit and will report. Thank you for your effort!

mamod commented 9 years ago

Thanks for the detailed tests, I just uploaded a new development release and it should fix this issue, it also fixes a previous failure with perl v5.8 so let's hope this time tests will pass at your end :) please let me know once you have the time.

jomo666 commented 9 years ago

Wow, great work. Tested under 5 different perls what i have installed, (OS installed, macports and 3x perlbrew) and it works without any problems. All tests passed. One skipped with a message: t/api/push_this.t ................. 1/? # skip -- #skip - this binding: type=8, value='DEADBEEF' but the result is:

All tests successful.
Files=30, Tests=354, 35 wallclock secs ( 0.21 usr  0.10 sys + 29.34 cusr  1.65 csys = 31.30 CPU)

Thank you very much. Closing. :)

mamod commented 9 years ago

The skipped test is the default behavior so no need to worry :)

Thank you for bearing with me on this issue, please don't hesitate to report any issue as I'm intending to release a production version very soon and keep it well maintained.