* Test open_sync with different size files */
| 442 | * Test open_sync with different size files |
| 443 | */ |
| 444 | static void |
| 445 | test_open_sync(const char *msg, int writes_size) |
| 446 | { |
| 447 | #ifdef OPEN_SYNC_FLAG |
| 448 | int tmpfile, |
| 449 | ops, |
| 450 | writes; |
| 451 | #endif |
| 452 | |
| 453 | printf(LABEL_FORMAT, msg); |
| 454 | fflush(stdout); |
| 455 | |
| 456 | #ifdef OPEN_SYNC_FLAG |
| 457 | if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT | PG_BINARY, 0)) == -1) |
| 458 | printf(NA_FORMAT, _("n/a*")); |
| 459 | else |
| 460 | { |
| 461 | START_TIMER; |
| 462 | for (ops = 0; alarm_triggered == false; ops++) |
| 463 | { |
| 464 | for (writes = 0; writes < 16 / writes_size; writes++) |
| 465 | if (pg_pwrite(tmpfile, |
| 466 | buf, |
| 467 | writes_size * 1024, |
| 468 | writes * writes_size * 1024) != |
| 469 | writes_size * 1024) |
| 470 | die("write failed"); |
| 471 | } |
| 472 | STOP_TIMER; |
| 473 | close(tmpfile); |
| 474 | } |
| 475 | #else |
| 476 | printf(NA_FORMAT, _("n/a")); |
| 477 | #endif |
| 478 | } |
| 479 | |
| 480 | static void |
| 481 | test_file_descriptor_sync(void) |
no test coverage detected