MCPcopy Create free account
hub / github.com/apache/cloudberry / test_open

Function test_open

src/bin/pg_test_fsync/pg_test_fsync.c:239–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239static void
240test_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
261static void
262test_sync(int writes_per_op)

Callers 1

mainFunction · 0.85

Calls 1

dieFunction · 0.85

Tested by

no test coverage detected