From dbe5e99cf91d36c6e479b6948fd6b2347494c309 Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Fri, 30 Nov 2018 12:57:11 +0900 Subject: [PATCH] Fix test of "make sure to context-switch to idle thread when therad's status is PS_EXITED" Change-Id: I62ea813656805b6250b0465853e8fa2918b0c86b Refs: #1029 Refs: #1227 --- test/mng_mod/issues/1029/1029.patch | 18 +++++++++--------- test/mng_mod/issues/1029/Makefile | 3 ++- test/mng_mod/issues/1029/README | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/mng_mod/issues/1029/1029.patch b/test/mng_mod/issues/1029/1029.patch index b5a100f8..766d434d 100644 --- a/test/mng_mod/issues/1029/1029.patch +++ b/test/mng_mod/issues/1029/1029.patch @@ -16,14 +16,6 @@ diff --git kernel/process.c kernel/process.c index 3dda3ea..eb65aa9 100644 --- kernel/process.c +++ kernel/process.c -@@ -126,6 +126,7 @@ init_process(struct process *proc, struct process *parent) - proc->mpol_threshold = parent->mpol_threshold; - memcpy(proc->rlimit, parent->rlimit, - sizeof(struct rlimit) * MCK_RLIM_MAX); -+#define POSTK_DEBUG_TEMP_FIX_69 1 // TestCode for #1029 - #ifdef POSTK_DEBUG_TEMP_FIX_69 /* Fix problem not to inherit parent cpu_set. */ - memcpy(&proc->cpu_set, &parent->cpu_set, - sizeof(proc->cpu_set)); @@ -3135,12 +3136,16 @@ out_schedule: schedule(); } @@ -41,7 +33,7 @@ index 3dda3ea..eb65aa9 100644 if (cpu_local_var(no_preempt)) { kprintf("%s: WARNING can't schedule() while no preemption, cnt: %d\n", -@@ -3173,6 +3178,62 @@ redo: +@@ -3173,6 +3178,70 @@ redo: } } @@ -58,6 +50,14 @@ index 3dda3ea..eb65aa9 100644 + if (thread->tid == prev->tid) { + continue; + } ++ ++ /* Skip not-schedulable */ ++ if (thread->status == PS_RUNNING || ++ (thread->status == PS_INTERRUPTIBLE && hassigpending(thread))) { ++ } else { ++ continue; ++ } ++ + runq_cnt++; + if (!thread->started) { + not_started = 1; diff --git a/test/mng_mod/issues/1029/Makefile b/test/mng_mod/issues/1029/Makefile index ffb6f6c7..887d3a45 100644 --- a/test/mng_mod/issues/1029/Makefile +++ b/test/mng_mod/issues/1029/Makefile @@ -1,5 +1,6 @@ +include $(HOME)/.mck_test_config.mk + CC=gcc -MCK_DIR=/home/satoken/ppos MCEXEC=$(MCK_DIR)/bin/mcexec TARGET=sched_test go_test all:: $(TARGET) diff --git a/test/mng_mod/issues/1029/README b/test/mng_mod/issues/1029/README index 30afb053..8a669c03 100644 --- a/test/mng_mod/issues/1029/README +++ b/test/mng_mod/issues/1029/README @@ -23,7 +23,7 @@ runqに積まれている実行待ちthreadの状態の組み合わせで、12 (2) テストの実行方法 以下の手順でテストを実行する 1. 1029.patch をMcKernelのソースコードに適用し、ビルドとインストールを行う - 2. MakefileのMCK_DIR変数の内容を、McKernelがインストールされているディレクトリに変更する + 2. ${HOME}/.mck_test_config.mkのMCK_DIR変数の内容を、McKernelがインストールされているディレクトリに変更する 3. /bin/mcreboot.sh -c 2-7 -m 2G -O 4. sh make test を実行する