Fix unittests
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 8 Nov 2016 09:02:06 +0000 (10:02 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 8 Nov 2016 09:02:06 +0000 (10:02 +0100)
test/stringfunc.cpp
test/test_filefunc.cpp

index 49e44e0..fe50d4c 100644 (file)
@@ -35,6 +35,7 @@ on this file might be covered by the GNU General Public License.
 #include <stringfunc.hxx>
 #include <containerfunc.hpp>
 #include <iostream>
+#include <stdint.h>
 
 using namespace std;
 using namespace I2n;
index 1a51769..1fb51f8 100644 (file)
@@ -600,7 +600,7 @@ BOOST_AUTO_TEST_CASE(FreeDiskSpace1)
     int retries = 5;
     while (retries > 0)
     {
-        string dfstr=capture_exec("df -B 1 /tmp | tail -n 1 | sed -e \"s/[^ ]* *[^ ]* [^ ]* *\\([^ ]*\\).*/\\1/\"");
+        string dfstr=capture_exec("df -P -B 1 /tmp | tail -n 1 | sed \"s/ \\+/\\\\n/g\" | sed -n 4,4p");
 
         dfout=-1;
         string_to<long long>(dfstr,dfout);
@@ -663,6 +663,11 @@ BOOST_AUTO_TEST_CASE(TestDu)
     // Unlink it
     BOOST_CHECK_EQUAL(true, I2n::recursive_delete(unique_dir));
     BOOST_CHECK_EQUAL(false, Stat(unique_dir).is_directory());
+
+    // remove links
+    unlink("hardlink1");
+    unlink("hardlink2");
+    unlink("hardlink3");
 }