|
| findMinHoleSize () |
|
void | execute (const std::vector< std::string > &remainingOptions) override |
|
| baseTest (const std::string &aName, const std::string &aDescription, const decltype(parameters)&aParameters, const decltype(options)&aOptions={}) |
|
void | ensuredWrite (int fd, const std::string &data) |
|
void | ensuredRead (int fd, std::string &data) |
|
void | Execute (const std::vector< std::string > &remainingOptions) |
|
Definition at line 537 of file fileOpsTests.cpp.
◆ findMinHoleSize()
findMinHoleSize::findMinHoleSize |
( |
| ) |
|
|
inline |
Definition at line 539 of file fileOpsTests.cpp.
540 "find minimum hole size", {
541 {
"file",
"path to file"
◆ execute()
void findMinHoleSize::execute |
( |
const std::vector< std::string > & |
remainingOptions | ) |
|
|
inlineoverridevirtual |
Implements baseTest.
Definition at line 544 of file fileOpsTests.cpp.
545 auto file = remainingOptions.at(0);
546 auto fd =
throwcall::badval(open(file.c_str(), O_CREAT | O_WRONLY, 0744), -1,
"open ", file);
549 auto testSize = statbuf.st_blksize;
550 while (testSize > 0) {
552 fd =
throwcall::badval(open(file.c_str(), O_WRONLY | O_TRUNC, 0744), -1,
"open ", file);
553 throwcall::badval(lseek(fd, testSize, SEEK_SET), -1,
"seek ", testSize,
" in ", file);
558 auto dataPos =
throwcall::badval(lseek(fd, 0, SEEK_DATA), -1,
"seek data in ", file);
559 if (dataPos != testSize) {
562 std::cout << testSize <<
" bytes hole size worked\n";
References throwcall::badval(), baseTest::content, baseTest::createdFiles, baseTest::ensuredWrite(), and throwcall::good0().
The documentation for this class was generated from the following file:
T badval(T call, t badvalue, const Args &... args)
template function to wrap system calls that return a special bad value on failure