summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2015-02-12 17:20:09 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2015-02-12 17:20:09 +0100
commit9ae9b8caff4dd59f8cb886b22b00cad39cb20ae8 (patch)
treef441f777c8c3366cfccfcf63f8a0e527364be25b
parent86ffc46023bd8419752a7c3d286a35a84ffe6480 (diff)
parent70d6ee518de750655934f350b2502251e41c6de9 (diff)
downloadpsutil-9ae9b8caff4dd59f8cb886b22b00cad39cb20ae8.tar.gz
Merge branch 'master' into nicstats-250
-rw-r--r--Makefile6
-rw-r--r--docs/index.rst2
-rw-r--r--psutil/_psutil_sunos.c8
-rw-r--r--test/test_memory_leaks.py2
4 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index cb28b6fd..71e2e207 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ test-system: install
$(PYTHON) -m unittest -v test.test_psutil.TestSystemAPIs
test-memleaks: install
- $(PYTHON) -m unittest -v test.test_memory_leaks
+ $(PYTHON) test/test_memory_leaks.py
# Run a specific test by name; e.g. "make test-by-name disk_" will run
# all test methods containing "disk_" in their name.
@@ -54,6 +54,10 @@ test-memleaks: install
test-by-name: install
@$(PYTHON) -m nose test/test_psutil.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
+# same as above but for test_memory_leaks.py script
+test-memleaks-by-name: install
+ @$(PYTHON) -m nose test/test_memory_leaks.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
+
# requires "pip install pep8"
pep8:
@git ls-files | grep \\.py$ | xargs pep8
diff --git a/docs/index.rst b/docs/index.rst
index 781a216f..782d309c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -831,7 +831,7 @@ Process class
>>> p.io_counters()
pio(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)
- Availability: all platforms except OSX
+ Availability: all platforms except OSX and Solaris
.. method:: num_ctx_switches()
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 87d5cfd3..919f8197 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -445,8 +445,6 @@ psutil_per_cpu_times(PyObject *self, PyObject *args)
kstat_ctl_t *kc;
kstat_t *ksp;
cpu_stat_t cs;
- int numcpus;
- int i;
PyObject *py_retlist = PyList_New(0);
PyObject *py_cputime = NULL;
@@ -808,7 +806,7 @@ static PyObject *
psutil_net_connections(PyObject *self, PyObject *args)
{
long pid;
- int sd = NULL;
+ int sd = 0;
mib2_tcpConnEntry_t *tp = NULL;
mib2_udpEntry_t *ude;
#if defined(AF_INET6)
@@ -1086,7 +1084,7 @@ error:
Py_XDECREF(py_raddr);
Py_DECREF(py_retlist);
// TODO : free databuf
- if (sd != NULL)
+ if (sd != 0)
close(sd);
return NULL;
}
@@ -1135,7 +1133,7 @@ psutil_cpu_count_phys(PyObject *self, PyObject *args)
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
if (strcmp(ksp->ks_module, "cpu_info") != 0)
continue;
- if (kstat_read(kc, ksp, NULL) == NULL)
+ if (kstat_read(kc, ksp, NULL) == -1)
goto error;
ncpus += 1;
}
diff --git a/test/test_memory_leaks.py b/test/test_memory_leaks.py
index 98fce8b0..5a31ac1f 100644
--- a/test/test_memory_leaks.py
+++ b/test/test_memory_leaks.py
@@ -168,7 +168,7 @@ class TestProcessObjectLeaks(Base):
self.execute('ionice', psutil.IOPRIO_CLASS_NONE)
self.execute_w_exc(OSError, 'ionice', -1)
- @unittest.skipIf(OSX, "feature not supported on this platform")
+ @unittest.skipIf(OSX or SUNOS, "feature not supported on this platform")
@skip_if_linux()
def test_io_counters(self):
self.execute('io_counters')