Some test portability fixes again + minor changes

This commit is contained in:
Yorhel 2025-03-02 10:06:33 +01:00
parent 3fd424c6e3
commit f09a103c53
7 changed files with 33 additions and 28 deletions

View file

@ -666,8 +666,8 @@ module does not.
Converted between floating point seconds since C<00:00:00>, supporting
microsecond precision. This format allows for easy comparison against Unix
timestamps (time of day = C<$timestamp % 86400>) and can be added to an integer
date value to form a complete timestamp.
timestamps (time of day in UTC = C<$timestamp % 86400>) and can be added to an
integer date value to form a complete timestamp.
(There's no support for the string format yet)

View file

@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
os_unsupported if $^O eq 'MSWin32'; # I don't know on which OS'es the code will work exactly, but this one I can easily rule out.
os_unsupported if $Config{ivsize} < 8;
os_unsupported if $Config{ptrsize} < 8;
os_unsupported if $Config{usequadmath};
WriteMakefile(
@ -15,12 +15,16 @@ WriteMakefile(
MIN_PERL_VERSION => 'v5.36',
META_MERGE => {
dynamic_config => 0,
'meta-spec' => { version => 2 },
resources => {
repository => 'https://code.blicky.net/yorhel/fu',
bugtracker => 'https://code.blicky.net/yorhel/fu/issues',
repository => {
web => 'https://code.blicky.net/yorhel/fu',
type => 'git',
},
bugtracker => {
web => 'https://code.blicky.net/yorhel/fu/issues',
mailto => 'projects@yorhel.nl',
},
no_index => {
file => 'bench.PL',
},
},
depend => { '$(OBJECT)', 'c/*.c' },

View file

@ -223,6 +223,7 @@ sub fmtbench($id, $text, $xs, $ys) {
open my $F, '>FU/Benchmarks.pod' or die $!;
select $F;
while (<DATA>) {
s/^%/=/;
s#^:modules#join '', map sprintf("=item L<%s> %s\n\n", $_, $modules{$_}), sort keys %modules#e;
s#^:benches (.+)#join '', map fmtbench(@$_), grep $_->[0] =~ /$1/, @bench#e;
print;
@ -233,12 +234,13 @@ sub fmtbench($id, $text, $xs, $ys) {
}
}
# s/^=/%/ to prevent tools from interpreting the below as POD
__DATA__
=head1 NAME
%head1 NAME
FU::Benchmarks - A bunch of automated benchmark results.
=head1 DESCRIPTION
%head1 DESCRIPTION
This file is automatically generated from 'bench.PL' in the L<FU> distribution.
These benchmarks compare performance of some FU functionality against similar
@ -256,19 +258,19 @@ real-world use.
B<DISCLAIMER#3:> Many of these benchmarks exists solely to test edge case
performance, these numbers are not representative for real-world use.
=head1 MODULE VERSIONS
%head1 MODULE VERSIONS
The following module versions were used:
=over
%over
:modules
=back
%back
=head1 BENCHMARKS
%head1 BENCHMARKS
=head2 JSON Parsing & Formatting
%head2 JSON Parsing & Formatting
These benchmarks run on large-ish arrays with repeated values. JSON encoding is
sufficiently fast that Perl function calling overhead tends to dominate for
@ -279,10 +281,10 @@ SIMD parts are only used for parsing.
:benches ^json
=head2 XML Writing
%head2 XML Writing
:benches ^xml
=cut
%cut
# Cached data used by bench.PL. Same as the formatted tables above but easier to parse.

View file

@ -488,7 +488,7 @@ static void fupg_refresh_types(pTHX_ fupg_conn *c) {
t->send = fupg_send_text;
t->recv = fupg_recv_text;
} else {
/* TODO: (multi)ranges, custom overrides, by-name lookup for dynamic-oid types */
/* TODO: (multi)ranges, by-name lookup for dynamic-oid types */
const fupg_type *builtin = fupg_builtin_byoid(t->oid);
if (builtin) {
t->send = builtin->send;
@ -571,11 +571,8 @@ static void fupg_tio_setup(pTHX_ fupg_conn *conn, fupg_tio *tio, int flags, Oid
return;
}
/* Minor wart? When the type is overridden by oid, the name & oid in error
* messages will be that of the builtin type. When overridden by name, the
* name will be correct but the oid is still of the builtin type.
* Some send/recv functions have slightly different behavior based on oid,
* in those cases this behavior is useful. */
/* Minor wart? When the type is overridden by oid, its name in error
* messages will be that of the builtin type instead of the actual type. */
SV *cb = NULL;
const fupg_type *e, *t;

View file

@ -456,8 +456,8 @@ RECVFN(perlcb) {
call_sv(ctx->cb, G_SCALAR);
SPAGAIN;
SV *ret = newSV(0);
sv_setsv(ret, POPs);
SV *ret = POPs;
SvREFCNT_inc(ret);
PUTBACK;
FREETMPS;

View file

@ -55,7 +55,7 @@ my @tests = (
''.$$, '"'.$$.'"',
do { my $x = 12; utf8::decode($x); $x }, '"12"',
do { no warnings 'numeric'; my $x = '19a'; $x += 0; $x }, '19',
1844674407370955161 / 10, $Config{uselongdouble} ? 184467440737095516 : '1.84467440737096e+17',
$Config{uselongdouble} ? () : ( 1844674407370955161 / 10, '1.84467440737096e+17' ),
);
my @errors = (

View file

@ -97,8 +97,10 @@ num ' -0 ', 0;
num '-9223372036854775808';
num '9223372036854775807';
num '18446744073709551615';
num '-9223372036854775809', $Config{uselongdouble} ? -9.22337203685477581e+18 : -9.22337203685478e+18;
num '18446744073709551616', $Config{uselongdouble} ? 1.84467440737095516e+19 : 1.84467440737096e+19;
if (!$Config{uselongdouble}) { # Behavior of longdouble is architecture-dependent
num '-9223372036854775809', -9.22337203685478e+18;
num '18446744073709551616', 1.84467440737096e+19;
}
num '1.234';
num '1e5', 100000;
num '1e+5', 100000;