Introduce 'test' target, add /proc/net/tcp parsing to it

The test itself doesn't do much yet, but might shed some light on what's going
on in https://github.com/raboof/nethogs/issues/22
This commit is contained in:
Arnout Engelen
2016-03-27 21:33:10 +02:00
parent c266593ab7
commit 240307d1fe
6 changed files with 48091 additions and 12 deletions

28
conninode_test.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include "conninode.cpp"
local_addr *local_addrs = NULL;
int main() {
if (!addprocinfo("testfiles/proc_net_tcp")) {
std::cerr << "Failed to load testfiles/proc_net_tcp" << std::endl;
return 1;
}
if (!addprocinfo("testfiles/proc_net_tcp_big")) {
std::cerr << "Failed to load testfiles/proc_net_tcp_big" << std::endl;
return 2;
}
#if defined(__APPLE__)
if (!addprocinfo("net.inet.tcp.pcblist")) {
std::cerr << "Failed to load net.inet.tcp.pcblist" << std::endl;
return 3;
}
#else
if (!addprocinfo("/proc/net/tcp")) {
std::cerr << "Failed to load /proc/net/tcp" << std::endl;
return 4;
}
#endif
return 0;
}