Commit a39255d7 authored by Peter Eisentraut's avatar Peter Eisentraut

pg_test_fsync: Add NLS

Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent 632fbe77
# src/bin/pg_test_fsync/nls.mk
CATALOG_NAME = pg_test_fsync
AVAIL_LANGUAGES =
GETTEXT_FILES = pg_test_fsync.c
GETTEXT_TRIGGERS = die
...@@ -44,7 +44,7 @@ do { \ ...@@ -44,7 +44,7 @@ do { \
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \ if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
INVALID_HANDLE_VALUE) \ INVALID_HANDLE_VALUE) \
{ \ { \
fprintf(stderr, "Cannot create thread for alarm\n"); \ fprintf(stderr, _("Cannot create thread for alarm\n")); \
exit(1); \ exit(1); \
} \ } \
gettimeofday(&start_t, NULL); \ gettimeofday(&start_t, NULL); \
...@@ -96,6 +96,7 @@ static void die(const char *str); ...@@ -96,6 +96,7 @@ static void die(const char *str);
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_test_fsync"));
progname = get_progname(argv[0]); progname = get_progname(argv[0]);
handle_args(argc, argv); handle_args(argc, argv);
...@@ -148,7 +149,7 @@ handle_args(int argc, char *argv[]) ...@@ -148,7 +149,7 @@ handle_args(int argc, char *argv[])
{ {
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
{ {
printf("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n", progname); printf(_("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n"), progname);
exit(0); exit(0);
} }
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0) if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
...@@ -172,7 +173,7 @@ handle_args(int argc, char *argv[]) ...@@ -172,7 +173,7 @@ handle_args(int argc, char *argv[])
break; break;
default: default:
fprintf(stderr, "Try \"%s --help\" for more information.\n", fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname); progname);
exit(1); exit(1);
break; break;
...@@ -182,18 +183,18 @@ handle_args(int argc, char *argv[]) ...@@ -182,18 +183,18 @@ handle_args(int argc, char *argv[])
if (argc > optind) if (argc > optind)
{ {
fprintf(stderr, fprintf(stderr,
"%s: too many command-line arguments (first is \"%s\")\n", _("%s: too many command-line arguments (first is \"%s\")\n"),
progname, argv[optind]); progname, argv[optind]);
fprintf(stderr, "Try \"%s --help\" for more information.\n", fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname); progname);
exit(1); exit(1);
} }
printf("%d seconds per test\n", secs_per_test); printf(_("%d seconds per test\n"), secs_per_test);
#if PG_O_DIRECT != 0 #if PG_O_DIRECT != 0
printf("O_DIRECT supported on this platform for open_datasync and open_sync.\n"); printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
#else #else
printf("Direct I/O is not supported on this platform.\n"); printf(_("Direct I/O is not supported on this platform.\n"));
#endif #endif
} }
...@@ -239,10 +240,10 @@ test_sync(int writes_per_op) ...@@ -239,10 +240,10 @@ test_sync(int writes_per_op)
bool fs_warning = false; bool fs_warning = false;
if (writes_per_op == 1) if (writes_per_op == 1)
printf("\nCompare file sync methods using one %dkB write:\n", XLOG_BLCKSZ_K); printf(_("\nCompare file sync methods using one %dkB write:\n"), XLOG_BLCKSZ_K);
else else
printf("\nCompare file sync methods using two %dkB writes:\n", XLOG_BLCKSZ_K); printf(_("\nCompare file sync methods using two %dkB writes:\n"), XLOG_BLCKSZ_K);
printf("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"); printf(_("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"));
/* /*
* Test open_datasync if available * Test open_datasync if available
...@@ -253,7 +254,7 @@ test_sync(int writes_per_op) ...@@ -253,7 +254,7 @@ test_sync(int writes_per_op)
#ifdef OPEN_DATASYNC_FLAG #ifdef OPEN_DATASYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | O_DSYNC | PG_O_DIRECT, 0)) == -1) if ((tmpfile = open(filename, O_RDWR | O_DSYNC | PG_O_DIRECT, 0)) == -1)
{ {
printf(NA_FORMAT, "n/a*\n"); printf(NA_FORMAT, _("n/a*\n"));
fs_warning = true; fs_warning = true;
} }
else else
...@@ -271,7 +272,7 @@ test_sync(int writes_per_op) ...@@ -271,7 +272,7 @@ test_sync(int writes_per_op)
close(tmpfile); close(tmpfile);
} }
#else #else
printf(NA_FORMAT, "n/a\n"); printf(NA_FORMAT, _("n/a\n"));
#endif #endif
/* /*
...@@ -296,7 +297,7 @@ test_sync(int writes_per_op) ...@@ -296,7 +297,7 @@ test_sync(int writes_per_op)
STOP_TIMER; STOP_TIMER;
close(tmpfile); close(tmpfile);
#else #else
printf(NA_FORMAT, "n/a\n"); printf(NA_FORMAT, _("n/a\n"));
#endif #endif
/* /*
...@@ -344,7 +345,7 @@ test_sync(int writes_per_op) ...@@ -344,7 +345,7 @@ test_sync(int writes_per_op)
STOP_TIMER; STOP_TIMER;
close(tmpfile); close(tmpfile);
#else #else
printf(NA_FORMAT, "n/a\n"); printf(NA_FORMAT, _("n/a\n"));
#endif #endif
/* /*
...@@ -356,7 +357,7 @@ test_sync(int writes_per_op) ...@@ -356,7 +357,7 @@ test_sync(int writes_per_op)
#ifdef OPEN_SYNC_FLAG #ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1) if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
{ {
printf(NA_FORMAT, "n/a*\n"); printf(NA_FORMAT, _("n/a*\n"));
fs_warning = true; fs_warning = true;
} }
else else
...@@ -381,28 +382,28 @@ test_sync(int writes_per_op) ...@@ -381,28 +382,28 @@ test_sync(int writes_per_op)
close(tmpfile); close(tmpfile);
} }
#else #else
printf(NA_FORMAT, "n/a\n"); printf(NA_FORMAT, _("n/a\n"));
#endif #endif
if (fs_warning) if (fs_warning)
{ {
printf("* This file system and its mount options do not support direct\n"); printf(_("* This file system and its mount options do not support direct\n"
printf("I/O, e.g. ext4 in journaled mode.\n"); " I/O, e.g. ext4 in journaled mode.\n"));
} }
} }
static void static void
test_open_syncs(void) test_open_syncs(void)
{ {
printf("\nCompare open_sync with different write sizes:\n"); printf(_("\nCompare open_sync with different write sizes:\n"));
printf("(This is designed to compare the cost of writing 16kB in different write\n" printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
"open_sync sizes.)\n"); "open_sync sizes.)\n"));
test_open_sync(" 1 * 16kB open_sync write", 16); test_open_sync(_(" 1 * 16kB open_sync write"), 16);
test_open_sync(" 2 * 8kB open_sync writes", 8); test_open_sync(_(" 2 * 8kB open_sync writes"), 8);
test_open_sync(" 4 * 4kB open_sync writes", 4); test_open_sync(_(" 4 * 4kB open_sync writes"), 4);
test_open_sync(" 8 * 2kB open_sync writes", 2); test_open_sync(_(" 8 * 2kB open_sync writes"), 2);
test_open_sync("16 * 1kB open_sync writes", 1); test_open_sync(_("16 * 1kB open_sync writes"), 1);
} }
/* /*
...@@ -422,7 +423,7 @@ test_open_sync(const char *msg, int writes_size) ...@@ -422,7 +423,7 @@ test_open_sync(const char *msg, int writes_size)
#ifdef OPEN_SYNC_FLAG #ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1) if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
printf(NA_FORMAT, "n/a*\n"); printf(NA_FORMAT, _("n/a*\n"));
else else
{ {
START_TIMER; START_TIMER;
...@@ -439,7 +440,7 @@ test_open_sync(const char *msg, int writes_size) ...@@ -439,7 +440,7 @@ test_open_sync(const char *msg, int writes_size)
close(tmpfile); close(tmpfile);
} }
#else #else
printf(NA_FORMAT, "n/a\n"); printf(NA_FORMAT, _("n/a\n"));
#endif #endif
} }
...@@ -455,9 +456,9 @@ test_file_descriptor_sync(void) ...@@ -455,9 +456,9 @@ test_file_descriptor_sync(void)
* against the same file. Possibly this should be done with writethrough * against the same file. Possibly this should be done with writethrough
* on platforms which support it. * on platforms which support it.
*/ */
printf("\nTest if fsync on non-write file descriptor is honored:\n"); printf(_("\nTest if fsync on non-write file descriptor is honored:\n"));
printf("(If the times are similar, fsync() can sync data written on a different\n" printf(_("(If the times are similar, fsync() can sync data written on a different\n"
"descriptor.)\n"); "descriptor.)\n"));
/* /*
* first write, fsync and close, which is the normal behavior without * first write, fsync and close, which is the normal behavior without
...@@ -521,7 +522,7 @@ test_non_sync(void) ...@@ -521,7 +522,7 @@ test_non_sync(void)
/* /*
* Test a simple write without fsync * Test a simple write without fsync
*/ */
printf("\nNon-sync'ed %dkB writes:\n", XLOG_BLCKSZ_K); printf(_("\nNon-sync'ed %dkB writes:\n"), XLOG_BLCKSZ_K);
printf(LABEL_FORMAT, "write"); printf(LABEL_FORMAT, "write");
fflush(stdout); fflush(stdout);
...@@ -598,6 +599,6 @@ process_alarm(LPVOID param) ...@@ -598,6 +599,6 @@ process_alarm(LPVOID param)
static void static void
die(const char *str) die(const char *str)
{ {
fprintf(stderr, "%s: %s\n", str, strerror(errno)); fprintf(stderr, _("%s: %s\n"), _(str), strerror(errno));
exit(1); exit(1);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment