diff options
author | Angelo Marletta <angelo.marletta@gmail.com> | 2012-06-30 05:44:13 -0700 |
---|---|---|
committer | Angelo Marletta <angelo.marletta@gmail.com> | 2012-06-30 05:44:13 -0700 |
commit | 2449f7c1c8cb4de126da03322025c770381b6af5 (patch) | |
tree | 85252d613a6c44f520350e6b9af0d5090fb47d50 /tests/process_iterator_test.c | |
parent | d7373dde5dde22945524d09e2c3f7f1a8290c6b9 (diff) | |
parent | 1d7438185d0ac55a49e9adb6f719ef28e5501e0d (diff) | |
download | cpulimit-2449f7c1c8cb4de126da03322025c770381b6af5.tar.gz |
Merge pull request #5 from opsengine/develop
Fix issue #4
Diffstat (limited to 'tests/process_iterator_test.c')
-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; } |