diff options
author | Angelo Marletta <angelo.marletta@gmail.com> | 2012-06-29 22:22:20 +0100 |
---|---|---|
committer | Angelo Marletta <angelo.marletta@gmail.com> | 2012-06-29 22:22:20 +0100 |
commit | b8f9bdd32fe0c85c3472298bc704cdc31580f189 (patch) | |
tree | 0e5464a4cdc1fc383616c1ea2e02162797dd029e /tests | |
parent | 600c781a137eb122c5799d87bf814b1c9d439ab1 (diff) | |
download | cpulimit-b8f9bdd32fe0c85c3472298bc704cdc31580f189.tar.gz |
fixed bug in linux iterator. added test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/process_iterator_test.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/process_iterator_test.c b/tests/process_iterator_test.c index 7b1c6b5..3d5e885 100644 --- a/tests/process_iterator_test.c +++ b/tests/process_iterator_test.c @@ -203,6 +203,20 @@ void test_process_name(const char * command) close_process_iterator(&it); } +void test_process_group_wrong_pid() +{ + struct process_group pgroup; + assert(init_process_group(&pgroup, -1, 0) == 0); + assert(pgroup.proclist->count == 0); + update_process_group(&pgroup); + assert(pgroup.proclist->count == 0); + assert(init_process_group(&pgroup, 9999999, 0) == 0); + assert(pgroup.proclist->count == 0); + update_process_group(&pgroup); + assert(pgroup.proclist->count == 0); + assert(close_process_group(&pgroup) == 0); +} + int main(int argc, char **argv) { // printf("Pid %d\n", getpid()); @@ -212,6 +226,7 @@ int main(int argc, char **argv) test_process_group_all(); test_process_group_single(0); test_process_group_single(1); + test_process_group_wrong_pid(); test_process_name(argv[0]); return 0; } |