Closed toddr closed 2 years ago
╰─> ./cprove -c -v op/bool.t
# Running: Makefile.PL + make install for B::C
Check: ok
Makefile.PL: ok
Make: ok
# Ok: B::C is updated.
# Running: prove --state=save -c -v t/testsuite/C-COMPILED/op/bool.t
t/testsuite/C-COMPILED/op/bool.t ..
1..12
ok 1 - op/bool.t exists
ok 2 - Not in taint mode
ok 3 - /usr/local/cpanel/3rdparty/perl/535/bin/perl -c op/bool.t
# Use static_xs: 0
# /usr/local/cpanel/3rdparty/perl/535/bin/perl -MO=C,-v,-oop/bool.c op/bool.t 2>&1
# [INFO] PL_strtab: size=1239 ; HvMAX=2048
# [INFO] Total number of OPs processed: 11263
# [INFO] NULLOP count: 629
# op/bool.t syntax OK
ok 4 - op/bool.c is generated (-v,)
# /usr/local/cpanel/3rdparty/perl/535/bin/perl /root/workspace/bc/script/cc_harness -Wall -g /root/workspace/bc/t/testsuite/t/op/bool.c -o /root/workspace/bc/t/testsuite/t/op/bool.bin 2>&1
# [cc_harness] Reading .so files from /root/workspace/bc/t/testsuite/t/op/bool.c.lst
# [cc_harness] Running: /usr/bin/gcc -std=gnu99 -DPERL_DISABLE_PMC -fPIC -DPIC -m64 -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/cpanel/3rdparty/perl/535/lib/perl5/535/x86_64-linux-64int/CORE -Wall -g /root/workspace/bc/t/testsuite/t/op/bool.c -o /root/workspace/bc/t/testsuite/t/op/bool.bin /usr/local/cpanel/3rdparty/perl/535/lib/perl5/535/x86_64-linux-64int/auto/B/B.so -Wl,-E -Wl,-rpath,/usr/local/cpanel/3rdparty/perl/535/lib/perl5/535/x86_64-linux-64int/CORE -fstack-protector-strong -L/usr/local/lib -L/usr/local/cpanel/3rdparty/perl/535/lib/perl5/535/x86_64-linux-64int/CORE /usr/local/cpanel/3rdparty/perl/535/lib/perl5/535/x86_64-linux-64int/CORE/libperl.so -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -DSTATICXS -lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
# /root/workspace/bc/t/testsuite/t/op/bool.c:8887:5: warning: missing braces around initializer [-Wmissing-braces]
# { 0, {0}, 5, 7, {0} }, /* xpvhv_with_aux_list[0] */
# ^
# /root/workspace/bc/t/testsuite/t/op/bool.c:8887:5: warning: (near initialization for ‘xpvhv_with_aux_list[0].xhv_aux.xhv_name_u’) [-Wmissing-braces]
# /root/workspace/bc/t/testsuite/t/op/bool.c: In function ‘perl_init_bootstraplink_aaaa’:
# /root/workspace/bc/t/testsuite/t/op/bool.c:45023:18: warning: unused variable ‘gcount’ [-Wunused-variable]
# register int gcount;
# ^
ok 5 - op/bool.bin is compiled and ready to run.
ok 6 - Output parsed by TAP::Harness
ok 7 - Exit signal is 0
ok 8 - Plan was valid
ok 9 - Exit code is 0
ok 10 - Test results:
op/bool.bin ..
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
1..8
ok
All tests successful.
Files=1, Tests=8, 0 wallclock secs ( 0.04 usr 0.00 sys + 0.01 cusr 0.01 csys = 0.06 CPU)
Result: PASS
ok 11 - Tests are in sequence
ok 12 - No TODO tests passed
# List of generated files for op/bool.t
# t/testsuite/t/op/bool.bin
# t/testsuite/t/op/bool.c
# t/testsuite/t/op/bool.c.lst
# t/testsuite/t/op/bool.t
ok
All tests successful.
Files=1, Tests=12, 6 wallclock secs ( 0.06 usr 0.00 sys + 4.91 cusr 0.30 csys = 5.27 CPU)
Result: PASS
let's add one extra test to confirm B::C can compile and use booleans
probably need to add the B API for bool and check its value
if (SvIsBOOL(sv))
PerlIO_printf(file, " [BOOL %s]", ptr == PL_Yes ? "PL_Yes" : "PL_No");
SvPV_set(&PL_sv_no, (char*)PL_No);
SvCUR_set(&PL_sv_no, 0);
SvLEN_set(&PL_sv_no, 0);
SvIV_set(&PL_sv_no, 0);
SvNV_set(&PL_sv_no, 0);
SvPV_set(&PL_sv_yes, (char*)PL_Yes);
SvCUR_set(&PL_sv_yes, 1);
SvLEN_set(&PL_sv_yes, 0);
SvIV_set(&PL_sv_yes, 1);
SvNV_set(&PL_sv_yes, 1);
SvPV_set(&PL_sv_zero, (char*)PL_Zero);
SvCUR_set(&PL_sv_zero, 1);
SvLEN_set(&PL_sv_zero, 0);
SvIV_set(&PL_sv_zero, 0);
SvNV_set(&PL_sv_zero, 0);
PERL_STATIC_INLINE bool
Perl_sv_isbool(pTHX_ const SV *sv)
{
return SvIOK(sv) && SvPOK(sv) && SvIsCOW_static(sv) &&
(SvPVX_const(sv) == PL_Yes || SvPVX_const(sv) == PL_No);
}
fixed by ad52bf0ed54fd732873160ce9ea533e8f486e035
If we already have tests that's awesome