aboutsummaryrefslogtreecommitdiff
path: root/src/test/modules/test_json_parser/test_json_parser_perf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/modules/test_json_parser/test_json_parser_perf.c')
-rw-r--r--src/test/modules/test_json_parser/test_json_parser_perf.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/modules/test_json_parser/test_json_parser_perf.c b/src/test/modules/test_json_parser/test_json_parser_perf.c
index c463046848c..f5c0e8dd9ae 100644
--- a/src/test/modules/test_json_parser/test_json_parser_perf.c
+++ b/src/test/modules/test_json_parser/test_json_parser_perf.c
@@ -23,6 +23,7 @@
#include "postgres_fe.h"
#include "common/jsonapi.h"
+#include "common/logging.h"
#include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include <stdio.h>
@@ -52,7 +53,9 @@ main(int argc, char **argv)
sscanf(argv[1], "%d", &iter);
- json_file = fopen(argv[2], "r");
+ if ((json_file = fopen(argv[2], "r")) == NULL)
+ pg_fatal("Could not open input file '%s': %m", argv[2]);
+
while ((n_read = fread(buff, 1, 6000, json_file)) > 0)
{
appendBinaryStringInfo(&json, buff, n_read);
@@ -76,12 +79,8 @@ main(int argc, char **argv)
freeJsonLexContext(lex);
}
if (result != JSON_SUCCESS)
- {
- fprintf(stderr,
- "unexpected result %d (expecting %d) on parse\n",
- result, JSON_SUCCESS);
- exit(1);
- }
+ pg_fatal("unexpected result %d (expecting %d) on parse",
+ result, JSON_SUCCESS);
}
exit(0);
}