05-ranlib-adds-index.sh (634B)
1 # `kit ranlib` should add a System-V symbol-index member to an 2 # archive that was created without one. The member list and order 3 # must be preserved, and the archive must grow (the index member 4 # adds bytes). Compares pre- and post-ranlib `ar t` output and prints 5 # whether the archive size strictly increased. 6 7 printf 'aaaa' > a.o 8 printf 'bbbb' > b.o 9 "$KIT" ar rc lib.a a.o b.o 10 size_before=$(wc -c < lib.a | tr -d ' ') 11 "$KIT" ar t lib.a 12 "$KIT" ranlib lib.a 13 size_after=$(wc -c < lib.a | tr -d ' ') 14 "$KIT" ar t lib.a 15 if [ "$size_after" -gt "$size_before" ]; then 16 echo grew 17 else 18 echo "no-growth: $size_before -> $size_after" 19 fi