|
| uglyPaths () |
|
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 848 of file fileOpsTests.cpp.
◆ uglyPaths()
Definition at line 850 of file fileOpsTests.cpp.
851 "write files in paths with ugly names", {
852 {
"dir",
"directory to create the paths in"
◆ execute()
void uglyPaths::execute |
( |
const std::vector< std::string > & |
remainingOptions | ) |
|
|
inlineoverridevirtual |
Implements baseTest.
Definition at line 855 of file fileOpsTests.cpp.
856 auto dir = remainingOptions.at(0);
857 auto dirfd =
throwcall::badval(open(dir.c_str(),O_PATH | O_DIRECTORY),-1,
"can't open ",dir);
858 std::list<std::string> names{
"path with spaces",
859 "path\nwith\nnewlines",
860 "path\rwith\rreturns",
861 "path\r\nwith\r\nCRLF",
862 "path_with_\033[91mred\033[0m_part",
863 "path_with_\xe2\x80\xadleft-to-right\xe2\x80\x8e_part",
864 "path_with_\xe2\x82\xac_euro",
865 "path_with_ɄɳɨȻʘΔε_unicode",
866 "path_with_🤔💩☢_emojis",
867 "path_with_䭫顙_more_unicode"
870 auto nameMax =
throwcall::badval(fpathconf(dirfd,_PC_NAME_MAX),-1,
"can't get max name length");
871 auto ugly = std::to_string(nameMax);
872 ugly.resize(nameMax,
'b');
873 names.push_back(ugly);
876 for (
const auto& ugly: names) {
877 auto retval = mkdirat(dirfd,ugly.c_str(), 0777);
878 if (retval == -1 && errno == EINVAL) {
879 std::cerr <<
"illegal dir name \" << ugly << \" tried \n";
884 std::string file(ugly);
886 auto fd =
throwcall::badval(openat(dirfd, file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0744),
References throwcall::badval(), 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