From 42e7937bca11811bec147552929477ae330d5994 Mon Sep 17 00:00:00 2001 From: pithikos Date: Fri, 16 Jan 2015 18:21:34 +0000 Subject: [PATCH] Refactored tests --- tests/ext_bugs/memleak.c | 3 +-- tests/memleaks | 1 + tests/src/conc_increment.c | 13 ++++++------- tests/src/no_work.c | 9 ++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/ext_bugs/memleak.c b/tests/ext_bugs/memleak.c index 7e26329..d51b72a 100644 --- a/tests/ext_bugs/memleak.c +++ b/tests/ext_bugs/memleak.c @@ -6,7 +6,7 @@ #include /* This showcasts this issue: https://sourceware.org/ml/glibc-bugs/2007-04/msg00036.html */ -/* Alsoe here: http://stackoverflow.com/questions/27803819/pthreads-leak-memory-even-if-used-correctly/27804629 */ +/* Also here: http://stackoverflow.com/questions/27803819/pthreads-leak-memory-even-if-used-correctly/27804629 */ volatile int threads_keepalive = 1; @@ -14,7 +14,6 @@ void* thread_do(void *arg){ while(threads_keepalive) sleep(1); pthread_exit(NULL); - return; } int main(void){ diff --git a/tests/memleaks b/tests/memleaks index b93b9fe..f4584a0 100755 --- a/tests/memleaks +++ b/tests/memleaks @@ -60,5 +60,6 @@ test_thread_free 1 test_thread_free 20 test_thread_free_multi 4 20 test_thread_free_multi 3 1000 +test_thread_free_multi 100 100 echo "No memory leaks" diff --git a/tests/src/conc_increment.c b/tests/src/conc_increment.c index 5510acb..4c868c4 100644 --- a/tests/src/conc_increment.c +++ b/tests/src/conc_increment.c @@ -22,18 +22,17 @@ int main(int argc, char *argv[]){ puts("This testfile needs excactly two arguments"); exit(1); } - int jobs = strtol(argv[1], &p, 10); - int threads = strtol(argv[2], &p, 10); + int num_jobs = strtol(argv[1], &p, 10); + int num_threads = strtol(argv[2], &p, 10); - thpool_t* thpool; - thpool = thpool_init(threads); + thpool threadpool = thpool_init(num_threads); int n; - for (n=0; n