diff --git a/bindings/java/src/net/hyperic/sigar/test/TestProcArgs.java b/bindings/java/src/net/hyperic/sigar/test/TestProcArgs.java index cee57fd8..ee774d3f 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestProcArgs.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestProcArgs.java @@ -51,5 +51,18 @@ public class TestProcArgs extends SigarTestCase { } catch (SigarNotImplementedException e) { //ok; might not happen on win32 } + + long[] pids = sigar.getProcList(); + + for (int i=0; i" + args[j] + "<=="); + } + } catch (SigarException e) { + } + } } } diff --git a/bindings/java/src/net/hyperic/sigar/test/TestProcExe.java b/bindings/java/src/net/hyperic/sigar/test/TestProcExe.java index 65e7ef85..5749249e 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestProcExe.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestProcExe.java @@ -13,6 +13,26 @@ public class TestProcExe extends SigarTestCase { super(name); } + private void printExe(Sigar sigar, long pid) throws SigarException { + traceln("\npid=" + pid); + + try { + ProcExe exe = sigar.getProcExe(pid); + + String cwd = exe.getCwd(); + traceln("cwd='" + cwd + "'"); + + //assertTrue(new File(cwd).isDirectory()); + + File exeFile = new File(exe.getName()); + traceln("exe='" + exe.getName() + "'"); + + //assertTrue(exeFile.exists()); + } catch (SigarNotImplementedException e) { + //ok + } + } + public void testCreate() throws Exception { Sigar sigar = getSigar(); @@ -25,22 +45,30 @@ public class TestProcExe extends SigarTestCase { ProcExe exe = sigar.getProcExe(sigar.getPid()); File exeFile = new File(exe.getName()); + String cwd = exe.getCwd(); + traceln("cwd='" + cwd + "'"); + + assertTrue(new File(cwd).isDirectory()); + traceln("exe='" + exe.getName() + "'"); assertTrue(exeFile.exists()); //win32 has .exe assertTrue(exeFile.getName().startsWith("java")); - - String cwd = exe.getCwd(); - traceln("cwd='" + cwd + "'"); - - //XXX win32 as exe but not cwd - if (cwd.length() != 0) { - assertTrue(new File(cwd).isDirectory()); - } } catch (SigarNotImplementedException e) { //ok } + + long[] pids = sigar.getProcList(); + + //go through all just to make sure no crashes + for (int i=0; i