Re: [PATCH 01/12] tests: check /proc availability, and go-around if it is incomplete

Sami Kerola
2014-05-12T09:13:25Z

On 12 May 2014 08:05, Bernhard Voelker <mail@bernhard-voelker.de> wrote:
> On 05/11/2014 09:26 PM, Sami Kerola wrote:
>> diff --git a/tests/ts/kill/kill_functions.sh b/tests/ts/kill/kill_functions.sh
>> index 73fff05..a2a2483 100644
>> --- a/tests/ts/kill/kill_functions.sh
>> +++ b/tests/ts/kill/kill_functions.sh
>> @@ -1,3 +1,5 @@
>> +# kill tests, or command, will not when /proc is missing.
>> +test /proc || ts_skip "/proc not available"
>
> Ahem, this only ensures that '/proc' is a string, nothing else ...

Hi Berny,

Thank you for getting rid of silly mistake. Fix is available in my git.

https://github.com/kerolasa/lelux-utiliteetit/commit/04af69d0ab20f337a40e72d501f13977d20e4013

>> # unfortunately we are using gawk features
>> type gawk >/dev/null 2>&1 || ts_skip "cannot find gawk"
>> @@ -8,6 +10,17 @@ function check_test_sigreceive {
>> local pid=$1
>>
>> for i in 0.01 0.1 1 1 1 1; do
>> + if [ ! -f /proc/$pid/status ]; then
>> + # The /proc exists, but not status file. Because
>> + # the process already started it is unlikely the
>> + # file would appear after any amount of waiting.
>> + # Try to sleep for moment and hopefully
>> + # test_sigreceive is ready to be killed.
>> + echo "kill_functions.sh: /proc/$pid/status: No such file or directory"
>> + sleep 2
>> + rc=1
>> + break
>> + fi
>> gawk 'BEGIN { retval=1 }
>> /^SigCgt/ {
>> lbyte = strtonum("0x" substr($2, 16, 16))
>>
>
> Seeing all this /proc stuff going into the tests - it now even
> requires gawk - I still personally think that a simple witness
> file would have done it.
> So Karel, if you really prefer this, then I'm okay with it, of course.

With witness file comes the issue of who can write and where when the
check that runs as root does the 'nobody' process killing. Is that
issue more or less simple to go-around than status file parsing. I'm
not sure, but I am getting a bit tired of these checks.

BTW I had no idea util-linux is tested in environments that something
else but gawk as default awk.

--
Sami Kerola