summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/libcgrouptest.h2
-rw-r--r--tests/test_functions.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/tests/libcgrouptest.h b/tests/libcgrouptest.h
index 36edc26..00765bd 100644
--- a/tests/libcgrouptest.h
+++ b/tests/libcgrouptest.h
@@ -138,7 +138,7 @@ struct cgroup *new_cgroup(char *group, char *controller_name,
char *control_file, int value_type, struct cntl_val_t cval,
struct uid_gid_t ids, int i);
int check_fsmounted(int multimnt);
-int check_task(char *tasksfile);
+int check_task(char *tasksfile, pid_t pid);
/* function to print messages in better format */
void message(int num, int pass, const char *api,
int ret, char *extra);
diff --git a/tests/test_functions.c b/tests/test_functions.c
index 4b8bcbb..fcdd308 100644
--- a/tests/test_functions.c
+++ b/tests/test_functions.c
@@ -96,12 +96,12 @@ void test_cgroup_attach_task(int retcode, struct cgroup *cgrp,
build_path(tasksfile, mountpoint,
group1, "tasks");
- if (check_task(tasksfile)) {
+ if (check_task(tasksfile, 0)) {
if (fs_mounted == 2) {
/* multiple mounts */
build_path(tasksfile2, mountpoint2,
group2, "tasks");
- if (check_task(tasksfile2)) {
+ if (check_task(tasksfile2, 0)) {
message(i, PASS, "attach_task()",
retval, info[TASKINGRP]);
} else {
@@ -613,7 +613,7 @@ error:
* Checks if the current task belongs to the given tasks file
* @param tasksfile the task file to be tested for the task
*/
-int check_task(char *tasksfile)
+int check_task(char *tasksfile, pid_t pid)
{
FILE *file;
pid_t curr_tid, tid;
@@ -626,7 +626,11 @@ int check_task(char *tasksfile)
exit(1);
}
- curr_tid = cgrouptest_gettid();
+ if (pid)
+ curr_tid = pid;
+ else
+ curr_tid = cgrouptest_gettid();
+
while (!feof(file)) {
fscanf(file, "%u", &tid);
if (tid == curr_tid) {