Fixes to HTTP repo tests on Windows.
Large alloca fails, and SGFIle dtor doesn't close the handle, which breaks _wunlink on Windows :(
This commit is contained in:
parent
0e9e5f77cc
commit
3dfce43de2
@ -749,6 +749,10 @@ HTTPRepository::failure() const
|
||||
code = HTTPRepository::REPO_ERROR_CANCELLED;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
file->close();
|
||||
}
|
||||
|
||||
file.reset();
|
||||
if (pathInRepo.exists()) {
|
||||
pathInRepo.remove();
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
SGFile( int existingFd );
|
||||
|
||||
/** Destructor */
|
||||
~SGFile();
|
||||
virtual ~SGFile();
|
||||
|
||||
// open the file based on specified direction
|
||||
bool open( const SGProtocolDir dir );
|
||||
|
@ -309,7 +309,8 @@ std::string test_computeHashForPath(const SGPath& p)
|
||||
return std::string();
|
||||
sha1nfo info;
|
||||
sha1_init(&info);
|
||||
char* buf = static_cast<char*>(alloca(1024 * 1024));
|
||||
char* buf = static_cast<char*>(malloc(1024 * 1024));
|
||||
assert(buf);
|
||||
size_t readLen;
|
||||
|
||||
SGBinaryFile f(p);
|
||||
@ -319,6 +320,9 @@ std::string test_computeHashForPath(const SGPath& p)
|
||||
sha1_write(&info, buf, readLen);
|
||||
}
|
||||
|
||||
f.close();
|
||||
free(buf);
|
||||
|
||||
std::string hashBytes((char*) sha1_result(&info), HASH_LENGTH);
|
||||
return strutils::encodeHex(hashBytes);
|
||||
}
|
||||
@ -725,7 +729,7 @@ void testCopyInstalledChildren(HTTP::Client* cl)
|
||||
verifyRequestCount("dirJ/fileJC", 1);
|
||||
verifyRequestCount("dirJ/fileJD", 1);
|
||||
|
||||
std::cout << "Copy installed children" << std::endl;
|
||||
std::cout << "passed Copy installed children" << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
Loading…
Reference in New Issue
Block a user