Create test process

For the test suite, procps used to use sleep which would just
create a process or two to test the tools against.  Some setups
coreutils creates all programs including sleep into one blob which
means a lot of the tests fail, see issue #2

procps has its own sleep program now.
This commit is contained in:
Craig Small
2015-06-13 15:04:31 +10:00
parent 26955dd02a
commit 420cd9c7c2
7 changed files with 116 additions and 118 deletions

View File

@ -118,25 +118,24 @@ proc expect_table_dsc { test match_header match_item } {
}
proc make_testproc { } {
global testproc_path testproc_comm testproc1_pid testproc2_pid sleep_time
global testproc_path testproc_comm testproc1_pid testproc2_pid topdir
# Time to run the whole job
set sleep_time 300
set testproc_realpath "${topdir}/lib/.libs/test_process"
set testproc_comm "spcorp"
set testproc_path [ exec mktemp -u ]
set sleep_path [ exec sh -c "command -v sleep" ]
exec ln -s $sleep_path $testproc_path
set testproc_comm [ exec basename $testproc_path ]
exec ln -s $testproc_realpath $testproc_path
spawn readlink $testproc_path
expect {
-re "^$sleep_path\\s*$" { }
timeout { perror "test proc does not link to sleep 1" }
eof { perror "test proc does not link to sleep 1" }
-re "^$testproc_realpath\\s*$" { }
timeout { perror "test proc does not link to test process" }
eof { perror "test proc does not link to test process" }
}
set testproc1_pid [ exec $testproc_path $sleep_time & ]
set testproc2_pid [ exec $testproc_path $sleep_time & ]
set testproc1_pid [ exec $testproc_path & ]
set testproc2_pid [ exec $testproc_path & ]
}
proc kill_testproc { } {