jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
57 stars 59 forks source link

Errors while building 1.02 #72

Closed bcornec closed 7 years ago

bcornec commented 7 years ago

While trying to build this version for the Mageia Linux Ditribution, I have these 4 errors:


#   Failed test 'errors: /v: Does not match uri format.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x2a4c090)
# []
Format rule for 'unknown' is missing at /users/bruno/Maison/bruno/prj/mageia/perl-JSON-Validator/BUILD/JSON-Validator-1.02/blib/lib/JSON/Validator.pm line 478.
# Looks like you failed 1 test of 28.
t/jv-formats.t ......................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/28 subtests 

#   Failed test 'errors: /credit_card: Missing billing_address.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x2ef9938)
# []
# Looks like you failed 1 test of 19.
t/jv-object.t .......................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/19 subtests 

#   Failed test 'errors: /v: Does not match float format.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x313b2a8)
# []

#   Failed test 'errors: /v: Does not match uri format.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x3146740)
# []
Format rule for 'unknown' is missing at /users/bruno/Maison/bruno/prj/mageia/perl-JSON-Validator/BUILD/JSON-Validator-1.02/blib/lib/JSON/Validator.pm line 478.
# Looks like you failed 2 tests of 24.
t/openapi-formats.t .................... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/24 subtests 

Any idea what could be the issue here ? TIA, Bruno.

jhthorsen commented 7 years ago

How do you build it? Are you using cpanm? Can you give me the exact command you're running?

bcornec commented 7 years ago

I'm building using package dependencies (not CPAN), so I may miss some of them (I used Makefile.PL to get required deps). And the command used is:

$ /usr/bin/perl Makefile.PL INSTALLDIRS=vendor
Warning: prerequisite Test::More 1.30 not found. We have 1.001014.
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for JSON::Validator
Writing MYMETA.yml and MYMETA.json
$ make -O -j12

[works]

$ make test

failing as described above.

bcornec commented 7 years ago

Could the check for Test::More giving a warning be the problem ?

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

  Platform:
    osname=linux, osvers=4.4.65-server-1.mga5, archname=x86_64-linux-thread-multi
    uname='linux ecosse.mageia.org 4.4.65-server-1.mga5 #1 smp fri apr 28 14:48:17 utc 2017 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dinc_version_list=5.22.3 5.22.3/x86_64-linux-thread-multi 5.22.2 5.22.2/x86_64-linux-thread-multi 5.22.1 5.22.1/x86_64-linux-thread-multi 5.22.0 5.22.0/x86_64-linux-thread-multi 5.20.1 5.20.0 5.18.2 5.18.1 5.18.0 5.16.3 5.16.3 5.16.2 5.16.2 5.16.1 5.16.1 5.16.0 5.16.0 -Darchname=x86_64-linux -Dcc=gcc -Doptimize=-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wl,--as-needed  -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -pthread -DDEBUGGING=-g -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dsitebin=/usr/local/bin -Dsiteman1dir=/usr/local/share/man/man1 -Dsiteman3dir=/usr/local/share/man/man3 -Dman3dir=/usr/share/man/man3pm -Dvendorman3dir=/usr/share/man/man3 -Dman3ext=3pm -Dcf_by=Mageia -Dmyhostname=localhost -Dperladmin=root@localhost -Dcf_email=root@localhost -Dperllibs=-lnsl -ldl -lm -lcrypt -lutil -lc -pthread -Ud_csh -Duseshrplib -Duseithreads -Di_db -Di_ndbm -Di_gdbm'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wl,--as-needed -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -pthread',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.4.0', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector-strong -L/usr/local/lib64'
    libpth=/usr/local/lib /usr/lib /usr/local/lib64 /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.22.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.22'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wl,--as-needed -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -pthread -L/usr/local/lib64 -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options: 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
                        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_LOCALE_TIME
                        USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
  Locally applied patches:
        Mageia patches
  Built under linux
  Compiled at Jun  6 2017 18:40:23
  @INC:
    /usr/lib/perl5/site_perl/5.22.3/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.22.3
    /usr/lib/perl5/vendor_perl/5.22.3/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.22.3
    /usr/lib/perl5/5.22.3/x86_64-linux-thread-multi
    /usr/lib/perl5/5.22.3
    /usr/lib/perl5/site_perl/5.22.3
    /usr/lib/perl5/site_perl/5.22.3/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.20.1
    /usr/lib/perl5/site_perl/5.18.1
    /usr/lib/perl5/site_perl/5.16.3
    /usr/lib/perl5/site_perl/5.16.3
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.22.3
    /usr/lib/perl5/vendor_perl/5.22.3/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.22.2
    /usr/lib/perl5/vendor_perl/5.22.2/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.22.1
    /usr/lib/perl5/vendor_perl/5.22.0
    /usr/lib/perl5/vendor_perl/5.20.1
    /usr/lib/perl5/vendor_perl/5.20.0
    /usr/lib/perl5/vendor_perl/5.18.2
    /usr/lib/perl5/vendor_perl/5.18.1
    /usr/lib/perl5/vendor_perl/5.16.3
    /usr/lib/perl5/vendor_perl/5.16.3
    /usr/lib/perl5/vendor_perl/5.16.2
    /usr/lib/perl5/vendor_perl/5.16.2
    /usr/lib/perl5/vendor_perl/5.16.0
    /usr/lib/perl5/vendor_perl/5.16.0
    /usr/lib/perl5/vendor_perl
    .
jhthorsen commented 7 years ago

I was certain I had release 1.03. Sorry about the delay!

This is fixed in 0fc9d68 and ab29fec.

bcornec commented 7 years ago

Same errors with 1.03:

+ cd /users-ssd/bruno/prj/mageia/perl-JSON-Validator/BUILD
+ cd JSON-Validator-1.03
+ '[' 1 -eq 1 ']'
+ make test
PERL_DL_NONLAZY=1 "/usr/bin/perl5.22.3" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-basic.t ........................... ok
t/acceptance.t ......................... ok
t/booleans-xs.t ........................ skipped: Cpanel::JSON::XS and Mojo::JSON::MaybeXS is required.
t/booleans.t ........................... ok
t/coerce-args.t ........................ ok
t/deep-mixed-ref.t ..................... ok
t/invalid-ref.t ........................ ok
t/issue-22-duplicate-error-messages.t .. ok
t/issue-27-yaml-syck-false.t ........... ok
t/issue-42-cache-control.t ............. skipped: TEST_ONLINE=1
t/issue-71-additionalproperties.t ...... ok
t/jv-allof.t ........................... ok
t/jv-anyof.t ........................... ok
t/jv-array.t ........................... ok
t/jv-basic.t ........................... ok
t/jv-boolean.t ......................... ok
t/jv-const.t ........................... ok
t/jv-enum.t ............................ ok
Format rule for 'unknown' is missing at /users-ssd/bruno/prj/mageia/perl-JSON-Validator/BUILD/JSON-Validator-1.03/blib/lib/JSON/Validator.pm line 475.
t/jv-formats.t ......................... ok
t/jv-integer.t ......................... ok
t/jv-not.t ............................. ok
t/jv-number.t .......................... ok

#   Failed test 'errors: /credit_card: Missing billing_address.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x1d926c0)
# []
# Looks like you failed 1 test of 19.
t/jv-object.t .......................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/19 subtests 
t/jv-oneof.t ........................... ok
t/jv-required.t ........................ ok
t/jv-string.t .......................... ok
t/load-and-validate-spec.t ............. ok
t/load-data.t .......................... ok
t/load-http.t .......................... skipped: TEST_ONLINE=1
t/load-json.t .......................... ok
t/load-same-file-only-once.t ........... ok
t/load-yaml.t .......................... ok
t/openapi-compatibility.t .............. ok

#   Failed test 'errors: /v: Does not match float format.'
#   at t/Helper.pm line 16.
#     Structures begin differing at:
#          $got->[0] = Does not exist
#     $expected->[0] = HASH(0x2f29350)
# []
Format rule for 'unknown' is missing at /users-ssd/bruno/prj/mageia/perl-JSON-Validator/BUILD/JSON-Validator-1.03/blib/lib/JSON/Validator.pm line 475.
# Looks like you failed 1 test of 24.
t/openapi-formats.t .................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/24 subtests 
t/openapi-request.t .................... ok
t/openapi-response.t ................... ok
# /huntingSkill: Missing property.
t/openapi.t ............................ ok
t/petstore.t ........................... ok
t/recursion.t .......................... ok
t/relative-ref.t ....................... ok
t/resolve.t ............................ ok
t/schema-as-attr.t ..................... ok
t/to-json.t ............................ ok
t/validate-id.t ........................ ok
t/validate-json.t ...................... ok
t/validate-recursive.t ................. ok
t/validate-schema.t .................... ok

Test Summary Report
-------------------
t/acceptance.t                       (Wstat: 0 Tests: 265 Failed: 0)
  TODO passed:   45-47, 49-52, 56-57
t/jv-object.t                        (Wstat: 256 Tests: 19 Failed: 1)
  Failed test:  18
  Non-zero exit status: 1
t/openapi-formats.t                  (Wstat: 256 Tests: 24 Failed: 1)
  Failed test:  12
  Non-zero exit status: 1
t/openapi-response.t                 (Wstat: 0 Tests: 7 Failed: 0)
  TODO passed:   1
t/openapi.t                          (Wstat: 0 Tests: 8 Failed: 0)
  TODO passed:   1
Files=47, Tests=584, 16 wallclock secs ( 0.20 usr  0.01 sys + 15.48 cusr  0.58 csys = 16.27 CPU)
Result: FAIL
Failed 2/47 test programs. 2/584 subtests failed.
Makefile:878: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
jhthorsen commented 7 years ago

It looks like your version of Test::More does not care about things like local $TODO = 'Add support for dependencies';. Not sure why it doesn't.

I'm also unsure why Test::More >= 1.30 is not required.

https://github.com/jhthorsen/json-validator/blob/master/Makefile.PL#L17

bcornec commented 7 years ago

Thanks for taking time to look at this !

Test::More < 1.30 seems to give just a Warning, as mentioned upper, but doesn't abort the install :-( But somehow, it's nice as it allows me to pass nearly all tests, and to have a working version anyway on my platform.

This version of the module is the one coming with the perl version provided with the Mageia distribution 6 (perl 5.22.3). It's not a separate module I can upgrade easily in that case :-(

It seems that the next version (cauldron, future Mageia 7) comes with perl 5.26.1 which contains which is 1.302073 so that requirement should be ok then. I'll try to build for that devel version to see whether it works better.

jhthorsen commented 7 years ago

You could just install it without running the tests.

perl Makefile.PL
make install

or

cpanm -n JSON::Validator

or

curl -L https://cpanmin.us | perl - -n https://github.com/jhthorsen/json-validator/archive/master.tar.gz
bcornec commented 7 years ago

Sorry if I wasn't clear. The software installs without issue and seems to work fine (now that you helped me fix my api.xml file) as it validates my initial example, so I'm fine with that.

It's just that generally our Linux distribution activates the make test part in the .spec file to build the RPM and here it is causing an issue I wanted to report to you so you may advise me whether I miss something or whether it's something you can reproduce upstream, which doesn't seem to be the case :-(

So:

perl Makefile.PL
make install

works as well as the module.

make test

doesn't in my case.

jhthorsen commented 7 years ago

I'm not going to fix that. But I welcome a pull request.

Sorry.