36#ifndef _POSIX_C_SOURCE
37#define _POSIX_C_SOURCE 200112L
45openlcb::MockSNIPUserFile::MockSNIPUserFile(
const char *user_name,
46 const char *user_description)
48 , userFile_(MockSNIPUserFile::snip_user_file_path, &snipData_, false)
51 str_populate(snipData_.user_description, user_description);
54openlcb::MockSNIPUserFile::~MockSNIPUserFile()
58#elif !defined(__WINNT__)
61openlcb::MockSNIPUserFile::MockSNIPUserFile(
const char *user_name,
62 const char *user_description)
63 : userFile_(*
TempDir::instance(),
"snip_user_file")
66 HASSERT(userFile_.name().size() <
sizeof(snip_user_file_path));
67 str_populate(snip_user_file_path, userFile_.name().c_str());
70char openlcb::MockSNIPUserFile::snip_user_file_path[128] =
"/dev/zero";
72openlcb::MockSNIPUserFile::~MockSNIPUserFile()
This class creates a temporary directory for the test, and removes it when the test is done.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
void init_snip_user_file(int fd, const char *user_name, const char *user_description)
Helper function for test nodes.