testsuite: Better sched batch tests

Create a make/kill sched batch proc
Unset the PS_PERSONALITY environment variable, otherwise
subsequent tests will break depending on the order of tests.

Paramaterize the nice value so nobody thinks 18 is a magic
value.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Craig Small 2024-11-04 17:24:55 +11:00
parent 2a1232bf99
commit 300c1769c0
3 changed files with 19 additions and 5 deletions

View File

@ -224,6 +224,18 @@ proc kill_testshm_proc { } {
kill_process $testshmproc_pid
}
proc make_schedbatch_proc { nice_val } {
global schedbatch_proc_pid topdir
set schedbatch_path "${topdir}testsuite/test-schedbatch"
set schedbatch_proc_pid [ spawn $schedbatch_path $nice_val ]
}
proc kill_schedbatch_proc { } {
global schedbatch_proc_pid
kill_process $schedbatch_proc_pid
}
proc kill_testproc { } {
global testproc_path testproc1_pid testproc2_pid

View File

@ -15,4 +15,4 @@ foreach { pers match } $pers_match {
spawn $ps
expect_pass "$test" $match
}
set env(PS_PERSONALITY) ""

View File

@ -2,10 +2,12 @@
# check the ps SCHED_BATCH scheduler policy output
#
set ps "${topdir}src/ps/pscommand"
set schedbatch "${topdir}testsuite/test-schedbatch"
spawn $schedbatch 18
set nice_val 18
make_schedbatch_proc $nice_val
set test "ps SCHED_BATCH scheduler"
spawn $ps --no-header -o comm,cls,nice -a
expect_pass "$test" "(?n)^test-schedbatch\\s+B\\s+18\\r?\$"
spawn $ps --no-header -o comm,cls,nice -ax
expect_pass "$test" "(?n)^test-schedbatch\\s+B\\s+$nice_val\\r?\$"
kill_schedbatch_proc