Home | History | Annotate | Download | only in tests
      1 #! /bin/sh
      2 # Copyright (C) 2014 Red Hat, Inc.
      3 # This file is part of elfutils.
      4 #
      5 # This file is free software; you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation; either version 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # elfutils is distributed in the hope that it will be useful, but
     11 # WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 . $srcdir/test-subr.sh
     19 
     20 # char c;
     21 # int i;
     22 # long l;
     23 #
     24 # void *v;
     25 #
     26 # struct s
     27 # {
     28 #   char *a;
     29 #   int i;
     30 # } s;
     31 #
     32 # char ca[16];
     33 # int ia[32];
     34 # void *va[64];
     35 # struct s sa[8];
     36 
     37 # On x86_64 (LP64):
     38 # gcc -g -c -o testfile-sizes1.o sizes.c
     39 # clang -g -c -o testfile-sizes2.o sizes.c
     40 
     41 # const char c;
     42 # volatile int i;
     43 # const volatile long l;
     44 #
     45 # void * restrict v;
     46 #
     47 # struct s
     48 # {
     49 #   const char *a;
     50 #   volatile int i;
     51 # } s;
     52 #
     53 # const char ca[16];
     54 # volatile int ia[32];
     55 # const volatile void * const volatile restrict va[64];
     56 # struct s sa[8];
     57 #
     58 # typedef const int foo;
     59 # typedef volatile foo bar;
     60 # foo f;
     61 # bar b;
     62 #
     63 # gcc -std=c99 -g -c -o testfile-sizes3.o sizes.c
     64 
     65 testfiles testfile-sizes1.o testfile-sizes2.o testfile-sizes3.o
     66 
     67 testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes1.o <<\EOF
     68 c size 1
     69 i size 4
     70 l size 8
     71 v size 8
     72 s size 16
     73 ca size 16
     74 ia size 128
     75 va size 512
     76 sa size 128
     77 EOF
     78 
     79 testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes2.o <<\EOF
     80 c size 1
     81 i size 4
     82 l size 8
     83 v size 8
     84 s size 16
     85 ca size 16
     86 ia size 128
     87 va size 512
     88 sa size 128
     89 EOF
     90 
     91 testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes3.o <<\EOF
     92 c size 1
     93 i size 4
     94 l size 8
     95 v size 8
     96 s size 16
     97 ca size 16
     98 ia size 128
     99 va size 512
    100 sa size 128
    101 f size 4
    102 b size 4
    103 EOF
    104 
    105 exit 0
    106