Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit daf554d

Browse filesBrowse files
committed
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.
1 parent 661ab4e commit daf554d
Copy full SHA for daf554d

File tree

Expand file treeCollapse file tree

2 files changed

+37
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+37
-1
lines changed

‎src/test/modules/test_json_parser/meson.build

Copy file name to clipboardExpand all lines: src/test/modules/test_json_parser/meson.build
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ tests += {
4646
'tests': [
4747
't/001_test_json_parser_incremental.pl',
4848
't/002_inline.pl',
49-
't/003_test_semantic.pl'
49+
't/003_test_semantic.pl',
50+
't/004_test_parser_perf.pl'
5051
],
5152
},
5253
}
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
use strict;
3+
use warnings;
4+
5+
use PostgreSQL::Test::Utils;
6+
use Test::More;
7+
use FindBin;
8+
9+
use File::Temp qw(tempfile);
10+
11+
my $test_file = "$FindBin::RealBin/../tiny.json";
12+
13+
my $exe = "test_json_parser_perf";
14+
15+
my $contents = slurp_file($test_file);
16+
17+
my ($fh, $fname) = tempfile(UNLINK => 1);
18+
19+
# repeat the input json file 50 times in an array
20+
21+
print $fh, '[', $contents , ",$contents" x 49 , ']';
22+
23+
close($fh);
24+
25+
# but only do one iteration
26+
27+
my ($result) = run_log([ $exe, "1", $fname ] );
28+
29+
ok($result == 0, "perf test runs with RD parser");
30+
31+
$result = run_log([ $exe, "-i" , "1", $fname ]);
32+
33+
ok($result == 0, "perf test runs with table driven parser");
34+
35+
done_testing();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.