From d1de9f5c6c7d63303616e407fe562c92458d67b9 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sat, 18 Mar 2023 17:50:56 +0100 Subject: [PATCH] [gdb/testsuite] Handle unbuffer_output.c for remote host Handle $srcdir/lib/unbuffer_output.c using lappend_include_file. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/a2-run.exp | 6 +++++- gdb/testsuite/gdb.base/call-ar-st.c | 2 +- gdb/testsuite/gdb.base/call-ar-st.exp | 6 +++++- gdb/testsuite/gdb.base/call-rt-st.c | 2 +- gdb/testsuite/gdb.base/call-rt-st.exp | 7 ++++++- gdb/testsuite/gdb.base/call-strs.c | 2 +- gdb/testsuite/gdb.base/call-strs.exp | 5 ++++- gdb/testsuite/gdb.base/catch-gdb-caused-signals.c | 2 +- gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp | 6 +++++- gdb/testsuite/gdb.base/commands.exp | 9 +++++++-- gdb/testsuite/gdb.base/dprintf.c | 2 +- gdb/testsuite/gdb.base/dprintf.exp | 6 +++++- gdb/testsuite/gdb.base/ending-run.c | 2 +- gdb/testsuite/gdb.base/ending-run.exp | 6 +++++- gdb/testsuite/gdb.base/interrupt.c | 2 +- gdb/testsuite/gdb.base/interrupt.exp | 5 ++++- gdb/testsuite/gdb.base/multi-forks.c | 2 +- gdb/testsuite/gdb.base/multi-forks.exp | 6 +++++- gdb/testsuite/gdb.base/run.c | 2 +- gdb/testsuite/gdb.base/shlib-call.exp | 7 ++++++- gdb/testsuite/gdb.base/shmain.c | 2 +- gdb/testsuite/gdb.base/varargs.c | 2 +- gdb/testsuite/gdb.base/varargs.exp | 8 +++++--- gdb/testsuite/gdb.mi/mi-dprintf.c | 2 +- gdb/testsuite/gdb.mi/mi-dprintf.exp | 6 +++++- 25 files changed, 79 insertions(+), 28 deletions(-) diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index 08f6599c84a..ae0b9c2dd6e 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -24,7 +24,11 @@ require {!gdb_skip_stdio_test "a2run.exp"} standard_testfile run.c -if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.base/call-ar-st.c b/gdb/testsuite/gdb.base/call-ar-st.c index 497af840854..6c1e3b95fa1 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.c +++ b/gdb/testsuite/gdb.base/call-ar-st.c @@ -3,7 +3,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" /************************************************************************** * TESTS : diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index 8abd3b40d91..0118ad7ffe8 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -28,7 +28,11 @@ require {!target_info exists gdb,cannot_call_functions} set allow_float_test [allow_float_test] -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } diff --git a/gdb/testsuite/gdb.base/call-rt-st.c b/gdb/testsuite/gdb.base/call-rt-st.c index 072ea860192..e4bc297bb79 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.c +++ b/gdb/testsuite/gdb.base/call-rt-st.c @@ -2,7 +2,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" /************************************************************************** * TESTS : diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 9840e3cd8ed..63db4c56d57 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -25,7 +25,12 @@ require {!target_info exists gdb,cannot_call_functions} standard_testfile .c -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { +set flags {} +lappend flags debug +lappend flags nowarnings +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $flags] != "" } { untested "failed to compile" return -1 } diff --git a/gdb/testsuite/gdb.base/call-strs.c b/gdb/testsuite/gdb.base/call-strs.c index 03a80647d7e..c734936ecbc 100644 --- a/gdb/testsuite/gdb.base/call-strs.c +++ b/gdb/testsuite/gdb.base/call-strs.c @@ -2,7 +2,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" char buf[100]; char bigbuf[1000]; diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index f1577cb44df..781b2453cd0 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -29,8 +29,11 @@ standard_testfile # test. require {!target_info exists gdb,cannot_call_functions} +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } diff --git a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c index ca48393f43a..f923ad2627b 100644 --- a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c +++ b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c @@ -20,7 +20,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" int main (void) diff --git a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp index 9908c1af539..5770437d3a1 100644 --- a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp +++ b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp @@ -28,7 +28,11 @@ require {!target_info exists gdb,cannot_call_functions} set dp_location [gdb_get_line_number "set dprintf here"] set bp_location [gdb_get_line_number "set breakpoint here"] -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 316897f9c5c..ec2015ebef5 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -25,9 +25,14 @@ set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests] -standard_testfile +standard_testfile run.c -if { [prepare_for_testing "failed to prepare" commands run.c {debug additional_flags=-DFAKEARGV}] } { +set flags {} +lappend flags debug +lappend flags additional_flags=-DFAKEARGV +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf.c b/gdb/testsuite/gdb.base/dprintf.c index ee2dc6031b5..700a77b4fe0 100644 --- a/gdb/testsuite/gdb.base/dprintf.c +++ b/gdb/testsuite/gdb.base/dprintf.c @@ -17,7 +17,7 @@ #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" static int g; diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp index 2d838e7f7b9..d17b81e1833 100644 --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -15,7 +15,11 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.base/ending-run.c b/gdb/testsuite/gdb.base/ending-run.c index 1e09f164877..a499f37a052 100644 --- a/gdb/testsuite/gdb.base/ending-run.c +++ b/gdb/testsuite/gdb.base/ending-run.c @@ -4,7 +4,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" int callee (int x) { diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index b2cfc03e3bf..070dcc6f190 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -23,7 +23,11 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { return -1 } remote_exec build "rm -f core" diff --git a/gdb/testsuite/gdb.base/interrupt.c b/gdb/testsuite/gdb.base/interrupt.c index 6426015afa8..ab6bac9f821 100644 --- a/gdb/testsuite/gdb.base/interrupt.c +++ b/gdb/testsuite/gdb.base/interrupt.c @@ -3,7 +3,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" #ifdef SIGNALS #include diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 19628e2f419..87edf5d7f89 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -19,7 +19,10 @@ require {!target_info exists gdb,noinferiorio} standard_testfile -set options { debug } +set options {} +lappend options debug +lappend_include_file options $srcdir/lib/unbuffer_output.c + if { ! [target_info exists gdb,nosignals] } { lappend options "additional_flags=-DSIGNALS" } diff --git a/gdb/testsuite/gdb.base/multi-forks.c b/gdb/testsuite/gdb.base/multi-forks.c index aedd13493df..91b7db12abb 100644 --- a/gdb/testsuite/gdb.base/multi-forks.c +++ b/gdb/testsuite/gdb.base/multi-forks.c @@ -20,7 +20,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" pid_t pids[4]; diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index 02dd327cad7..54ce9264d4b 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -21,7 +21,11 @@ require {istarget "*-*-linux*"} standard_testfile .c -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $flags] != "" } { untested "failed to compile" return -1 } diff --git a/gdb/testsuite/gdb.base/run.c b/gdb/testsuite/gdb.base/run.c index 614b018260d..d0e631a8457 100644 --- a/gdb/testsuite/gdb.base/run.c +++ b/gdb/testsuite/gdb.base/run.c @@ -6,7 +6,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" int factorial (int); diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 88c43534b01..2ec81d50ec7 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -43,7 +43,12 @@ set lib1 [standard_output_file shr1.sl] set lib2 [standard_output_file shr2.sl] set lib_opts "debug" -set exec_opts [list debug shlib=${lib1} shlib=${lib2}] + +set exec_opts {} +lappend exec_opts debug +lappend exec_opts shlib=$lib1 +lappend exec_opts shlib=$lib2 +lappend_include_file exec_opts $srcdir/lib/unbuffer_output.c if { [gdb_compile_shlib ${lib1src} ${lib1} $lib_opts] != "" || [gdb_compile_shlib ${lib2src} ${lib2} $lib_opts] != "" diff --git a/gdb/testsuite/gdb.base/shmain.c b/gdb/testsuite/gdb.base/shmain.c index 932b83477e2..853352e8c45 100644 --- a/gdb/testsuite/gdb.base/shmain.c +++ b/gdb/testsuite/gdb.base/shmain.c @@ -3,7 +3,7 @@ #include "ss.h" #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" extern int structarg(struct s); extern int pstructarg(struct s*); diff --git a/gdb/testsuite/gdb.base/varargs.c b/gdb/testsuite/gdb.base/varargs.c index fcadcee6fb3..e0083c7d8bd 100644 --- a/gdb/testsuite/gdb.base/varargs.c +++ b/gdb/testsuite/gdb.base/varargs.c @@ -8,7 +8,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" int find_max1(int, ...); int find_max2(int, int, ...); diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index f205a715f39..78c56103205 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -33,14 +33,16 @@ standard_testfile .c set allow_float_test [allow_float_test] -set additional_flags {debug} +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c if [support_complex_tests] { - lappend additional_flags "additional_flags=-DTEST_COMPLEX" + lappend flags "additional_flags=-DTEST_COMPLEX" } # build the first test case if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ - executable ${additional_flags}] != "" } { + executable $flags] != "" } { untested "failed to compile" return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.c b/gdb/testsuite/gdb.mi/mi-dprintf.c index cb851bc83c3..bcfe2b4819b 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.c +++ b/gdb/testsuite/gdb.mi/mi-dprintf.c @@ -19,7 +19,7 @@ #include #include -#include "../lib/unbuffer_output.c" +#include "unbuffer_output.c" static int g; diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp index f2b8a572097..e40fa6121fa 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -19,7 +19,11 @@ set MIFLAGS "-i=mi" standard_testfile -if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/unbuffer_output.c + +if {[build_executable $testfile.exp $testfile $srcfile $flags] == -1} { untested "failed to compile" return -1 } -- 2.30.2