From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18372 invoked by alias); 17 Jun 2009 20:17:45 -0000 Received: (qmail 18354 invoked by uid 22791); 17 Jun 2009 20:17:42 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43,J_CHICKENPOX_53,MIME_QP_LONG_LINE X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Jun 2009 20:17:35 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n5HKH56L008425 ; Wed, 17 Jun 2009 22:17:05 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n5HKH5D3079230 ; Wed, 17 Jun 2009 22:17:05 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n5HKH2DM067314 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Wed, 17 Jun 2009 22:17:03 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Eli Zaretskii'" , "'Daniel Jacobowitz'" Cc: , References: <001201c9ebb1$96414b10$c2c3e130$@u-strasbg.fr> <20090613150505.GA28157@caradoc.them.org> <000001c9ec65$9bf13ca0$d3d3b5e0$@u-strasbg.fr> <20090613235454.GA1893@caradoc.them.org> <20090614002516.GO25703@adacore.com> <000001c9ed8a$21cfdc30$656f9490$@u-strasbg.fr> <20090616145756.GB7730@adacore.com> <000c01c9eeda$022d8a70$06889f50$@u-strasbg.fr> <20090617133626.GA24310@caradoc.them.org> In-Reply-To: Subject: RE: [RFC] Improve testsuite for poor expect behavior Date: Wed, 17 Jun 2009 20:17:00 -0000 Message-ID: <000001c9ef88$959e9ac0$c0dbd040$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0001_01C9EF99.59276AC0" 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-06/txt/msg00449.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C9EF99.59276AC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 2725 My way to use cygwin expect for DJGPP is quite ugly, but it gives some results. The basic idea is to consider that djgpp=20 is a remote target and to overload several expect procedures to cope with DJGPP specific=20 features. I added a .dejagnu directory in my cygwin home, with an empty site.exp file and a boards directory. This directory stores several files, but only one concerns DJGPP. I simply called it djgpp.exp and I run the testsuite in=20 djbuild/gdb/testsuite (with a DJGPP compiled gdb.exe at djgpp/gdb level). I an sereral testsuite subsets using make check RUNTESTFLAGS=3D"--target=3Ddjgpp --host_board=3Ddjgpp gdb.*/wa*.= exp" Which means that the same file ($HOME/.dejagnu/boards/djgpp.exp) is used both as host_board and target... as I said it is really ugly, but I didn't have time to sort things out, and I am not sure I will have the willingness to do it... I attached the djpp.exp file. The key functions are djgpp_spawn and djgpp_exec djgpp_exec uses a response file=20 for long commandlines, to overcome the=20 80 chars limitations for Dos command lines. In its present form, it prints out lots of=20 information, send_user can probably be changed to verbose if someone just wants to use it. Eli, tell me if you get a chance to try it out. Pierre > -----Message d'origine----- > De=A0: Eli Zaretskii [mailto:eliz@gnu.org] > Envoy=E9=A0: Wednesday, June 17, 2009 7:17 PM > =C0=A0: 'Daniel Jacobowitz' > Cc=A0: muller@ics.u-strasbg.fr; brobecker@adacore.com; gdb- > patches@sourceware.org > Objet=A0: Re: [RFC] Improve testsuite for poor expect behavior >=20 > > Date: Wed, 17 Jun 2009 09:36:26 -0400 > > From: 'Daniel Jacobowitz' > > Cc: 'Joel Brobecker' , gdb- > patches@sourceware.org > > > > I have not tried this on DJGPP at all. >=20 > You cannot try this with DJGPP, because there are no such APIs in > DJGPP (with the exception of `setmode', which does exist). Also, > there are no pipes in DJGPP. >=20 > I cannot judge what would be needed for DJGPP, since Pierre did not > yet explain how does he run DJGPP with the test suite, nor show any > code that achieves that. All I can say is that DJGPP has the > `setmode' function that can be used to switch a standard handle into > binary mode, and that `isatty' is available to detect whether a handle > is connected to a terminal device. Note that the DJGPP build of GDB > generally does not always use file I/O functions to write to the > terminal; it uses direct screen I/O for some ops. Thus, binary mode > file I/O not necessarily will solve the problem that bothers Pierre, > although I do not yet understand fully whether it is relevant to DJGPP > as it is to MinGW. ------=_NextPart_000_0001_01C9EF99.59276AC0 Content-Type: application/octet-stream; name="djgpp.exp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="djgpp.exp" Content-length: 4982 # djgpp gdb running n cygwin expect.=0A= =0A= # The canonical unix board description.=0A= load_generic_config "unix";=0A= =0A= global env=0A= global EXEEXT=0A= set EXEEXT ".exe"=0A= set env(EXEEXT) ".exe"=0A= set env(DJDIR) e:/djgpp=0A= set env(DJGPP) ${env(DJDIR)}/djgpp.env=0A= set DJGPP_BIN_DIR /cygdrive/e/djgpp/bin=0A= =0A= global CC_FOR_TARGET=0A= global GNATMAKE_FOR_TARGET=0A= =0A= set CC_FOR_TARGET ${DJGPP_BIN_DIR}/gcc.exe=0A= set GNATMAKE_FOR_TARGET ${DJGPP_BIN_DIR}/gnatmake.exe=0A= =0A= =0A= process_multilib_options "";=0A= =0A= set_board_info inputnotfromterminal 1;=0A= =0A= # set_board_info compiler "[find_gcc]";=0A= =0A= # set_board_info bmk,use_alarm 1;=0A= =0A= # set_board_info gdb,noinferiorio 1;=0A= =0A= send_user "configuring for djgpp, board=3D\"$board\" testing inside Cygwin\= n";=0A= =0A= global store_host_board;=0A= =0A= proc disable_host_board {} {=0A= global host_board=0A= global store_host_board=0A= if {[info exists host_board]} {=0A= set store_host_board $host_board;=0A= } else {=0A= set store_host_board "";=0A= }=20=0A= unset host_board;=0A= return 0;=0A= }=0A= =0A= proc reenable_host_board {} {=0A= global host_board=0A= global store_host_board=0A= if {[info exists store_host_board]} {=0A= set host_board $store_host_board;=0A= } else {=0A= unset host_board;=0A= }=20=0A= unset store_host_board;=0A= return 0;=0A= }=0A= =0A= =20=0A= =20=0A= proc djgpp_spawn { board cmd } {=0A= global board_info=0A= global host=0A= =0A= verbose "DJGPP: djgpp_spawn called board=3D\"$board\" cmd=3D\"$cmd\""=0A= set baseboard [lindex [split $board "/"] 0]=0A= =0A= disable_host_board=0A= set board_info($baseboard,isremote) 0=0A= set result [remote_spawn $board $cmd]=0A= set board_info($baseboard,isremote) 1=0A= =0A= reenable_host_board=0A= =0A= return $result=0A= }=0A= =0A= =0A= proc djgpp_exec { hostname prog args } {=0A= global board_info=0A= global host=0A= =0A= verbose "DJGPP: djgpp_exec called hostname=3D\"$hostname\" \=0A= prog=3D\"$prog\" args=3D\"$args\""=0A= disable_host_board=0A= =0A= set args_needed 0;=0A= set largs $args;=0A= verbose "largs=3D\"$largs\""=0A= if { [llength $args] =3D=3D 1 } {=0A= set largs [lindex $args 0]=0A= }=0A= verbose "largs=3D\"$largs\""=0A= for {set i 0 } { $i < [llength $largs] } { incr i } {=0A= verbose "lindex $i is \"[lindex $largs $i]\""=0A= if { [lindex $largs $i] !=3D {} } {=0A= set args_needed 1;=0A= }=0A= }=0A= =0A= set djgpp_res_file "./djgpp.res";=0A= set real_prog "";=0A= if { [ string length "$prog $args"] > 80 } {=0A= send_user "DJGPP: long command line prog=3D\"$prog\" args=3D\"$args\"\n= "=0A= set djgpp_id [open "$djgpp_res_file" "w"]=0A= send_user "DJGPP: Using response file $djgpp_res_file id=3D$djgpp_id\n"= =0A= set n [llength $prog];=0A= if {$n > 1} {=0A= set prog_args [lrange $prog 1 end];=0A= set real_prog [lindex $prog 0];=0A= } else {=0A= set prog_args "";=0A= set real_prog $prog;=0A= }=0A= if {$prog_args !=3D ""} {=0A= puts $djgpp_id "$prog_args"=0A= }=0A= if {$args_needed} {=0A= puts $djgpp_id "$args"=0A= }=0A= close $djgpp_id=0A= }=0A= if {$real_prog !=3D ""} {=0A= set result [remote_exec $hostname "$real_prog" "@$djgpp_res_file"]=0A= } else {=0A= if {$args_needed} {=0A= set result [remote_exec $hostname "$prog" "$args"]=0A= } else {=0A= set result [remote_exec $hostname $prog ""]=0A= }=0A= }=0A= reenable_host_board=0A= return $result=0A= }=0A= =0A= =0A= proc ${board}_download { board host dest } {=0A= verbose "DJGPP: ${board}_download host=3D\"$host\" dest=3D\"$dest\""=0A= disable_host_board=0A= set res [remote_download "$board" "$host" "$dest"]=0A= reenable_host_board=0A= return $res=0A= }=0A= =0A= proc ${board}_file { dest op args } {=0A= verbose "DJGPP: board_file dest=3D\"$dest\" op=3D\"$op\" args=3D\"$args\"= "=0A= if { $op =3D=3D "delete" } {=0A= return 0;=0A= }=0A= return [eval [list standard_file $dest $op] $args]=0A= }=0A= =0A= proc ${board}_upload { target source dest } {=0A= verbose "DJGPP: ${target}_upload source=3D\"$source\" dest=3D\"$dest\""= =0A= disable_host_board=0A= set res [remote_upload $target "$source" "$dest"]=0A= reenable_host_board=0A= return $res=0A= }=0A= =0A= proc transform_gdb_expect { expcode } {=0A= verbose "DJGPP: djgpp_gdb_expect entry expcode=3D\"$expcode\""=0A= set subst1 [regsub -all {\\r+\\n} $expcode {\\r\\n} expcode1]=0A= set subst2 [regsub -all {\\r\\n} $expcode1 {\\r+\\n} expcode2]=0A= verbose "DJGPP: djgpp_gdb_expect returned expcode=3D\"$expcode2\""=0A= if { $subst1 !=3D 0 || $subst2 !=3D 0 } {=0A= send_user "DJGPP: djgpp_gdb_expect substs=3D$subst1 + $subst2\n"=0A= verbose "DJGPP: djgpp_gdb_expect returned expcode=3D\"$expcode2\""=0A= return $expcode2;=0A= }=0A= return $expcode;=0A= }=0A= ------=_NextPart_000_0001_01C9EF99.59276AC0--