* [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable
@ 2001-05-18 16:59 Kevin Buettner
2001-05-23 17:35 ` Fernando Nasser
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2001-05-18 16:59 UTC (permalink / raw)
To: gdb-patches
I have a ~/.inputrc file whose settings ("set editing-mode vi") are
causing failures when running the gdb.base/completion.exp tests. These
are the failures that I'm seeing:
FAIL: gdb.base/completion.exp: (timeout) complete 'p' 1
FAIL: gdb.base/completion.exp: (timeout) complete 'p ' 2
FAIL: gdb.base/completion.exp: (timeout) complete 'info t foo'
FAIL: gdb.base/completion.exp: (timeout) complete 'info t'
FAIL: gdb.base/completion.exp: (timeout) complete 'info t '
FAIL: gdb.base/completion.exp: (timeout) complete 'info asdfgh'
FAIL: gdb.base/completion.exp: (timeout) complete 'info asdfgh '
FAIL: gdb.base/completion.exp: (timeout) complete 'info'
FAIL: gdb.base/completion.exp: (timeout) complete 'info '
FAIL: gdb.base/completion.exp: (timeout) complete (2) 'info '
FAIL: gdb.base/completion.exp: (timeout) complete 'p "a'
FAIL: gdb.base/completion.exp: (timeout) complete 'p 'a'
FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p 'a'
FAIL: gdb.base/completion.exp: (timeout) complete 'p b-a'
FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p b-a'
FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p b-'
FAIL: gdb.base/completion.exp: (timeout) complete 'file Make'
FAIL: gdb.base/completion.exp: (timeout) complete 'file gdb.base/compl'
FAIL: gdb.base/completion.exp: (timeout) complete 'info func mar'
FAIL: gdb.base/completion.exp: (timeout) complete 'set follow-fork-mode'
In order to solve this problem, it seems to me that we want to use the
default editing mode, keybindings, and readline settings. This means
that simply making sure that GDB is in emacs mode won't be sufficient
since an inputrc file could have changed another critical setting
which could also cause testsuite failures. E.g, I think that changing
any of bell-style, disable-completion, or show-all-if-ambiguous from
the default setting would change GDB's behavior enough to cause
failures in completion.exp.
Since the presence of an INPUTRC environment variable overrides the a
possible ~/.inputrc, it seems sufficient to set this variable to a
value which will guarantee that the default settings are used. I
chose to use /dev/null; if it exists, it contains nothing thus causing
all of the defaults to be used. If it doesn't exist or can't be
opened for some other reason, failure to open the file will also cause
the defaults to be used.
Okay to commit?
* gdb.base/completion.exp (INPUTRC): Set this environment variable
to a known value in order to get consistent results regardless
of the setting of INPUTRC or the presence or contents of .inputrc.
Index: testsuite/gdb.base/completion.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
retrieving revision 1.3
diff -u -p -r1.3 completion.exp
--- completion.exp 2001/05/11 19:53:38 1.3
+++ completion.exp 2001/05/18 23:04:10
@@ -72,6 +72,16 @@ if [get_compiler_info ${binfile}] {
}
gdb_exit
+
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
+# the test results. Even if /dev/null doesn't exist on the particular
+# platform, the readline library will use the default setting just by
+# failing to open the file. OTOH, opening /dev/null successfully will
+# also result in the default settings being used since nothing will be
+# read from this file.
+global env
+set env(INPUTRC) "/dev/null"
+
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable
2001-05-18 16:59 [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable Kevin Buettner
@ 2001-05-23 17:35 ` Fernando Nasser
2001-05-29 20:22 ` Kevin Buettner
0 siblings, 1 reply; 4+ messages in thread
From: Fernando Nasser @ 2001-05-23 17:35 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Wow! Nice catch! Thanks!
But we need to make sure tests do not interfere with others. So, what
we always do (I hope) when changing globals inside the scope of a test
is to save the global value, set to whatever the test wants it to be,
change it back at the end. In this case, you can test if the element
INPUTRC of the global array "env" exists and, if it does, save it's
previous value.
However, I can't think of anything else wanting to set or being
influenced by INPUTRC, so maybe we can be lazy this time and just check
your patch as is -- better add a FIXME or a NOTE to this fact at least.
If you feel confident that this is so, please go ahead and check it in.
Regards,
Fernando
Kevin Buettner wrote:
>
> I have a ~/.inputrc file whose settings ("set editing-mode vi") are
> causing failures when running the gdb.base/completion.exp tests. These
> are the failures that I'm seeing:
>
> FAIL: gdb.base/completion.exp: (timeout) complete 'p' 1
> FAIL: gdb.base/completion.exp: (timeout) complete 'p ' 2
> FAIL: gdb.base/completion.exp: (timeout) complete 'info t foo'
> FAIL: gdb.base/completion.exp: (timeout) complete 'info t'
> FAIL: gdb.base/completion.exp: (timeout) complete 'info t '
> FAIL: gdb.base/completion.exp: (timeout) complete 'info asdfgh'
> FAIL: gdb.base/completion.exp: (timeout) complete 'info asdfgh '
> FAIL: gdb.base/completion.exp: (timeout) complete 'info'
> FAIL: gdb.base/completion.exp: (timeout) complete 'info '
> FAIL: gdb.base/completion.exp: (timeout) complete (2) 'info '
> FAIL: gdb.base/completion.exp: (timeout) complete 'p "a'
> FAIL: gdb.base/completion.exp: (timeout) complete 'p 'a'
> FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p 'a'
> FAIL: gdb.base/completion.exp: (timeout) complete 'p b-a'
> FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p b-a'
> FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p b-'
> FAIL: gdb.base/completion.exp: (timeout) complete 'file Make'
> FAIL: gdb.base/completion.exp: (timeout) complete 'file gdb.base/compl'
> FAIL: gdb.base/completion.exp: (timeout) complete 'info func mar'
> FAIL: gdb.base/completion.exp: (timeout) complete 'set follow-fork-mode'
>
> In order to solve this problem, it seems to me that we want to use the
> default editing mode, keybindings, and readline settings. This means
> that simply making sure that GDB is in emacs mode won't be sufficient
> since an inputrc file could have changed another critical setting
> which could also cause testsuite failures. E.g, I think that changing
> any of bell-style, disable-completion, or show-all-if-ambiguous from
> the default setting would change GDB's behavior enough to cause
> failures in completion.exp.
>
> Since the presence of an INPUTRC environment variable overrides the a
> possible ~/.inputrc, it seems sufficient to set this variable to a
> value which will guarantee that the default settings are used. I
> chose to use /dev/null; if it exists, it contains nothing thus causing
> all of the defaults to be used. If it doesn't exist or can't be
> opened for some other reason, failure to open the file will also cause
> the defaults to be used.
>
> Okay to commit?
>
> * gdb.base/completion.exp (INPUTRC): Set this environment variable
> to a known value in order to get consistent results regardless
> of the setting of INPUTRC or the presence or contents of .inputrc.
>
> Index: testsuite/gdb.base/completion.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
> retrieving revision 1.3
> diff -u -p -r1.3 completion.exp
> --- completion.exp 2001/05/11 19:53:38 1.3
> +++ completion.exp 2001/05/18 23:04:10
> @@ -72,6 +72,16 @@ if [get_compiler_info ${binfile}] {
> }
>
> gdb_exit
> +
> +# Don't let a .inputrc file or an existing setting of INPUTRC mess up
> +# the test results. Even if /dev/null doesn't exist on the particular
> +# platform, the readline library will use the default setting just by
> +# failing to open the file. OTOH, opening /dev/null successfully will
> +# also result in the default settings being used since nothing will be
> +# read from this file.
> +global env
> +set env(INPUTRC) "/dev/null"
> +
> gdb_start
> gdb_reinitialize_dir $srcdir/$subdir
> gdb_load ${binfile}
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable
2001-05-23 17:35 ` Fernando Nasser
@ 2001-05-29 20:22 ` Kevin Buettner
2001-05-30 5:17 ` Fernando Nasser
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2001-05-29 20:22 UTC (permalink / raw)
To: Fernando Nasser; +Cc: gdb-patches
On May 23, 8:32pm, Fernando Nasser wrote:
> But we need to make sure tests do not interfere with others. So, what
> we always do (I hope) when changing globals inside the scope of a test
> is to save the global value, set to whatever the test wants it to be,
> change it back at the end. In this case, you can test if the element
> INPUTRC of the global array "env" exists and, if it does, save it's
> previous value.
>
> However, I can't think of anything else wanting to set or being
> influenced by INPUTRC, so maybe we can be lazy this time and just check
> your patch as is -- better add a FIXME or a NOTE to this fact at least.
> If you feel confident that this is so, please go ahead and check it in.
I do feel confident that nothing else (at the moment) cares about the
value of INPUTRC. However, it seems like a better practice to
save/restore the value of the variable as you've suggested, so that is
what I've done.
I've just committed the patch below. I do not regard myself as a Tcl
expert, so I would appreciate it if someone else would look over this
patch to make sure that I did things properly.
* gdb.base/completion.exp (INPUTRC): Set this environment variable
to a known value in order to get consistent results regardless
of the setting of INPUTRC or the presence or contents of .inputrc.
Index: testsuite/gdb.base/completion.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
retrieving revision 1.3
diff -u -p -r1.3 completion.exp
--- completion.exp 2001/05/11 19:53:38 1.3
+++ completion.exp 2001/05/30 02:50:33
@@ -72,6 +72,19 @@ if [get_compiler_info ${binfile}] {
}
gdb_exit
+
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
+# the test results. Even if /dev/null doesn't exist on the particular
+# platform, the readline library will use the default setting just by
+# failing to open the file. OTOH, opening /dev/null successfully will
+# also result in the default settings being used since nothing will be
+# read from this file.
+global env
+if [info exists env(INPUTRC)] {
+ set old_inputrc $env(INPUTRC)
+}
+set env(INPUTRC) "/dev/null"
+
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
@@ -596,19 +609,12 @@ gdb_expect {
timeout { fail "(timeout) complete 'set follow-fork-mode'" }
}
+# Restore globals modified in this test...
+if [info exists old_inputrc] {
+ set env(INPUTRC) $old_inputrc
+} else {
+ unset env(INPUTRC)
+}
set timeout $oldtimeout1
-return 0
-
-
-
-
-
-
-
-
-
-
-
-
-
+return 0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable
2001-05-29 20:22 ` Kevin Buettner
@ 2001-05-30 5:17 ` Fernando Nasser
0 siblings, 0 replies; 4+ messages in thread
From: Fernando Nasser @ 2001-05-30 5:17 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
That is excellent Kevin.
Thank you very much!
Cheers,
Fernando
Kevin Buettner wrote:
>
> On May 23, 8:32pm, Fernando Nasser wrote:
>
> > But we need to make sure tests do not interfere with others. So, what
> > we always do (I hope) when changing globals inside the scope of a test
> > is to save the global value, set to whatever the test wants it to be,
> > change it back at the end. In this case, you can test if the element
> > INPUTRC of the global array "env" exists and, if it does, save it's
> > previous value.
> >
> > However, I can't think of anything else wanting to set or being
> > influenced by INPUTRC, so maybe we can be lazy this time and just check
> > your patch as is -- better add a FIXME or a NOTE to this fact at least.
> > If you feel confident that this is so, please go ahead and check it in.
>
> I do feel confident that nothing else (at the moment) cares about the
> value of INPUTRC. However, it seems like a better practice to
> save/restore the value of the variable as you've suggested, so that is
> what I've done.
>
> I've just committed the patch below. I do not regard myself as a Tcl
> expert, so I would appreciate it if someone else would look over this
> patch to make sure that I did things properly.
>
> * gdb.base/completion.exp (INPUTRC): Set this environment variable
> to a known value in order to get consistent results regardless
> of the setting of INPUTRC or the presence or contents of .inputrc.
>
> Index: testsuite/gdb.base/completion.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/completion.exp,v
> retrieving revision 1.3
> diff -u -p -r1.3 completion.exp
> --- completion.exp 2001/05/11 19:53:38 1.3
> +++ completion.exp 2001/05/30 02:50:33
> @@ -72,6 +72,19 @@ if [get_compiler_info ${binfile}] {
> }
>
> gdb_exit
> +
> +# Don't let a .inputrc file or an existing setting of INPUTRC mess up
> +# the test results. Even if /dev/null doesn't exist on the particular
> +# platform, the readline library will use the default setting just by
> +# failing to open the file. OTOH, opening /dev/null successfully will
> +# also result in the default settings being used since nothing will be
> +# read from this file.
> +global env
> +if [info exists env(INPUTRC)] {
> + set old_inputrc $env(INPUTRC)
> +}
> +set env(INPUTRC) "/dev/null"
> +
> gdb_start
> gdb_reinitialize_dir $srcdir/$subdir
> gdb_load ${binfile}
> @@ -596,19 +609,12 @@ gdb_expect {
> timeout { fail "(timeout) complete 'set follow-fork-mode'" }
> }
>
> +# Restore globals modified in this test...
> +if [info exists old_inputrc] {
> + set env(INPUTRC) $old_inputrc
> +} else {
> + unset env(INPUTRC)
> +}
> set timeout $oldtimeout1
> -return 0
> -
> -
> -
> -
> -
>
> -
> -
> -
> -
> -
> -
> -
> -
> +return 0
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-05-30 5:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-18 16:59 [PATCH RFA] gdb.base/completion.exp: Set INPUTRC env variable Kevin Buettner
2001-05-23 17:35 ` Fernando Nasser
2001-05-29 20:22 ` Kevin Buettner
2001-05-30 5:17 ` Fernando Nasser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox