aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/fileio.c
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2014-06-04 14:37:34 +0800
committerHui Zhu <teawater@gmail.com>2014-06-04 14:38:16 +0800
commit9f5a4cef68413e211bc765e969bf6778150231db (patch)
tree7d4225a2cfa4130213188cb205335c723eacf2c7 /gdb/testsuite/gdb.base/fileio.c
parent90a45c4d5f59bf512cc101802fbfb430f7e9248f (diff)
downloadgdb-9f5a4cef68413e211bc765e969bf6778150231db.zip
gdb-9f5a4cef68413e211bc765e969bf6778150231db.tar.gz
gdb-9f5a4cef68413e211bc765e969bf6778150231db.tar.bz2
Add system test before "set remote system-call-allowed 1" to fileio.exp
This patch is update version according to the discussion in https://www.sourceware.org/ml/gdb-patches/2009-11/msg00090.html. If test get the target doesn't support fileio system according to the remote log. It will set this test as "unsupported". Before I made this patch, I want add a check before all of tests in this file. But I found that the target maybe support one call but not others. For example: my target support Fwrite, Fopen and so on. But not Fgettimeofday. And it doesn't support Fsystem NULL but it support Fsystem not NULL. So I think if we want to check target support fileio, we need check them one by one. 2014-06-04 Nathan Sidwell <nathan@codesourcery.com> Hui Zhu <hui@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.
Diffstat (limited to 'gdb/testsuite/gdb.base/fileio.c')
-rw-r--r--gdb/testsuite/gdb.base/fileio.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index 4926c05..b8c2698 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -55,7 +55,11 @@ time(time_t *t);
Not applicable.
system (const char * string);
-1) Invalid string/command. - returns 127. */
+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);
/* Note that OUTDIR is defined by the test suite. */
@@ -375,21 +379,27 @@ test_system ()
*/
int ret;
- /* Test for shell */
+ /* Test for shell ('set remote system-call-allowed' is disabled
+ by default). */
+ 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 1: ret = %d %s\n", ret, ret != 0 ? "OK" : "");
+ 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 %s/%s", OUTDIR, TESTSUBDIR, OUTDIR, TESTDIR2);
ret = system (sys);
if (ret == 127)
- printf ("system 2: ret = %d /bin/sh unavailable???\n", ret);
+ printf ("system 3: ret = %d /bin/sh unavailable???\n", ret);
else
- printf ("system 2: ret = %d %s\n", ret, ret == 0 ? "OK" : "");
+ printf ("system 3: 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" : "");
+ printf ("system 4: ret = %d %s\n", ret,
+ WEXITSTATUS (ret) == 127 ? "OK" : "");
stop ();
}