aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Sigurdhsson <Sigurdhsson@gmail.com>2012-07-04 16:28:32 +0200
committerSimon Sigurdhsson <Sigurdhsson@gmail.com>2012-07-04 16:28:32 +0200
commitb60ce48914d78cd827c88f29c863e3527ecff1f2 (patch)
treeb522f7f48236e44643dfc05519d847a914dd863b /tests
parent223bbb82c94a9f21afbb79ea3e6eb5800d87b03d (diff)
downloadcpulimit-b60ce48914d78cd827c88f29c863e3527ecff1f2.tar.gz
Fixed errors, OSX build now passes all tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/process_iterator_test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/process_iterator_test.c b/tests/process_iterator_test.c
index 3d5e885..20ef479 100644
--- a/tests/process_iterator_test.c
+++ b/tests/process_iterator_test.c
@@ -28,6 +28,10 @@
#include <signal.h>
#include <string.h>
+#ifdef __APPLE__
+#include <libgen.h>
+#endif
+
#include <process_iterator.h>
#include <process_group.h>
@@ -198,7 +202,13 @@ void test_process_name(const char * command)
assert(get_next_process(&it, &process) == 0);
assert(process.pid == getpid());
assert(process.ppid == getppid());
+ #ifdef __APPLE__
+ // proc_pidinfo only gives us the first 15 chars
+ // of the basename of the command on OSX.
+ assert(strncmp(basename((char*)command), process.command, 15) == 0);
+ #else
assert(strncmp(command, process.command, strlen(process.command)) == 0);
+ #endif
assert(get_next_process(&it, &process) != 0);
close_process_iterator(&it);
}
Un proyecto texto-plano.xyz