From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32386 invoked by alias); 5 Nov 2009 18:04:27 -0000 Received: (qmail 32378 invoked by uid 22791); 5 Nov 2009 18:04:26 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Nov 2009 18:04:21 +0000 Received: (qmail 1880 invoked from network); 5 Nov 2009 18:04:18 -0000 Received: from unknown (HELO ?192.168.44.101?) (nathan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Nov 2009 18:04:18 -0000 Message-ID: <4AF313A2.3000907@codesourcery.com> Date: Thu, 05 Nov 2009 18:04:00 -0000 From: Nathan Sidwell User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: fileio test Content-Type: multipart/mixed; boundary="------------070208030701000009090107" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00090.txt.bz2 This is a multi-part message in MIME format. --------------070208030701000009090107 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 327 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 --------------070208030701000009090107 Content-Type: text/x-patch; name="fileio-test.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fileio-test.patch" Content-length: 4140 2009-11-05 Nathan Sidwell * 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 \ --------------070208030701000009090107--