* fileio test
@ 2009-11-05 18:04 Nathan Sidwell
2009-11-09 20:14 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2009-11-05 18:04 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
This patch fixes an augments the fileio shell test. By default system calls are
disallowed -- but the test expects them to be enabled. This patch fixes that
test and verifies that enabling system calls, does indeed enable them.
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
[-- Attachment #2: fileio-test.patch --]
[-- Type: text/x-patch, Size: 4140 bytes --]
2009-11-05 Nathan Sidwell <nathan@codesourcery.com>
* gdb.base/fileio.exp: Add test for shell not available as well as
available.
* gdb.base/fileio.c (test_system): Check for shell twice.
Index: gdb.base/fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 fileio.c
*** gdb.base/fileio.c 1 Oct 2009 15:39:13 -0000 1.11
--- gdb.base/fileio.c 5 Nov 2009 17:51:19 -0000
*************** time(time_t *t);
*** 55,61 ****
Not applicable.
system (const char * string);
! 1) Invalid string/command. - returns 127. */
static const char *strerrno (int err);
#define FILENAME "foo.fileio.test"
--- 55,65 ----
Not applicable.
system (const char * string);
! 1) See if shell available - returns 0
! 2) See if shell available - returns !0
! 3) Execute simple shell command - returns 0
! 4) Invalid string/command. - returns 127. */
!
static const char *strerrno (int err);
#define FILENAME "foo.fileio.test"
*************** test_system ()
*** 373,393 ****
int ret;
char sys[512];
! /* Test for shell */
ret = system (NULL);
! printf ("system 1: ret = %d %s\n", ret, ret != 0 ? "OK" : "");
stop ();
/* This test prepares the directory for test_rename() */
sprintf (sys, "mkdir -p %s %s", TESTSUBDIR, TESTDIR2);
ret = system (sys);
if (ret == 127)
! printf ("system 2: ret = %d /bin/sh unavailable???\n", ret);
else
! printf ("system 2: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
stop ();
/* Invalid command (just guessing ;-) ) */
ret = system ("wrtzlpfrmpft");
! printf ("system 3: ret = %d %s\n", ret, WEXITSTATUS (ret) == 127 ? "OK" : "");
stop ();
}
--- 377,402 ----
int ret;
char sys[512];
! /* Test for shell (testsuite should have it disabled). */
! ret = system (NULL);
! printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
! stop ();
! /* Test for shell again (the testsuite will have enabled it now). */
ret = system (NULL);
! printf ("system 2: ret = %d %s\n", ret, ret != 0 ? "OK" : "");
stop ();
/* This test prepares the directory for test_rename() */
sprintf (sys, "mkdir -p %s %s", TESTSUBDIR, TESTDIR2);
ret = system (sys);
if (ret == 127)
! printf ("system 3: ret = %d /bin/sh unavailable???\n", ret);
else
! printf ("system 3: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
stop ();
/* Invalid command (just guessing ;-) ) */
ret = system ("wrtzlpfrmpft");
! printf ("system 4: ret = %d %s\n", ret,
! WEXITSTATUS (ret) == 127 ? "OK" : "");
stop ();
}
Index: gdb.base/fileio.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.exp,v
retrieving revision 1.15
diff -c -3 -p -r1.15 fileio.exp
*** gdb.base/fileio.exp 3 Jan 2009 05:58:03 -0000 1.15
--- gdb.base/fileio.exp 5 Nov 2009 17:51:19 -0000
*************** gdb_test continue \
*** 179,194 ****
gdb_test continue \
"Continuing\\..*system 1:.*OK$stop_msg" \
! "System says shell is available"
send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $"
gdb_test continue \
"Continuing\\..*system 2:.*OK$stop_msg" \
"System(3) call"
# Is this ok? POSIX says system returns a waitpid status?
gdb_test continue \
! "Continuing\\..*system 3:.*OK$stop_msg" \
"System with invalid command returns 127"
gdb_test continue \
--- 179,199 ----
gdb_test continue \
"Continuing\\..*system 1:.*OK$stop_msg" \
! "System says shell is not available"
send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $"
+
gdb_test continue \
"Continuing\\..*system 2:.*OK$stop_msg" \
+ "System says shell is available"
+
+ gdb_test continue \
+ "Continuing\\..*system 3:.*OK$stop_msg" \
"System(3) call"
# Is this ok? POSIX says system returns a waitpid status?
gdb_test continue \
! "Continuing\\..*system 4:.*OK$stop_msg" \
"System with invalid command returns 127"
gdb_test continue \
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: fileio test
2009-11-05 18:04 fileio test Nathan Sidwell
@ 2009-11-09 20:14 ` Daniel Jacobowitz
2009-11-10 10:55 ` Nathan Sidwell
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2009-11-09 20:14 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: gdb-patches
On Thu, Nov 05, 2009 at 06:04:18PM +0000, Nathan Sidwell wrote:
> This patch fixes an augments the fileio shell test. By default
> system calls are disallowed -- but the test expects them to be
> enabled. This patch fixes that test and verifies that enabling
> system calls, does indeed enable them.
>
> ok?
What happens when you run this test natively? I believe it will fail
since it uses your host's system () directly. This test doesn't test
just fileio.
(We have a bunch of local XFAILs for this test.)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fileio test
2009-11-09 20:14 ` Daniel Jacobowitz
@ 2009-11-10 10:55 ` Nathan Sidwell
2009-11-10 19:12 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2009-11-10 10:55 UTC (permalink / raw)
To: Nathan Sidwell, gdb-patches
Daniel Jacobowitz wrote:
> On Thu, Nov 05, 2009 at 06:04:18PM +0000, Nathan Sidwell wrote:
>> This patch fixes an augments the fileio shell test. By default
>> system calls are disallowed -- but the test expects them to be
>> enabled. This patch fixes that test and verifies that enabling
>> system calls, does indeed enable them.
>>
>> ok?
>
> What happens when you run this test natively? I believe it will fail
> since it uses your host's system () directly. This test doesn't test
> just fileio.
ah, yes you're right. The current behaviour passes natively because of that.
It's not obvious to me how the testsuite could distinguish between these two
cases. remote-fileio.c doesn't have any verbose logging we could turn on (and
have the testsuite watch for it). I suppose we could add it. Or we could turn
on remote-protocol logging and watch for that (which seems less desirable).
Thoughts?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fileio test
2009-11-10 10:55 ` Nathan Sidwell
@ 2009-11-10 19:12 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2009-11-10 19:12 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: gdb-patches
On Tue, Nov 10, 2009 at 10:55:16AM +0000, Nathan Sidwell wrote:
> It's not obvious to me how the testsuite could distinguish between
> these two cases. remote-fileio.c doesn't have any verbose logging we
> could turn on (and have the testsuite watch for it). I suppose we
> could add it. Or we could turn on remote-protocol logging and watch
> for that (which seems less desirable).
>
> Thoughts?
I'm not sure either. I like the idea of adding logging to
remote-fileio.c; we could use that to disable the test if not using
semihosting. (Although that risks turning this to UNSUPPORTED if
semihosting is completely broken...)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-10 19:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05 18:04 fileio test Nathan Sidwell
2009-11-09 20:14 ` Daniel Jacobowitz
2009-11-10 10:55 ` Nathan Sidwell
2009-11-10 19:12 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox