Commit | Line | Data |
---|---|---|
93acabad CC |
1 | #!/bin/sh |
2 | ||
3 | # missing_key_func.sh -- a test case for printing error messages when | |
4 | # a class is missing its key function. | |
5 | ||
2571583a | 6 | # Copyright (C) 2013-2017 Free Software Foundation, Inc. |
93acabad CC |
7 | # Written by Cary Coutant <ccoutant@google.com> |
8 | ||
9 | # This file is part of gold. | |
10 | ||
11 | # This program is free software; you can redistribute it and/or modify | |
12 | # it under the terms of the GNU General Public License as published by | |
13 | # the Free Software Foundation; either version 3 of the License, or | |
14 | # (at your option) any later version. | |
15 | ||
16 | # This program is distributed in the hope that it will be useful, | |
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | # GNU General Public License for more details. | |
20 | ||
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with this program; if not, write to the Free Software | |
23 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
24 | # MA 02110-1301, USA. | |
25 | ||
26 | # This file goes with debug_msg.cc, a C++ source file constructed to | |
27 | # have undefined references. We compile that file with debug | |
28 | # information and then try to link it, and make sure the proper errors | |
29 | # are displayed. The errors will be found in debug_msg.err. | |
30 | ||
31 | check() | |
32 | { | |
33 | if ! grep -q "$2" "$1" | |
34 | then | |
35 | echo "Did not find expected error in $1:" | |
36 | echo " $2" | |
37 | echo "" | |
38 | echo "Actual error output below:" | |
39 | cat "$1" | |
40 | exit 1 | |
41 | fi | |
42 | } | |
43 | ||
44 | check_missing() | |
45 | { | |
46 | if grep -q "$2" "$1" | |
47 | then | |
48 | echo "Found unexpected error in $1:" | |
49 | echo " $2" | |
50 | echo "" | |
51 | echo "Actual error output below:" | |
52 | cat "$1" | |
53 | exit 1 | |
54 | fi | |
55 | } | |
56 | ||
57 | check missing_key_func.err "error: undefined reference to 'vtable for C'" | |
58 | check missing_key_func.err "class is missing its key function" |