From: Nathan Sidwell <nathan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: fileio test
Date: Thu, 05 Nov 2009 18:04:00 -0000 [thread overview]
Message-ID: <4AF313A2.3000907@codesourcery.com> (raw)
[-- 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 \
next reply other threads:[~2009-11-05 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-05 18:04 Nathan Sidwell [this message]
2009-11-09 20:14 ` Daniel Jacobowitz
2009-11-10 10:55 ` Nathan Sidwell
2009-11-10 19:12 ` Daniel Jacobowitz
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=4AF313A2.3000907@codesourcery.com \
--to=nathan@codesourcery.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