Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commita39255d

Browse files
committed
pg_test_fsync: Add NLS
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent632fbe7 commita39255d

File tree

2 files changed

+41
-35
lines changed

2 files changed

+41
-35
lines changed

‎src/bin/pg_test_fsync/nls.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# src/bin/pg_test_fsync/nls.mk
2+
CATALOG_NAME = pg_test_fsync
3+
AVAIL_LANGUAGES =
4+
GETTEXT_FILES = pg_test_fsync.c
5+
GETTEXT_TRIGGERS = die

‎src/bin/pg_test_fsync/pg_test_fsync.c

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ do { \
4444
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
4545
INVALID_HANDLE_VALUE) \
4646
{ \
47-
fprintf(stderr, "Cannot create thread for alarm\n"); \
47+
fprintf(stderr,_("Cannot create thread for alarm\n")); \
4848
exit(1); \
4949
} \
5050
gettimeofday(&start_t, NULL); \
@@ -96,6 +96,7 @@ static void die(const char *str);
9696
int
9797
main(intargc,char*argv[])
9898
{
99+
set_pglocale_pgservice(argv[0],PG_TEXTDOMAIN("pg_test_fsync"));
99100
progname=get_progname(argv[0]);
100101

101102
handle_args(argc,argv);
@@ -148,7 +149,7 @@ handle_args(int argc, char *argv[])
148149
{
149150
if (strcmp(argv[1],"--help")==0||strcmp(argv[1],"-?")==0)
150151
{
151-
printf("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n",progname);
152+
printf(_("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n"),progname);
152153
exit(0);
153154
}
154155
if (strcmp(argv[1],"--version")==0||strcmp(argv[1],"-V")==0)
@@ -172,7 +173,7 @@ handle_args(int argc, char *argv[])
172173
break;
173174

174175
default:
175-
fprintf(stderr,"Try \"%s --help\" for more information.\n",
176+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),
176177
progname);
177178
exit(1);
178179
break;
@@ -182,18 +183,18 @@ handle_args(int argc, char *argv[])
182183
if (argc>optind)
183184
{
184185
fprintf(stderr,
185-
"%s: too many command-line arguments (first is \"%s\")\n",
186+
_("%s: too many command-line arguments (first is \"%s\")\n"),
186187
progname,argv[optind]);
187-
fprintf(stderr,"Try \"%s --help\" for more information.\n",
188+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),
188189
progname);
189190
exit(1);
190191
}
191192

192-
printf("%d seconds per test\n",secs_per_test);
193+
printf(_("%d seconds per test\n"),secs_per_test);
193194
#ifPG_O_DIRECT!=0
194-
printf("O_DIRECT supported on this platform for open_datasync and open_sync.\n");
195+
printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
195196
#else
196-
printf("Direct I/O is not supported on this platform.\n");
197+
printf(_("Direct I/O is not supported on this platform.\n"));
197198
#endif
198199
}
199200

@@ -239,10 +240,10 @@ test_sync(int writes_per_op)
239240
boolfs_warning= false;
240241

241242
if (writes_per_op==1)
242-
printf("\nCompare file sync methods using one %dkB write:\n",XLOG_BLCKSZ_K);
243+
printf(_("\nCompare file sync methods using one %dkB write:\n"),XLOG_BLCKSZ_K);
243244
else
244-
printf("\nCompare file sync methods using two %dkB writes:\n",XLOG_BLCKSZ_K);
245-
printf("(in wal_sync_method preference order, except fdatasync is Linux's default)\n");
245+
printf(_("\nCompare file sync methods using two %dkB writes:\n"),XLOG_BLCKSZ_K);
246+
printf(_("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"));
246247

247248
/*
248249
* Test open_datasync if available
@@ -253,7 +254,7 @@ test_sync(int writes_per_op)
253254
#ifdefOPEN_DATASYNC_FLAG
254255
if ((tmpfile=open(filename,O_RDWR |O_DSYNC |PG_O_DIRECT,0))==-1)
255256
{
256-
printf(NA_FORMAT,"n/a*\n");
257+
printf(NA_FORMAT,_("n/a*\n"));
257258
fs_warning= true;
258259
}
259260
else
@@ -271,7 +272,7 @@ test_sync(int writes_per_op)
271272
close(tmpfile);
272273
}
273274
#else
274-
printf(NA_FORMAT,"n/a\n");
275+
printf(NA_FORMAT,_("n/a\n"));
275276
#endif
276277

277278
/*
@@ -296,7 +297,7 @@ test_sync(int writes_per_op)
296297
STOP_TIMER;
297298
close(tmpfile);
298299
#else
299-
printf(NA_FORMAT,"n/a\n");
300+
printf(NA_FORMAT,_("n/a\n"));
300301
#endif
301302

302303
/*
@@ -344,7 +345,7 @@ test_sync(int writes_per_op)
344345
STOP_TIMER;
345346
close(tmpfile);
346347
#else
347-
printf(NA_FORMAT,"n/a\n");
348+
printf(NA_FORMAT,_("n/a\n"));
348349
#endif
349350

350351
/*
@@ -356,7 +357,7 @@ test_sync(int writes_per_op)
356357
#ifdefOPEN_SYNC_FLAG
357358
if ((tmpfile=open(filename,O_RDWR |OPEN_SYNC_FLAG |PG_O_DIRECT,0))==-1)
358359
{
359-
printf(NA_FORMAT,"n/a*\n");
360+
printf(NA_FORMAT,_("n/a*\n"));
360361
fs_warning= true;
361362
}
362363
else
@@ -381,28 +382,28 @@ test_sync(int writes_per_op)
381382
close(tmpfile);
382383
}
383384
#else
384-
printf(NA_FORMAT,"n/a\n");
385+
printf(NA_FORMAT,_("n/a\n"));
385386
#endif
386387

387388
if (fs_warning)
388389
{
389-
printf("* This file system and its mount options do not support direct\n");
390-
printf("I/O, e.g. ext4 in journaled mode.\n");
390+
printf(_("* This file system and its mount options do not support direct\n"
391+
"I/O, e.g. ext4 in journaled mode.\n"));
391392
}
392393
}
393394

394395
staticvoid
395396
test_open_syncs(void)
396397
{
397-
printf("\nCompare open_sync with different write sizes:\n");
398-
printf("(This is designed to compare the cost of writing 16kB in different write\n"
399-
"open_sync sizes.)\n");
400-
401-
test_open_sync(" 1 * 16kB open_sync write",16);
402-
test_open_sync(" 2 * 8kB open_sync writes",8);
403-
test_open_sync(" 4 * 4kB open_sync writes",4);
404-
test_open_sync(" 8 * 2kB open_sync writes",2);
405-
test_open_sync("16 * 1kB open_sync writes",1);
398+
printf(_("\nCompare open_sync with different write sizes:\n"));
399+
printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
400+
"open_sync sizes.)\n"));
401+
402+
test_open_sync(_(" 1 * 16kB open_sync write"),16);
403+
test_open_sync(_(" 2 * 8kB open_sync writes"),8);
404+
test_open_sync(_(" 4 * 4kB open_sync writes"),4);
405+
test_open_sync(_(" 8 * 2kB open_sync writes"),2);
406+
test_open_sync(_("16 * 1kB open_sync writes"),1);
406407
}
407408

408409
/*
@@ -422,7 +423,7 @@ test_open_sync(const char *msg, int writes_size)
422423

423424
#ifdefOPEN_SYNC_FLAG
424425
if ((tmpfile=open(filename,O_RDWR |OPEN_SYNC_FLAG |PG_O_DIRECT,0))==-1)
425-
printf(NA_FORMAT,"n/a*\n");
426+
printf(NA_FORMAT,_("n/a*\n"));
426427
else
427428
{
428429
START_TIMER;
@@ -439,7 +440,7 @@ test_open_sync(const char *msg, int writes_size)
439440
close(tmpfile);
440441
}
441442
#else
442-
printf(NA_FORMAT,"n/a\n");
443+
printf(NA_FORMAT,_("n/a\n"));
443444
#endif
444445
}
445446

@@ -455,9 +456,9 @@ test_file_descriptor_sync(void)
455456
* against the same file. Possibly this should be done with writethrough
456457
* on platforms which support it.
457458
*/
458-
printf("\nTest if fsync on non-write file descriptor is honored:\n");
459-
printf("(If the times are similar, fsync() can sync data written on a different\n"
460-
"descriptor.)\n");
459+
printf(_("\nTest if fsync on non-write file descriptor is honored:\n"));
460+
printf(_("(If the times are similar, fsync() can sync data written on a different\n"
461+
"descriptor.)\n"));
461462

462463
/*
463464
* first write, fsync and close, which is the normal behavior without
@@ -521,7 +522,7 @@ test_non_sync(void)
521522
/*
522523
* Test a simple write without fsync
523524
*/
524-
printf("\nNon-sync'ed %dkB writes:\n",XLOG_BLCKSZ_K);
525+
printf(_("\nNon-sync'ed %dkB writes:\n"),XLOG_BLCKSZ_K);
525526
printf(LABEL_FORMAT,"write");
526527
fflush(stdout);
527528

@@ -598,6 +599,6 @@ process_alarm(LPVOID param)
598599
staticvoid
599600
die(constchar*str)
600601
{
601-
fprintf(stderr,"%s: %s\n",str,strerror(errno));
602+
fprintf(stderr,_("%s: %s\n"),_(str),strerror(errno));
602603
exit(1);
603604
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp