bool TestExtFile::test_unlink() { f_touch("test/test_ext_file.tmp"); VERIFY(f_file_exists("test/test_ext_file.tmp")); f_unlink("test/test_ext_file.tmp"); VERIFY(!f_file_exists("test/test_ext_file.tmp")); return Count(true); }
bool TestExtFile::test_linkinfo() { if (f_file_exists("test/test_ext_file2.tmp")) { f_unlink("test/test_ext_file2.tmp"); VERIFY(!f_file_exists("test/test_ext_file2.tmp")); } f_touch("test/test_ext_file.tmp"); f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); VERIFY(more(f_linkinfo("test/test_ext_file2.tmp"), 0)); return Count(true); }
bool TestExtFile::test_readlink() { if (f_file_exists("test/test_ext_file2.tmp")) { f_unlink("test/test_ext_file2.tmp"); VERIFY(!f_file_exists("test/test_ext_file2.tmp")); } f_touch("test/test_ext_file.tmp"); f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); String resolved = f_readlink("test/test_ext_file2.tmp"); VS(resolved.substr(resolved.size() - 22), "test/test_ext_file.tmp"); return Count(true); }
bool TestExtFile::test_rename() { if (f_file_exists("test/ext/test_ext_file2.tmp")) { f_unlink("test/ext/test_ext_file2.tmp"); VERIFY(!f_file_exists("test/ext/test_ext_file2.tmp")); } f_touch("test/ext/test_ext_file.tmp"); f_rename("test/ext/test_ext_file.tmp", "test/ext/test_ext_file2.tmp"); VERIFY(f_file_exists("test/ext/test_ext_file2.tmp")); VERIFY(!f_file_exists("test/ext/test_ext_file.tmp")); return Count(true); }
static Resource libxml_streams_IO_open_wrapper( const char *filename, const char* mode, bool read_only) { ITRACE(1, "libxml_open_wrapper({}, {}, {})\n", filename, mode, read_only); Trace::Indent _i; String strFilename = StringData::Make(filename, CopyString); /* FIXME: PHP calls stat() here if the wrapper has a non-null stat handler, * in order to skip the open of a missing file, thus suppressing warnings. * Our stat handlers are virtual, so there's no easy way to tell if stat * is supported, so instead we will just call stat() for plain files, since * of the default transports, only plain files have support for stat(). */ if (read_only) { int pathIndex = 0; Stream::Wrapper * wrapper = Stream::getWrapperFromURI(strFilename, &pathIndex); if (dynamic_cast<FileStreamWrapper*>(wrapper)) { if (!f_file_exists(strFilename)) { return Resource(); } } } // PHP unescapes the URI here, but that should properly be done by the // wrapper. The wrapper should expect a valid URI, e.g. file:///foo%20bar return File::Open(strFilename, mode, 0, tl_libxml_request_data->m_streams_context); }
bool TestExtFile::test_copy() { if (f_file_exists("test/test_ext_file2.tmp")) { f_unlink("test/test_ext_file2.tmp"); VERIFY(!f_file_exists("test/test_ext_file2.tmp")); } if (f_file_exists("test/test_ext_file3.tmp")) { f_unlink("test/test_ext_file3.tmp"); VERIFY(!f_file_exists("test/test_ext_file3.tmp")); } f_touch("test/test_ext_file.tmp"); f_copy("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); VERIFY(f_file_exists("test/test_ext_file2.tmp")); VERIFY(f_file_exists("test/test_ext_file.tmp")); // XXX disabled until we work out flaky network issues. t2183444 #if 0 f_copy("http://facebook.com", "test/test_ext_file3.tmp"); VERIFY(f_file_exists("test/test_ext_file3.tmp")); #endif return Count(true); }
bool TestExtFile::test_file_exists() { VERIFY(f_file_exists("test/test_ext_file.txt")); VERIFY(!f_file_exists("")); return Count(true); }