From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH 1/2] testsuite: Fix save-trace.exp writing outside standard output directory
Date: Mon, 15 Feb 2016 20:24:00 -0000 [thread overview]
Message-ID: <1455567851-2130-1-git-send-email-simon.marchi@ericsson.com> (raw)
In save-trace.exp, we want to test loading of a tracepoint definition
file with a relative path (I am not sure why in fact). We currently use
"savetrace-relative.tr", which ends up directly in testsuite/. If we
use [standard_output_file] on that path, it becomes absolute. I decided
to just replace [pwd] with . (a dot) in the path given by
standard_output_file to make it relative. However, this trick only
works because [pwd] is a prefix of the standard output directory. So I
added a check to verify that precondition.
gdb/testsuite/ChangeLog:
* gdb.trace/save-trace.exp: Change relative path to be in the
standard output directory.
---
gdb/testsuite/gdb.trace/save-trace.exp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp
index 7c897bb..3819034 100644
--- a/gdb/testsuite/gdb.trace/save-trace.exp
+++ b/gdb/testsuite/gdb.trace/save-trace.exp
@@ -151,7 +151,18 @@ proc do_save_load_test { save_path } {
gdb_verify_tracepoints "verify trace setup"
with_test_prefix "relative" {
- do_save_load_test "savetrace-relative.tr"
+ set filepath [standard_output_file "savetrace-relative.tr"]
+
+ # This only work because the pwd is a prefix of the standard output
+ # directory. If this assumption becomes false, then this test needs to be
+ # changed (the relative path from [pwd] to the standard output directory
+ # will become a bit more complicated to compute).
+ if {[string first [pwd] $filepath] != 0} {
+ error "[pwd] is not a prefix of $filepath."
+ }
+
+ set filepath [string map "[pwd] ." $filepath]
+ do_save_load_test "$filepath"
}
with_test_prefix "absolute" {
--
2.5.1
next reply other threads:[~2016-02-15 20:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 20:24 Simon Marchi [this message]
2016-02-15 20:24 ` [PATCH 2/2] testsuite: Make standard_temp_file use invocation-specific directories Simon Marchi
2016-02-15 23:46 ` Pedro Alves
2016-02-15 23:45 ` [PATCH 1/2] testsuite: Fix save-trace.exp writing outside standard output directory Pedro Alves
2016-02-16 14:02 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455567851-2130-1-git-send-email-simon.marchi@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox