[gdb/testsuite] Fix quoting issue in gdb.base/index-cache.exp
authorTom de Vries <tdevries@suse.de>
Mon, 27 Mar 2023 11:58:09 +0000 (13:58 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 27 Mar 2023 11:58:09 +0000 (13:58 +0200)
For test-case gdb.base/index-cache.exp and remote host, this:
...
lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
...
gives us:
...
Executing on host: sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index    (timeout = 300)
builtin_spawn -ignore SIGHUP sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index^M
rm: missing operand^M
Try 'rm --help' for more information.^M
FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir
...

Fix this using quote_for_host.  Likewise in gdb.dwarf2/per-bfd-sharing.exp.

Tested on x86_64-linux.

gdb/testsuite/gdb.base/index-cache.exp
gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp

index ec69f0f11ad6e2b7ad1ac1d9103ca37bddaafd9b..9f2f53053cbad65a20611f62f3a7b395d2aa1a88 100644 (file)
@@ -245,7 +245,7 @@ test_cache_enabled_hit $cache_dir
 # Test again with the cache disabled, now that it is populated.
 test_cache_disabled $cache_dir "after populate"
 
-lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
+lassign [remote_exec host "sh -c" [quote_for_host rm $cache_dir/*.gdb-index]] ret
 if { $ret != 0 && $expecting_index_cache_use } {
     fail "couldn't remove files in temporary cache dir"
     return
index 46284c2b7756a92360b686edb6e105d610adf49b..6574f65df9136ba7467116d962989165f9b7c7e1 100644 (file)
@@ -96,7 +96,7 @@ foreach_with_prefix first $methods {
     }
 }
 
-lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
+lassign [remote_exec host "sh -c" [quote_for_host rm $cache_dir/*.gdb-index]] ret
 if { $ret != 0 && $expecting_index_cache_use } {
     fail "couldn't remove files in temporary cache dir"
     return