Hi Elder,

It's really a problem on this cases.  My solution is to deal with the
semaphore ID with 0 individually.
So I have to separate the semaphore ID with 0 from other IDs.

# ipcs -s -i 0

Semaphore Array semid=0
uid=0  gid=0       cuid=0      cgid=0
mode=0600, access_perms=0600
nsems = 1
otime = Tue Oct  7 09:08:53 2008
ctime = Tue Oct  7 09:08:53 2008
semnum     value      ncount     zcount     pid
0          1          0          1          2347
#echo $?
0

# ipcrm -s 0
# ipcs -s -i 0
semctl : Invalid argument
# echo $?
0

It seemed a error in return value.  I opened a bug and provided a patch to
redhat for the wrong return value.
https://bugzilla.redhat.com/show_bug.cgi?id=465911



Best regards!

Jin Bing Guo  郭晋兵



                                                                       
             Elder Costa                                               
             <[EMAIL PROTECTED]                                         
             a.com.br>                                                  To
                                       [email protected]  
             10/07/2008 03:11                                           cc
             AM                                                        
                                                                   Subject
                                       [LTP]  bug:                     
                                       run_semaphore_test_01.sh        
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       




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

<<inline: graycol.gif>>

<<inline: pic26131.gif>>

<<inline: ecblank.gif>>

-------------------------------------------------------------------------
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