mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Add a TAP test for test_json_parser_perf
This just makes sure the test can run with a single iteration. A real performance test would test with many more.
This commit is contained in:
parent
661ab4e185
commit
daf554dbea
@ -46,7 +46,8 @@ tests += {
|
|||||||
'tests': [
|
'tests': [
|
||||||
't/001_test_json_parser_incremental.pl',
|
't/001_test_json_parser_incremental.pl',
|
||||||
't/002_inline.pl',
|
't/002_inline.pl',
|
||||||
't/003_test_semantic.pl'
|
't/003_test_semantic.pl',
|
||||||
|
't/004_test_parser_perf.pl'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
35
src/test/modules/test_json_parser/t/004_test_parser_perf.pl
Normal file
35
src/test/modules/test_json_parser/t/004_test_parser_perf.pl
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use PostgreSQL::Test::Utils;
|
||||||
|
use Test::More;
|
||||||
|
use FindBin;
|
||||||
|
|
||||||
|
use File::Temp qw(tempfile);
|
||||||
|
|
||||||
|
my $test_file = "$FindBin::RealBin/../tiny.json";
|
||||||
|
|
||||||
|
my $exe = "test_json_parser_perf";
|
||||||
|
|
||||||
|
my $contents = slurp_file($test_file);
|
||||||
|
|
||||||
|
my ($fh, $fname) = tempfile(UNLINK => 1);
|
||||||
|
|
||||||
|
# repeat the input json file 50 times in an array
|
||||||
|
|
||||||
|
print $fh, '[', $contents , ",$contents" x 49 , ']';
|
||||||
|
|
||||||
|
close($fh);
|
||||||
|
|
||||||
|
# but only do one iteration
|
||||||
|
|
||||||
|
my ($result) = run_log([ $exe, "1", $fname ] );
|
||||||
|
|
||||||
|
ok($result == 0, "perf test runs with RD parser");
|
||||||
|
|
||||||
|
$result = run_log([ $exe, "-i" , "1", $fname ]);
|
||||||
|
|
||||||
|
ok($result == 0, "perf test runs with table driven parser");
|
||||||
|
|
||||||
|
done_testing();
|
Loading…
x
Reference in New Issue
Block a user