// Name: tests/archive/archive.cpp
// Purpose: Test the archive classes
// Author: Mike Wetherell
// Name: tests/archive/archive.cpp
// Purpose: Test the archive classes
// Author: Mike Wetherell
// Copyright: (c) 2004 Mike Wetherell
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// Copyright: (c) 2004 Mike Wetherell
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
wxFileName fn(i->first, wxPATH_UNIX);
TestEntry& entry = *i->second;
wxDateTime dt = entry.GetDateTime();
wxFileName fn(i->first, wxPATH_UNIX);
TestEntry& entry = *i->second;
wxDateTime dt = entry.GetDateTime();
wxString tmparc = fn.GetPath(wxPATH_GET_SEPARATOR) + fn.GetFullName();
// call the archiver to create an archive file
wxString tmparc = fn.GetPath(wxPATH_GET_SEPARATOR) + fn.GetFullName();
// call the archiver to create an archive file
- system(wxString::Format(archiver, tmparc.c_str()).mb_str());
+ if ( system(wxString::Format(archiver, tmparc.c_str()).mb_str()) == -1 )
+ {
+ wxLogError("Failed to run acrhiver command \"%s\"", archiver);
+ }
// for the non-seekable test, have the archiver output to "-"
// and read the archive via a pipe
PFileInputStream in(wxString::Format(archiver, wxT("-")));
// for the non-seekable test, have the archiver output to "-"
// and read the archive via a pipe
PFileInputStream in(wxString::Format(archiver, wxT("-")));
// On Windows some archivers compensate for Windows DST handling, but
// other don't, so disable the test for now.
wxDateTime dt = testEntry.GetDateTime();
// On Windows some archivers compensate for Windows DST handling, but
// other don't, so disable the test for now.
wxDateTime dt = testEntry.GetDateTime();
- system(wxString::Format(unarchiver, tmparc.c_str()).mb_str());
+ if ( system(wxString::Format(unarchiver, tmparc.c_str()).mb_str()) == -1 )
+ {
+ wxLogError("Failed to run unarchiver command \"%s\"", unarchiver);
+ }
+
wxRemoveFile(tmparc);
}
else {
// for the non-seekable test, have the archiver extract "-" and
// feed it the archive via a pipe
PFileOutputStream out(wxString::Format(unarchiver, wxT("-")));
wxRemoveFile(tmparc);
}
else {
// for the non-seekable test, have the archiver extract "-" and
// feed it the archive via a pipe
PFileOutputStream out(wxString::Format(unarchiver, wxT("-")));
CPPUNIT_ASSERT_MESSAGE("timestamp check" + error_context,
testEntry.GetDateTime() ==
wxFileName(path).GetModificationTime());
CPPUNIT_ASSERT_MESSAGE("timestamp check" + error_context,
testEntry.GetDateTime() ==
wxFileName(path).GetModificationTime());
- descr << wxT(" (") << wxString::Format(archiver, fn) << wxT(")");
+ const wxString cmd = archiver.Contains("%s")
+ ? wxString::Format(archiver, fn)
+ : archiver;
+ descr << wxT(" (") << cmd << wxT(")");
- descr << wxT(" (") << wxString::Format(unarchiver, fn) << wxT(")");
+ const wxString cmd = unarchiver.Contains("%s")
+ ? wxString::Format(unarchiver, fn)
+ : unarchiver;
+ descr << wxT(" (") << cmd << wxT(")");