The very first time this testcase is run it fails. Subsequent runs are OK.

AFAICT the problem is that the first time the test runs the semaphore ID
is 0 and thus the line

SEMS=`ipcs -s | awk '{printf " %d", $2}' | sed -e 's/ 0//g'`

returns an empty string as the awk output is a sequence of zeros (0 0 0
0 0).

Bellow I attach two consecutive runs with debug information. Is it
possible to fix this behavior? I am not familiar with awk/sed so I have
no clue of how to do it.

Regards

Elder.


+ RC=0
+ setup
+ export TST_TOTAL=1
+ TST_TOTAL=1
+ LTPTMP=/tmp/ltp-061008-160927/ltp-3341
+ export TCID=setup
+ TCID=setup
+ export TST_COUNT=0
+ TST_COUNT=0
+ trap cleanup 0
+ RC=0
+ SEM_ID=0
+ '[' -f /root/ltp/ltp-cvs-081006a/testcases/bin/semaphore_test_01 ']'
+ RC=0
+ return 0
+ test01
+ TCID=semaphore_test_01
+ TST_COUNT=1
+ RC=0
++ semaphore_test_01
+ SEM_ID=0
+ RC=0
+ '[' 0 -ne 0 ']'
+ tst_resm TINFO 'Created semaphore ID: 0'
semaphore_test_01    0  INFO  :  Created semaphore ID: 0
+ ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x00000000 0          root      660        1         

++ ipcs -s
++ awk '{printf " %d", $2}'
++ sed -e 's/ 0//g'
+ SEMS=
+ echo SEMS=
SEMS=
+ RC=1
+ tst_resm TFAIL 'Comparing failed with the output of '\''ipcs -s'\''.'
semaphore_test_01    1  FAIL  :  Comparing failed with the output of 'ipcs -s'.
+ return 1
+ exit 1
+ cleanup
+ '[' -n '' ']'
+ tst_resm TINFO 'CLOSE: exit.'
semaphore_test_01    0  INFO  :  CLOSE: exit.

+ RC=0
+ setup
+ export TST_TOTAL=1
+ TST_TOTAL=1
+ LTPTMP=/tmp/ltp-061008-160937/ltp-3426
+ export TCID=setup
+ TCID=setup
+ export TST_COUNT=0
+ TST_COUNT=0
+ trap cleanup 0
+ RC=0
+ SEM_ID=0
+ '[' -f /root/ltp/ltp-cvs-081006a/testcases/bin/semaphore_test_01 ']'
+ RC=0
+ return 0
+ test01
+ TCID=semaphore_test_01
+ TST_COUNT=1
+ RC=0
++ semaphore_test_01
+ SEM_ID=32768
+ RC=0
+ '[' 0 -ne 0 ']'
+ tst_resm TINFO 'Created semaphore ID: 32768'
semaphore_test_01    0  INFO  :  Created semaphore ID: 32768
+ ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x00000000 32768      root      660        1         

++ awk '{printf " %d", $2}'
++ sed -e 's/ 0//g'
++ ipcs -s
+ SEMS=' 32768'
+ echo SEMS= 32768
SEMS= 32768
+ for SEM_IPCS in '$SEMS'
+ '[' 32768 -eq 32768 ']'
+ tst_resm TPASS 'semaphore ID comparing passed.'
semaphore_test_01    1  PASS  :  semaphore ID comparing passed.
+ return 0
+ cleanup
+ '[' -n 32768 ']'
+ ipcrm -s 32768
+ tst_resm TINFO 'CLOSE: exit.'
semaphore_test_01    0  INFO  :  CLOSE: exit.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to