aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.testsuite
AgeCommit message (Collapse)AuthorFilesLines
2022-10-14[gdb/testsuite] Add cond_wrap procTom de Vries1-0/+43
Add a new proc cond_wrap, that can be used to replace the repetitive: ... if { $cond } { wrap { <body> } } else { <body> } ... with the shorter: ... cond_wrap $cond wrap { <body> } ... Tested on x86_64-linux.
2022-10-11[gdb/testsuite] Fix prompt parsing in capture_command_outputTom de Vries1-0/+38
I noticed in capture_command_output that the output of a single command is matched using two gdb_test_multiples: - the first one matching the echoed command and skipping an optional prefix, - the second one matching the output and the prompt. This is error-prone, because the first gdb_test_multiple has implicit clauses which may consume the prompt. The problem is easy to spot with an example. First consider: ... set output [capture_command_output "print 1" "\\\$1 = "] gdb_assert { [string equal $output "1"] } ... for which we get: ... PASS: [string equal $output "1"] ... If we change the prefix string to a no-match, say "1 = ", and update the output string match accordingly, we get instead: ... FAIL: capture_command_output for print 1 FAIL: [string equal $output "\$1 = 1"] ... The first FAIL is produced by the first gdb_test_multiple, consuming the prompt. The second gdb_test_multiple then silently times out waiting for another prompt, after which the second FAIL is produced. Note that the timeout is silent because the gdb_test_multiple is called with an empty message argument. The second FAIL is because capture_command_output returns "", given that all the command output was consumed by the first gdb_test_multiple. Fix this by rewriting capture_command_output to use only a single gdb_test_multiple. Tested on x86_64-linux.
2022-10-10[gdb/testsuite] Detect trailing ^C/^D in commandTom de Vries1-6/+28
Detect a trailing ^C/^D in the command argument of gdb_test_multiple, and error out. Tested on x86_64-linux.
2022-10-10[gdb/testsuite] Fix error message for cmd with trailing newlineTom de Vries1-0/+28
I noticed that the error message in gdb_test_multiple about trailing newline in a command does not mention the offending command, nor the word command: ... if [string match "*\[\r\n\]" $command] { error "Invalid trailing newline in \"$message\" test" } ... Fix this by using instead: ... error "Invalid trailing newline in \"$command\" command" ... Also add a test-case to trigger this: gdb.testsuite/gdb-test.exp. Tested on x86_64-linux.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker4-4/+4
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-09-24[gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.expTom de Vries1-26/+16
Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp, and in the process: - fix a few typos - remove unnecessary "test -r /proc/cpuinfo" Tested on x86_64-linux. Co-Authored-By: Pedro Alves <pedro@palves.net>
2021-09-24[gdb/testsuite] Add gdb.testsuite/dump-system-info.expTom de Vries1-0/+48
When interpreting the testsuite results, it's often relevant what kind of machine the testsuite ran on. On a local machine one can just do /proc/cpuinfo, but in case of running tests using a remote system that distributes test runs to other remote systems that are not directly accessible, that's not possible. Fix this by dumping /proc/cpuinfo into the gdb.log, as well as lsb_release -a and uname -a. We could do this at the start of each test run, by putting it into unix.exp or some such. However, this might be too verbose, so we choose to put it into its own test-case, such that it get triggered in a full testrun, but not when running one or a subset of tests. We put the test-case into the gdb.testsuite directory, which is currently the only place in the testsuite where we do not test gdb. [ Though perhaps this could be put into a new gdb.info directory, since the test-case doesn't actually test the testsuite. ] Tested on x86_64-linux.
2021-09-10[gdb/testsuite] Add string_list_to_regexpTom de Vries1-0/+66
A regexp pattern with escapes like this is hard to read: ... set re "~\"\[$\]$decimal = 1\\\\n\"\r\n\\^done" ... We can make it more readable by spacing out parts (which allows us to also use the curly braces where that's convenient): ... set re [list "~" {"} {[$]} $decimal " = 1" "\\\\" "n" {"} "\r\n" "\\^" "done"] set re [join $re ""] ... or by using string_to_regexp: ... set re [list \ [string_to_regexp {~"$}] \ $decimal \ [string_to_regexp " = 1\\n\"\r\n^done"]] set re [join $re ""] ... Note: we have to avoid applying string_to_list to decimal, which is already a regexp. Add a proc string_list_to_regexp to make it easy to do both: ... set re [list \ [string_list_to_regexp ~ {"} $] \ $decimal \ [string_list_to_regexp " = 1" \\ n {"} \r\n ^ done]] ... Also add a test-case gdb.testsuite/string_to_regexp.exp.
2021-08-30[gdb/testsuite] Improve argument syntax of proc arangeTom de Vries1-0/+59
The current syntax of proc arange is: ... proc arange { arange_start arange_length {comment ""} {seg_sel ""} } { ... and a typical call looks like: ... arange $start $len ... This style is somewhat annoying because if you want to specify the last parameter, you need to give the default values of all the other optional ones before as well: ... arange $start $len "" $seg_sel ... Update the syntax to: ... proc arange { options arange_start arange_length } { parse_options { { comment "" } { seg_sel "" } } ... such that a typical call looks like: ... arange {} $start $len ... and a call using seg_sel looks like: ... arange { seg_sel $seg_sel } $start $len ... Also update proc aranges, which already has an options argument, to use the new proc parse_options. Tested on x86_64-linux. Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-07-04Fix foreach_with_prefix regressionPedro Alves1-0/+98
Fix a silly bug in commit a26c8de0ee93 ("Fix early return in foreach_with_prefix"). That patch made foreach_with_prefix always return after the first iteration, making ~10k tests disappear from test runs... This fixes it, and as penance, adds a testcase that exercises all kinds of different returns possible (ok, error, return, break, continue). I've written it with regular "foreach", and then switched to foreach_with_prefix and made sure we get the same results. I put the testcase in a new gdb.testsuite/ subdir, since this is exercising the testsuite harness bits. We can move this elsewhere if people prefer a different place, but I'm going ahead in order to unbreak the testsuite ASAP. gdb/testsuite/ChangeLog: 2019-07-04 Pedro Alves <palves@redhat.com> * lib/gdb.exp (foreach_with_prefix): Don't return early if body returned ok(0), break(3) or continue(4). * gdb.testsuite/foreach_with_prefix.exp: New file.