ARM print_insn_mve assertion
[binutils-gdb.git] / gdb / contrib / expect-read1.sh
blob82c638c59d28a1e34f5a44a2a57687a771afa30d
1 #! /bin/sh
2 # runtest wrapper to reliably reproduce racy incomplete reads in the testsuite.
4 # Copyright (C) 2013-2024 Free Software Foundation, Inc.
5 # This program 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.
10 # This program is distributed in the hope that it will be useful,
11 # but 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.
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/>.
18 # This tool exercises any incomplete reads handling in the testsuite by
19 # simulating read always returns just 1 character.
20 # Testsuite incompatibilities are tracked as GDB PR testsuite/12649.
22 # Example usage:
24 # bash$ cd $objdir/gdb/testsuite
25 # bash$ EXPECT=$srcdir/gdb/contrib/expect-read1.sh runtest
26 # or
27 # bash$ EXPECT=../contrib/expect-read1.sh runtest
29 # Find source file.
30 C=$(echo "$0" | sed 's/\.sh$/.c/')
31 if ! test -e "$C"; then
32 echo >&2 "$0: Cannot find 'srcdir/gdb/contrib/expect-read1.c' at '$C'."
33 exit 2
36 # Create temp directory.
37 tmpdir=$(mktemp -d)
39 # Schedule cleanup.
40 trap 'rm -rf $tmpdir' EXIT
42 # Compile shared library.
43 SO=$tmpdir/expect-read1.so
44 CMD="${CC_FOR_TARGET:-gcc} -o $SO -Wall -fPIC -shared $C"
45 if ! $CMD; then
46 echo >&2 "$0: Failed: $CMD"
47 exit 2
50 # Call expect with the shared library preloaded.
51 LD_PRELOAD=$SO expect "$@"
53 # Local Variables:
54 # mode:shell-script
55 # sh-indentation:2
56 # End:
57 # vi:sw=2