From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29338 invoked by alias); 18 Aug 2004 13:03:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29316 invoked from network); 18 Aug 2004 13:03:29 -0000 Received: from unknown (HELO thoth.sbs.de) (192.35.17.2) by sourceware.org with SMTP; 18 Aug 2004 13:03:29 -0000 Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.12.6/8.12.6) with ESMTP id i7ID3Tso028253 for ; Wed, 18 Aug 2004 15:03:29 +0200 Received: from burundai.radix50.net ([139.23.189.176]) by mail1.siemens.de (8.12.6/8.12.6) with ESMTP id i7ID3SxA031346 for ; Wed, 18 Aug 2004 15:03:28 +0200 Received: from burundai.radix50.net (localhost [127.0.0.1]) by burundai.radix50.net (8.12.3/8.12.3/Debian -4) with ESMTP id i7ID6Rcm014606 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Wed, 18 Aug 2004 15:06:27 +0200 Received: (from ibr@localhost) by burundai.radix50.net (8.12.3/8.12.3/Debian -4) id i7ID6Rvk014605 for gdb-patches@sources.redhat.com; Wed, 18 Aug 2004 15:06:27 +0200 Date: Wed, 18 Aug 2004 13:03:00 -0000 From: Baurzhan Ismagulov To: gdb-patches@sources.redhat.com Subject: Re: testcase for "absolute source" patch Message-ID: <20040818130626.GB1411@ata.cs.hun.edu.tr> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040816144349.GB1509@ata.cs.hun.edu.tr> <412107B7.nailE7I1XJVIH@mindspring.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <412107B7.nailE7I1XJVIH@mindspring.com> User-Agent: Mutt/1.5.6+20040523i X-SW-Source: 2004-08/txt/msg00553.txt.bz2 --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1120 Hello, Michael! Attached is the new version. I've got a couple of questions: 1. Just for my knowledge: I've found the "int main" requirement in C99 5.1.2.2.1. But I couldn't find anything about function definitions without a return type defaulting to int (i.e., should the compiler treat the return type as int if it isn't specified?). Does C99 and previous standards say anything about that? Is it different for declarations and definitions? 2. As far as I could see, remote_exec host starts a new shell each time. How should one do the following right? remote_exec host cd ... remote_exec host gdb_compile ... remote_exec host cd ... I'm reluctant to write scripts since I have to do the same with gdb_test, too. Changes: * Remove the obsolete e-mail address. * Add partial build != host support. * Add comments before each proc. * Fix indentation. * Check for errors on system calls. * Remove excessive quoting. * Name the variables better. * Save openp.c as a file. * Make openp.c ANSI-compliant. * Drop removing the test directory hierarchy. With kind regards, Baurjan. --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="openp.exp" Content-length: 14454 # Copyright (C) 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This file was written by Baurjan Ismagulov . # $Id: openp.exp,v 1.4 2004/08/18 12:45:58 ibr Exp $ # This file tests whether gdb finds the files properly given the # following file names: # 1. basename: file # 2. absolute: /dir/file # 3. relative: dir/file # 4. in current: ./file # 5. in upper: ../file # Called in case of error. proc handle_error {msg} { perror $msg } # Resolve possibe /./ and /../ within the given path. We are paranoid # about cases like "mkdir -p a/../b" (although GNU coreutils and Solaris # 8 seem to handle this particular case). # XXX: Can this be replaced with tcl path manipulation routines? proc canonize_path {dir} { set old_dir [pwd] cd $dir set new_dir [pwd] cd $old_dir return $new_dir } # Compile $src to $bin in $cdir. # XXX: build == host. proc cdir_compile {cdir src bin} { if [catch {set old_dir [pwd]} msg] { handle_error $msg } if [catch {cd $cdir} msg] { handle_error $msg } if {[gdb_compile $src $bin executable debug] != ""} { gdb_suppress_entire_file "Testcase compile failed." } if [catch {cd $old_dir} msg] { handle_error $msg } } # Move the binary to $bin_dir, add $path_dir to PATH, gdb_test in the # $gdb_wd directory. # XXX: build == host. proc test_bin {gdb_wd bin_dir path_dir gdb_test_cmd gdb_resp txt} { global binname global binfile global env if {$bin_dir != ""} { remote_exec host "mv $binfile $bin_dir" } if {$path_dir != "" && [info exists env(PATH)]} { if [catch {set old_path $env(PATH)} msg] { handle_error $msg } # XXX: Directory separator in PATH? if [catch {set env(PATH) $env(PATH):$path_dir} msg] { handle_error $msg } } if [catch {set old_dir [pwd]} msg] { handle_error $msg } if [catch {cd $gdb_wd} msg] { handle_error $msg } gdb_start gdb_test $gdb_test_cmd $gdb_resp $txt gdb_exit if [catch {cd $old_dir} msg] { handle_error $msg } if [info exists old_path] { if [catch {set env(PATH) $old_path} msg] { handle_error $msg } } if {$bin_dir != ""} { remote_exec host "mv $bin_dir/$binname $binfile" } } # Compile in $comp_dir, move the source to $srcfile_dir, perform $cmd1 # and $cmd2, gdb_test in gdb_wd. # XXX: build == host. proc test_src {comp_dir comp_srcfile comp_binfile srcfile_dir gdb_wd cmd1 cmd2 gdb_test_cmd gdb_resp txt} { global srcname; global srcfile; if [catch {set old_dir [pwd]} msg] { handle_error $msg } cdir_compile $comp_dir $comp_srcfile $comp_binfile if {$srcfile_dir != ""} { remote_exec host "mv $srcfile $srcfile_dir" } if [catch {cd $gdb_wd} msg] { handle_error $msg } gdb_start if {$cmd1 != ""} { gdb_test $cmd1 "" } if {$cmd2 != ""} { gdb_test $cmd2 "" } gdb_test $gdb_test_cmd $gdb_resp $txt gdb_exit if [catch {cd $old_dir} msg] { handle_error $msg } if {$srcfile_dir != ""} { remote_exec host "mv $srcfile_dir/$srcname $srcfile" } } if $tracelevel then { strace $tracelevel } set prms_id 0 set bug_id 0 set testname "openp" set srcname $testname.c set binname $testname.bin set testtmpdir [canonize_path $objdir/$subdir]/$testname set srcfile $testtmpdir/subdir/src/$srcname set binfile $testtmpdir/subdir/bin/$binname set src_txt {1.int main\(\){return 0;}.*} remote_exec host "mkdir -p $testtmpdir/subdir/src/subdir" remote_exec host "mkdir -p $testtmpdir/subdir/bin/subdir" remote_exec host "mkdir -p $testtmpdir/subdir/cwd/bin" remote_exec host "mkdir -p $testtmpdir/subdir/cwd/src" remote_exec host "mkdir -p $testtmpdir/subdir/dir$testtmpdir/subdir/src/subdir" remote_exec host "mkdir -p $testtmpdir/subdir/dir$testtmpdir/subdir/bin" remote_exec host "mkdir -p $testtmpdir/subdir/dir/src" remote_exec host "mv $objdir/$subdir/$testname.c $srcfile" cdir_compile $testtmpdir $srcfile $binfile # b1+ test_bin $testtmpdir/subdir/bin \ "" \ "" \ "file $binname" \ "Reading symbols from $binfile\\.\\.\\.done\\..*" \ "openp b1+ (existing binary, basename)" # b1- test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir/bin \ "file $binname" \ "Reading symbols from $binfile\\.\\.\\..*done\\..*" \ "openp b1- (non-existent binary, basename, find in PATH)" # b2+ test_bin $testtmpdir/subdir/cwd \ "" \ "" \ "file $binfile" \ "Reading symbols from $binfile\\.\\.\\.done\\..*" \ "openp b2+ (existing binary, absolute name)" # b2-a # XXX: Should we match locale-specific messages? test_bin $testtmpdir/subdir/cwd \ $testtmpdir/subdir/dir$testtmpdir/subdir/bin \ $testtmpdir/subdir/dir \ "file $binfile" \ "$binfile: .*" \ "openp b2-a (non-existent binary, absolute name, don't look in /absolute)" # b2- # XXX: Should we match locale-specific messages? test_bin $testtmpdir/subdir/cwd \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/dir \ "file $binfile" \ "$binfile: .*" \ "openp b2- (non-existent binary, absolute name, don't look for /basename)" # b3+ test_bin $testtmpdir/subdir \ "" \ "" \ "file bin/$binname" \ "Reading symbols from $binfile\\.\\.\\.done\\..*" \ "openp b3+ (existing binary, relative name)" # b3-r # XXX: locale test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir \ "file bin/$binname" \ "bin/$binname: .*" \ "openp b3-r (non-existent binary, relative name, don't look in /relative)" # b3- # XXX: locale test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir/bin \ "file bin/$binname" \ "bin/$binname: .*" \ "openp b3- (non-existent binary, relative name, don't look in /basename)" # b4+ test_bin $testtmpdir/subdir/bin \ "" \ "" \ "file ./$binname" \ "Reading symbols from $binfile\\.\\.\\.done\\..*" \ "openp b4+ (existing binary, in the current dir)" # b4- # XXX: locale test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir/bin \ "file ./$binname" \ "\\./$binname: .*" \ "openp b4- (non-existent binary, in the current dir, don't look in PATH)" # b5+ test_bin $testtmpdir/subdir/bin/subdir \ "" \ "" \ "file ../$binname" \ "Reading symbols from $binfile\\.\\.\\.done\\..*" \ "openp b5+ (existing binary, in the upper dir)" # b5-r # XXX: locale test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir/bin/subdir \ "file ../$binname" \ "\\.\\./$binname: .*" \ "openp b5-r (non-existent binary, in the upper dir name, don't look in /relative)" # b5- # XXX: locale test_bin $testtmpdir/subdir/cwd \ "" \ $testtmpdir/subdir/bin \ "file ../$binname" \ "\\.\\./$binname: .*" \ "openp b5- (non-existent binary, in the upper dir name, don't look in /basename)" # s1+ test_src $testtmpdir/subdir/src $srcname $binfile \ "" \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s1+ (existing source, basename)" # s1-. test_src $testtmpdir/subdir/src $srcname $binfile \ $testtmpdir/subdir/cwd \ $testtmpdir/subdir/cwd \ "file $binfile" ""\ "l main" \ $src_txt \ "openp s1-. (non-existent source, basename, find in \$cwd/basename)" # s1-da test_src $testtmpdir/subdir/src $srcname $binfile \ $testtmpdir/subdir/dir$testtmpdir/subdir/src \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s1-da (non-existent source, basename, find in /\$cdir/basename)" # s1-d test_src $testtmpdir/subdir/src $srcname $binfile \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s1-d (non-existent source, basename, find in /basename)" # s2+ test_src $testtmpdir $srcfile $binfile \ "" \ $testtmpdir/subdir/cwd \ "file $binfile" ""\ "l main" \ $src_txt \ "openp s2+ (existing source, absolute name)" # s2-. test_src $testtmpdir $srcfile $binfile \ $testtmpdir/subdir/cwd \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s2-. (non-existent source, absolute name, find in \$cwd/basename)" # s2-da test_src $testtmpdir $srcfile $binfile \ $testtmpdir/subdir/dir$testtmpdir/subdir/src \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s2-da (non-existent source, absolute name, find in /absolute)" # s2-d test_src $testtmpdir $srcfile $binfile \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s2-d (non-existent source, absolute name, find in /basename)" # s3+ test_src $testtmpdir/subdir src/$srcname $binfile \ "" \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s3+ (existing source, relative name)" # s3-.r test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir/cwd/src \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s3-.r (non-existent source, relative name, find in \$cwd/relative)" # s3-c test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s3-c (non-existent source, relative name, find in \$cdir/basename)" # s3-. test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir/cwd \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s3-. (non-existent source, relative name, find in \$cwd/basename)" # s3-da test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir/dir$testtmpdir/subdir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s3-da (non-existent source, relative name, find in /\$cdir/relative)" # s3-dr test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir/dir/src \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s3-dr (non-existent source, relative name, find in /relative)" # s3-d test_src $testtmpdir/subdir src/$srcname $binfile \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s3-d (non-existent source, relative name, find in /basename)" # s4+ test_src $testtmpdir/subdir/src ./$srcname $binfile \ "" \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s4+ (existing source, in the current dir)" # s4-. test_src $testtmpdir/subdir/src ./$srcname $binfile \ $testtmpdir/subdir/cwd \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s4-. (non-existent source, in the current dir, find in \$cwd/basename)" # s4-da test_src $testtmpdir/subdir/src ./$srcname $binfile \ $testtmpdir/subdir/dir$testtmpdir/subdir/src \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s4-da (non-existent source, in the current dir, find in /\$cdir/basename)" # s4-d test_src $testtmpdir/subdir/src ./$srcname $binfile \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s4-d (non-existent source, in the current dir, find in /basename)" # s5+ test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ "" \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s5+ (existing source, in the upper dir)" # s5-.r test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s5-.r (non-existent source, in the upper dir, find in \$cwd/relative)" # s5-c test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir/src/subdir \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s5-c (non-existent source, in the upper dir, find in \$cdir/basename)" # s5-. test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir/cwd \ $testtmpdir/subdir/cwd \ "file $binfile" "" \ "l main" \ $src_txt \ "openp s5-. (non-existent source, in the upper dir, find in \$cdir/basename)" # s5-da test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir/dir$testtmpdir/subdir/src/subdir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s5-da (non-existent source, in the upper dir, find in /\$cdir/relative)" # s5-dr test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s5-dr (non-existent source, in the upper dir, find in /relative)" # s5-d test_src $testtmpdir/subdir/src/subdir ../$srcname $binfile \ $testtmpdir/subdir/dir \ $testtmpdir/subdir/cwd \ "dir $testtmpdir/subdir/dir" "file $binfile" \ "l main" \ $src_txt \ "openp s5-d (non-existent source, in the upper dir, find in /basename)" remote_exec host "mv $srcfile $objdir/$subdir" --8t9RHnE3ZwKMSgU+ Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="openp.c" Content-length: 22 int main(){return 0;} --8t9RHnE3ZwKMSgU+--