36#ifndef _OS_TEMPFILE_HXX_
37#define _OS_TEMPFILE_HXX_
61 LOG(
WARNING,
"Error deleting temporary directory %s: %s",
73 const string&
name()
const {
98 const string&
name()
const {
124 while (ofs < s.size()) {
125 int ret =
::write(
fd_, s.data() + ofs, s.size() - ofs);
This class creates a temporary directory for the test, and removes it when the test is done.
const string & name() const
string dirName_
name of the temporary directory.
static TempDir * instance()
This class creates a temporary file for the test, and removes it when the test is done.
string fileName_
The full path name.
int fd_
The file descriptor.
void rewrite(const string &s)
writes the given data to the temporary file from offset 0.
void write(const uint8_t byte)
writes a single byte to the temporary file.
void write(const string &s)
writes the given data to the temporary file.
const string & name() const
#define LOG(level, message...)
Conditionally write a message to the logging output.
static const int WARNING
Loglevel that is always printed, reporting a warning or a retryable error.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.