Skip to content

Commit 558c436

Browse files
committed
Update error message and documentation for fsync test.
1 parent 46117e4 commit 558c436

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/tools/fsync/README

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ This program tests fsync. The tests are described as part of the program output
22

33
Usage: test_fsync [-f filename] [loops]
44

5-
Loops defaults to 1000.
5+
Loops defaults to 1000. The default output file is /var/tmp/test_fsync.out.
6+
Consider that /tmp or /var/tmp might be memory-based file systems.

src/tools/fsync/test_fsync.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ main(int argc, char *argv[])
5959
strout[i] = 'a';
6060

6161
if ((tmpfile = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) == -1)
62-
die("can't open /var/tmp/test_fsync.out");
62+
die("Cannot open output file.");
6363
write(tmpfile, strout, WAL_FILE_SIZE);
6464
fsync(tmpfile); /* fsync so later fsync's don't have to do it */
6565
close(tmpfile);
@@ -70,7 +70,7 @@ main(int argc, char *argv[])
7070
for (i = 0; i < loops; i++)
7171
{
7272
if ((tmpfile = open(filename, O_RDWR)) == -1)
73-
die("can't open /var/tmp/test_fsync.out");
73+
die("Cannot open output file.");
7474
write(tmpfile, strout, 8192);
7575
close(tmpfile);
7676
}
@@ -87,12 +87,12 @@ main(int argc, char *argv[])
8787
for (i = 0; i < loops; i++)
8888
{
8989
if ((tmpfile = open(filename, O_RDWR)) == -1)
90-
die("can't open /var/tmp/test_fsync.out");
90+
die("Cannot open output file.");
9191
write(tmpfile, strout, 8192);
9292
fsync(tmpfile);
9393
close(tmpfile);
9494
if ((tmpfile = open(filename, O_RDWR)) == -1)
95-
die("can't open /var/tmp/test_fsync.out");
95+
die("Cannot open output file.");
9696
/* do nothing but the open/close the tests are consistent. */
9797
close(tmpfile);
9898
}
@@ -106,12 +106,12 @@ main(int argc, char *argv[])
106106
for (i = 0; i < loops; i++)
107107
{
108108
if ((tmpfile = open(filename, O_RDWR)) == -1)
109-
die("can't open /var/tmp/test_fsync.out");
109+
die("Cannot open output file.");
110110
write(tmpfile, strout, 8192);
111111
close(tmpfile);
112112
/* reopen file */
113113
if ((tmpfile = open(filename, O_RDWR)) == -1)
114-
die("can't open /var/tmp/test_fsync.out");
114+
die("Cannot open output file.");
115115
fsync(tmpfile);
116116
close(tmpfile);
117117
}
@@ -124,7 +124,7 @@ main(int argc, char *argv[])
124124

125125
/* 16k o_sync write */
126126
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
127-
die("can't open /var/tmp/test_fsync.out");
127+
die("Cannot open output file.");
128128
gettimeofday(&start_t, NULL);
129129
for (i = 0; i < loops; i++)
130130
write(tmpfile, strout, 16384);
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
136136

137137
/* 2*8k o_sync writes */
138138
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
139-
die("can't open /var/tmp/test_fsync.out");
139+
die("Cannot open output file.");
140140
gettimeofday(&start_t, NULL);
141141
for (i = 0; i < loops; i++)
142142
{
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
154154
#ifdef OPEN_DATASYNC_FLAG
155155
/* open_dsync, write */
156156
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
157-
die("can't open /var/tmp/test_fsync.out");
157+
die("Cannot open output file.");
158158
gettimeofday(&start_t, NULL);
159159
for (i = 0; i < loops; i++)
160160
write(tmpfile, strout, 8192);
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
169169

170170
/* open_fsync, write */
171171
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
172-
die("can't open /var/tmp/test_fsync.out");
172+
die("Cannot open output file.");
173173
gettimeofday(&start_t, NULL);
174174
for (i = 0; i < loops; i++)
175175
write(tmpfile, strout, 8192);
@@ -182,7 +182,7 @@ main(int argc, char *argv[])
182182
#ifdef HAVE_FDATASYNC
183183
/* write, fdatasync */
184184
if ((tmpfile = open(filename, O_RDWR)) == -1)
185-
die("can't open /var/tmp/test_fsync.out");
185+
die("Cannot open output file.");
186186
gettimeofday(&start_t, NULL);
187187
for (i = 0; i < loops; i++)
188188
{
@@ -200,7 +200,7 @@ main(int argc, char *argv[])
200200

201201
/* write, fsync, close */
202202
if ((tmpfile = open(filename, O_RDWR)) == -1)
203-
die("can't open /var/tmp/test_fsync.out");
203+
die("Cannot open output file.");
204204
gettimeofday(&start_t, NULL);
205205
for (i = 0; i < loops; i++)
206206
{
@@ -218,7 +218,7 @@ main(int argc, char *argv[])
218218
#ifdef OPEN_DATASYNC_FLAG
219219
/* open_dsync, write */
220220
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
221-
die("can't open /var/tmp/test_fsync.out");
221+
die("Cannot open output file.");
222222
gettimeofday(&start_t, NULL);
223223
for (i = 0; i < loops; i++)
224224
{
@@ -236,7 +236,7 @@ main(int argc, char *argv[])
236236

237237
/* open_fsync, write */
238238
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
239-
die("can't open /var/tmp/test_fsync.out");
239+
die("Cannot open output file.");
240240
gettimeofday(&start_t, NULL);
241241
for (i = 0; i < loops; i++)
242242
{
@@ -252,7 +252,7 @@ main(int argc, char *argv[])
252252
#ifdef HAVE_FDATASYNC
253253
/* write, fdatasync */
254254
if ((tmpfile = open(filename, O_RDWR)) == -1)
255-
die("can't open /var/tmp/test_fsync.out");
255+
die("Cannot open output file.");
256256
gettimeofday(&start_t, NULL);
257257
for (i = 0; i < loops; i++)
258258
{
@@ -271,7 +271,7 @@ main(int argc, char *argv[])
271271

272272
/* write, fsync, close */
273273
if ((tmpfile = open(filename, O_RDWR)) == -1)
274-
die("can't open /var/tmp/test_fsync.out");
274+
die("Cannot open output file.");
275275
gettimeofday(&start_t, NULL);
276276
for (i = 0; i < loops; i++)
277277
{
@@ -306,6 +306,6 @@ print_elapse(struct timeval start_t, struct timeval elapse_t)
306306
void
307307
die(char *str)
308308
{
309-
fprintf(stderr, "%s", str);
309+
fprintf(stderr, "%s\n", str);
310310
exit(1);
311311
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy