Hi Robbie,

I may need your help to understand ar01 test case under
testcases/commands/ade/ar/.

The following test code may fail, and I don't understand what it does,

 # The -s causes regeneration of symbol table even if a symbol table
   exists.

 # CODE

 rm -rf $TCtmp/lib.a;cd $TCdat
 ar -cr $TCtmp/lib.a file1.o
 crtest
 size1=`ls -s $TCtmp/lib.a|(read a b; echo $a)`
 strip $TCtmp/lib.a 2>&1 1>/dev/null
 ar -ts $TCtmp/lib.a 2>&1 1>/dev/null
 size2=`ls -s $TCtmp/lib.a|(read a b; echo $a)`

 if [ $size1 -eq $size2 ]

 then
     echo "-)17"
 else
     TCRESULT=17
     echo "FAIL - ar with -does not regenerate symbol table"

I have two questions. The first one is, why use "t" and "s" options
together? 

 ar -ts $TCtmp/lib.a 2>&1 1>/dev/null

>From the manpage,

 t   Display a table listing the contents of archive, or those of the
     files listed in member... that are present in the archive.
     Normally only the member name is shown; if you also want to see the
     modes (permissions), timestamp, owner, group, and size, you can
     request that by also specifying the v modifier.

 s   Write an object-file index into the archive, or update an existing
     one, even if no other change is made to the archive.  You may use
     this modifier flag either with any operation, or alone.  Running ar
     s on an archive is equivalent to running ranlib on it.

I can't see how they are related. Do you mean "ar -s"?

The second one is, this piece of test code fails for me, and it works
sometimes probably just by dumb luck. It can be explained by the
following,

First, we create an archieve file lib.a by including file1.o.
# ar -cr lib.a file1.o

Second, we get lib.a's block size.
# # ls -s lib.a
8 lib.a

# nm -s lib.a

Archive index:
main in file1.o

file1.o:
0000000000000000 r .LC0
0000000000000000 T main
                 U puts


Then, we strip its symbols.
# strip lib.a

# ls -s lib.a
8 lib.a

# nm -s lib.a

file1.o:
nm: file1.o: no symbols


Next, use "ar -s" to generate symbol index?
# ar -s lib.a

# ls -s lib.a
8 lib.a

# nm -s lib.a

file1.o:
nm: file1.o: no symbols


Finally, we get lib.a's new block size, and compare with the old one. If
they are same, the test passes. Otherwise, fails.

As you can from the above, there are two things does not make sense to
me,

* the lib.a's block size is the same before and after stripping the
  symbols.

* "ar -s" seems have not effect indicating by "nm -s" and "ls -s".

Any pointer?

CAI Qian

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to