aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-09-23 07:57:49 +0200
committerTom de Vries <tdevries@suse.de>2024-09-23 07:57:49 +0200
commitbe32af158ade53f91caeb1951e8cbf7578d08b52 (patch)
tree0ebad26b17badabb747f289faa9f3e9b11fc435b /gdb/testsuite/lib
parent[gdb/testsuite] Fix gdb.base/attach-deleted-exec.exp with NFS (diff)
downloadbinutils-gdb-be32af158ade53f91caeb1951e8cbf7578d08b52.tar.gz
binutils-gdb-be32af158ade53f91caeb1951e8cbf7578d08b52.tar.bz2
binutils-gdb-be32af158ade53f91caeb1951e8cbf7578d08b52.zip
[gdb/testsuite] Fix gdb.base/empty-host-env-vars.exp
On aarch64-linux (debian testing) with test-case gdb.base/empty-host-env-vars.exp I ran into: ... (gdb) show index-cache directory^M The directory of the index cache is "/home/linux/.cache/gdb".^M (gdb) FAIL: $exp: env_var_name=HOME: show index-cache directory ... Without changing any environment variables, the value of the index-cache dir is: ... $ gdb -q -batch -ex "show index-cache directory" The directory of the index cache is "/home/linux/.cache/gdb". ... and the expectation of the test-case is that setting HOME to empty will produce an empty dir, but what it actually produces is: ... $ HOME= gdb -q -batch -ex "show index-cache directory" The directory of the index cache is "/home/linux/.cache/gdb". ... There's nothing wrong with that behaviour, the dir is simply constructed using XDG_CACHE_HOME which happens to be explictly set to its default value $HOME/.cache [1]: ... $ echo $XDG_CACHE_HOME /home/linux/.cache ... and indeed also setting that variable to empty gets us the expected empty dir: ... $ XDG_CACHE_HOME= HOME= gdb -q -batch -ex "show index-cache directory" gdb: warning: Couldn't determine a path for the index cache directory. The directory of the index cache is "". ... Furthermore, the test-case assumption that setting variables to empty either produces the original dir or an empty dir is incorrect. Say that XDG_CACHE_HOME has a non-default value: ... $ echo $XDG_CACHE_HOME /home/linux/my-xdg-cache-home $ gdb -q -batch -ex "show index-cache directory" The directory of the index cache is "/home/linux/my-xdg-cache-home/gdb". ... then setting that variable to empty: ... $ XDG_CACHE_HOME= gdb -q -batch -ex "show index-cache directory" The directory of the index cache is "/home/linux/.cache/gdb". ... does change the value of the dir. Fix this by making the test-case less specific. While we're at it, factor out regexps re_pre and re_post to make regexps more readable, and use string_to_regexp to reduce quoting. Tested on aarch64-linux. PR testsuite/32132 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32132 [1] https://specifications.freedesktop.org/basedir-spec/latest/index.html#variables
Diffstat (limited to 'gdb/testsuite/lib')
0 files changed, 0 insertions, 0 deletions