Blame tests/run-allfcts.sh

Packit Service 97d2fb
#! /bin/sh
Packit Service 97d2fb
# Copyright (C) 2005, 2013 Red Hat, Inc.
Packit Service 97d2fb
# This file is part of elfutils.
Packit Service 97d2fb
# Written by Ulrich Drepper <drepper@redhat.com>, 2005.
Packit Service 97d2fb
#
Packit Service 97d2fb
# This file is free software; you can redistribute it and/or modify
Packit Service 97d2fb
# it under the terms of the GNU General Public License as published by
Packit Service 97d2fb
# the Free Software Foundation; either version 3 of the License, or
Packit Service 97d2fb
# (at your option) any later version.
Packit Service 97d2fb
#
Packit Service 97d2fb
# elfutils is distributed in the hope that it will be useful, but
Packit Service 97d2fb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 97d2fb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 97d2fb
# GNU General Public License for more details.
Packit Service 97d2fb
#
Packit Service 97d2fb
# You should have received a copy of the GNU General Public License
Packit Service 97d2fb
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit Service 97d2fb
Packit Service 97d2fb
. $srcdir/test-subr.sh
Packit Service 97d2fb
Packit Service 97d2fb
testfiles testfile testfile2 testfile8
Packit Service 97d2fb
Packit Service 97d2fb
testrun_compare ${abs_builddir}/allfcts testfile testfile2 testfile8 <<\EOF
Packit Service 97d2fb
/home/drepper/gnu/new-bu/build/ttt/m.c:5:main
Packit Service 97d2fb
/home/drepper/gnu/new-bu/build/ttt/b.c:4:bar
Packit Service 97d2fb
/home/drepper/gnu/new-bu/build/ttt/f.c:3:foo
Packit Service 97d2fb
/shoggoth/drepper/b.c:4:bar
Packit Service 97d2fb
/shoggoth/drepper/f.c:3:foo
Packit Service 97d2fb
/shoggoth/drepper/m.c:5:main
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:107:main
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:159:print_version
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:173:parse_opt
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:201:more_help
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:217:process_file
Packit Service 97d2fb
/usr/include/sys/stat.h:375:stat64
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:291:crc32_file
Packit Service 97d2fb
/home/drepper/gnu/elfutils/build/src/../../src/strip.c:313:handle_elf
Packit Service 97d2fb
EOF
Packit Service 97d2fb
Packit Service 97d2fb
# = nested_funcs.c =
Packit Service 97d2fb
#
Packit Service 97d2fb
# static int
Packit Service 97d2fb
# foo (int x)
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   int bar (int y)
Packit Service 97d2fb
#   {
Packit Service 97d2fb
#     return x - y;
Packit Service 97d2fb
#   }
Packit Service 97d2fb
# 
Packit Service 97d2fb
#   return bar (x * 2);
Packit Service 97d2fb
# }
Packit Service 97d2fb
#
Packit Service 97d2fb
# int
Packit Service 97d2fb
# main (int argc, char ** argv)
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   return foo (argc);
Packit Service 97d2fb
# }
Packit Service 97d2fb
#
Packit Service 97d2fb
# gcc -g -o nested_funcs nested_funcs.c
Packit Service 97d2fb
Packit Service 97d2fb
# = class_func.cxx =
Packit Service 97d2fb
#
Packit Service 97d2fb
# namespace foobar
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   class Foo
Packit Service 97d2fb
#   {
Packit Service 97d2fb
#   public:
Packit Service 97d2fb
#     int bar(int x);
Packit Service 97d2fb
#   };
Packit Service 97d2fb
#
Packit Service 97d2fb
#   int Foo::bar(int x) { return x - 42; }
Packit Service 97d2fb
# };
Packit Service 97d2fb
#
Packit Service 97d2fb
# int
Packit Service 97d2fb
# main (int argc, char **argv)
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   foobar::Foo foo;
Packit Service 97d2fb
#
Packit Service 97d2fb
#   return foo.bar (42);
Packit Service 97d2fb
# }
Packit Service 97d2fb
#
Packit Service 97d2fb
# clang++ -g -o class_func class_func.cxx
Packit Service 97d2fb
Packit Service 97d2fb
testfiles testfile_nested_funcs testfile_class_func
Packit Service 97d2fb
Packit Service 97d2fb
testrun_compare ${abs_builddir}/allfcts testfile_nested_funcs testfile_class_func <<\EOF
Packit Service 97d2fb
/home/mark/src/tests/nested/nested_funcs.c:2:foo
Packit Service 97d2fb
/home/mark/src/tests/nested/nested_funcs.c:4:bar
Packit Service 97d2fb
/home/mark/src/tests/nested/nested_funcs.c:13:main
Packit Service 97d2fb
/home/mark/src/tests/nested/class_func.cxx:6:bar
Packit Service 97d2fb
/home/mark/src/tests/nested/class_func.cxx:13:main
Packit Service 97d2fb
EOF
Packit Service 97d2fb
Packit Service 97d2fb
# = testfile-lto.h =
Packit Service 97d2fb
# struct t
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   int *p;
Packit Service 97d2fb
#   int c;
Packit Service 97d2fb
# };
Packit Service 97d2fb
#
Packit Service 97d2fb
# extern int foo (int i, struct t *t);
Packit Service 97d2fb
Packit Service 97d2fb
# = testfile-lto-func.c =
Packit Service 97d2fb
# #include "testfile-lto.h"
Packit Service 97d2fb
#
Packit Service 97d2fb
# int
Packit Service 97d2fb
# foo (int i, struct t *t)
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   int j, res = 0;
Packit Service 97d2fb
#   for (j = 0; j < i && j < t->c; j++)
Packit Service 97d2fb
#     res += t->p[j];
Packit Service 97d2fb
#
Packit Service 97d2fb
#   return res;
Packit Service 97d2fb
# }
Packit Service 97d2fb
Packit Service 97d2fb
# = testfile-lto-main.c =
Packit Service 97d2fb
# #include "testfile-lto.h"
Packit Service 97d2fb
#
Packit Service 97d2fb
# static struct t g;
Packit Service 97d2fb
#
Packit Service 97d2fb
# int
Packit Service 97d2fb
# main (int argc, char **argv)
Packit Service 97d2fb
# {
Packit Service 97d2fb
#   int i;
Packit Service 97d2fb
#   int j[argc];
Packit Service 97d2fb
#   g.c = argc;
Packit Service 97d2fb
#   g.p = j;
Packit Service 97d2fb
#   for (i = 0; i < argc; i++)
Packit Service 97d2fb
#     j[i] = (int) argv[i][0];
Packit Service 97d2fb
#   return foo (3, &g);
Packit Service 97d2fb
# }
Packit Service 97d2fb
Packit Service 97d2fb
# Using gcc (GCC) 10.0.1 20200430 (Red Hat 10.0.1-0.13)
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-func.c
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-main.c
Packit Service 97d2fb
# gcc -g -O2 -flto -o testfile-lto-gcc10 testfile-lto-func.o testfile-lto-main.o
Packit Service 97d2fb
Packit Service 97d2fb
testfiles testfile-lto-gcc10
Packit Service 97d2fb
Packit Service 97d2fb
testrun_compare ${abs_builddir}/allfcts testfile-lto-gcc10 <<\EOF
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-func.c:4:foo
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
EOF
Packit Service 97d2fb
Packit Service 97d2fb
# Using gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-func.c
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-main.c
Packit Service 97d2fb
# gcc -g -O2 -flto -o testfile-lto-gcc8 testfile-lto-func.o testfile-lto-main.o
Packit Service 97d2fb
Packit Service 97d2fb
testfiles testfile-lto-gcc8
Packit Service 97d2fb
Packit Service 97d2fb
testrun_compare ${abs_builddir}/allfcts testfile-lto-gcc8 <<\EOF
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-func.c:4:foo
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-func.c:4:foo
Packit Service 97d2fb
EOF
Packit Service 97d2fb
Packit Service 97d2fb
# gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-func.c
Packit Service 97d2fb
# gcc -g -O2 -flto -c testfile-lto-main.c
Packit Service 97d2fb
# gcc -g -O2 -flto -o testfile-lto-gcc9 testfile-lto-func.o testfile-lto-main.o
Packit Service 97d2fb
Packit Service 97d2fb
testfiles testfile-lto-gcc9
Packit Service 97d2fb
Packit Service 97d2fb
testrun_compare ${abs_builddir}/allfcts testfile-lto-gcc9 <<\EOF
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-func.c:4:foo
Packit Service 97d2fb
/home/mark/src/tests/testfile-lto-main.c:6:main
Packit Service 97d2fb
EOF
Packit Service 97d2fb
Packit Service 97d2fb
exit 0