more testing

This commit is contained in:
Doug MacEachern 2004-07-06 00:15:39 +00:00
parent 992f277423
commit 6cc0af0968
1 changed files with 26 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.util.List; import java.util.List;
import net.hyperic.sigar.Sigar; import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
public class TestProcModules extends SigarTestCase { public class TestProcModules extends SigarTestCase {
@ -12,13 +13,11 @@ public class TestProcModules extends SigarTestCase {
super(name); super(name);
} }
public void testCreate() throws Exception { private void printModules(Sigar sigar, long pid) throws SigarException {
Sigar sigar = new Sigar(); traceln("\npid=" + pid);
traceln("");
try { try {
List modules = sigar.getProcModules(sigar.getPid()); List modules = sigar.getProcModules(pid);
for (int i=0; i<modules.size(); i++) { for (int i=0; i<modules.size(); i++) {
traceln(i + "=" + modules.get(i)); traceln(i + "=" + modules.get(i));
@ -27,4 +26,26 @@ public class TestProcModules extends SigarTestCase {
//ok //ok
} }
} }
public void testCreate() throws Exception {
Sigar sigar = new Sigar();
traceln("");
try {
printModules(sigar, sigar.getPid());
} catch (SigarNotImplementedException e) {
return;
}
long[] pids = sigar.getProcList();
for (int i=0; i<pids.length; i++) {
try {
printModules(sigar, pids[i]);
} catch (SigarException e) {
traceln(pids[i] + ": " + e.getMessage());
}
}
}
} }