]> git.saurik.com Git - wxWidgets.git/commitdiff
Check the return value of system() and pipe() in the test suite.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2012 14:49:13 +0000 (14:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2012 14:49:13 +0000 (14:49 +0000)
This is mainly to avoid -Wunused-result warnings under recent Linux systems
but also could give valuable information if the call does fail.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/archive/archivetest.cpp
tests/filekind/filekind.cpp

index d6ac25692b4be8f5b94510dee9986becc8977c9d..7e8262d0f8e878d32a2b2efc3899122e8a00ed62 100644 (file)
@@ -672,7 +672,10 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
         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);
+        }
 
         // then load the archive file
         {
@@ -895,7 +898,11 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in,
         }
 
         // call unarchiver
-        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 {
index a7d81f81a45a6efbc5c33cdd807c01ec9255b39b..c948050d393e43f96bd73eeea5ce1cda0cb56aa1 100644 (file)
@@ -127,11 +127,13 @@ void FileKindTestCase::File()
 void FileKindTestCase::Pipe()
 {
     int afd[2];
+    int rc;
 #ifdef __UNIX__
-    pipe(afd);
+    rc = pipe(afd);
 #else
-    _pipe(afd, 256, O_BINARY);
+    rc = _pipe(afd, 256, O_BINARY);
 #endif
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to create pipe", 0, rc);
 
     wxFile file0(afd[0]);
     wxFile file1(afd[1]);