| 237 | } |
| 238 | |
| 239 | static void |
| 240 | test_open(void) |
| 241 | { |
| 242 | int tmpfile; |
| 243 | |
| 244 | /* |
| 245 | * test if we can open the target file |
| 246 | */ |
| 247 | if ((tmpfile = open(filename, O_RDWR | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR)) == -1) |
| 248 | die("could not open output file"); |
| 249 | needs_unlink = 1; |
| 250 | if (write(tmpfile, full_buf, DEFAULT_XLOG_SEG_SIZE) != |
| 251 | DEFAULT_XLOG_SEG_SIZE) |
| 252 | die("write failed"); |
| 253 | |
| 254 | /* fsync now so that dirty buffers don't skew later tests */ |
| 255 | if (fsync(tmpfile) != 0) |
| 256 | die("fsync failed"); |
| 257 | |
| 258 | close(tmpfile); |
| 259 | } |
| 260 | |
| 261 | static void |
| 262 | test_sync(int writes_per_op) |