Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Baurzhan Ismagulov <baurzhan.ismagulov@sbs.com.tr>
To: gdb-patches@sources.redhat.com
Subject: testcase for "absolute source" patch
Date: Mon, 16 Aug 2004 14:41:00 -0000	[thread overview]
Message-ID: <20040816144349.GB1509@ata.cs.hun.edu.tr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

Hello,

Here is the test file for the patch described in
http://sources.redhat.com/ml/gdb-patches/2004-04/msg00463.html .

The patch fixes the case s2-da -- the source was compiled using absolute
name and is not available at that location any more; gdb should be able
to find it in the same directory relative to a directory mentioned in
the argument for the "directory" command (see the link above for a
typescript). This used to work in 5.3 but was broken when fixing the
case b4- -- the binary is specified as dot-slash-basename but does not
exist in the current directory; gdb should not look for it in PATH (see
http://sources.redhat.com/ml/gdb/2004-01/msg00244.html for an example).

I am not sure what we want to do in cases s1-da, s3-da, s4-da and s5-da
(the source was compiled using a non-absolute name; should gdb look for
them under <source path>/$cdir, where <source path> is one of the
arguments to the "directory" command?), so I describe the present
behaviour as FAIL for now.

The file was tested on gdb 6.2 under Debian unstable. I would welcome
any comments about the test and suggestions about the mentioned cases.

With kind regards,
Baurjan.

[-- Attachment #2: openp.exp --]
[-- Type: text/plain, Size: 11997 bytes --]

#   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.  

# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu

# This file was written by Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>.
# $Id: openp.exp,v 1.2 2004/08/16 13:57:54 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

# XXX: We assume that build == host.

proc canonize_path {dir} {
	set tmp [pwd]
	cd ${dir}
	set new [pwd]
	cd ${tmp}
	return ${new}
}

proc cdir_compile {cdir src bin} {
	set tmp [pwd]
	cd ${cdir}
	if {[gdb_compile "${src}" "${bin}" executable \
			 {debug additional_flags=-w}] != ""} {
		gdb_suppress_entire_file "Testcase compile failed."
	}
	cd ${tmp}
}

proc test_bin {gdb_wd gdb_test_cmd gdb_resp txt} {
	set tmp [pwd]
	cd ${gdb_wd}
	gdb_start
	gdb_test ${gdb_test_cmd} ${gdb_resp} ${txt}
	gdb_exit
	cd ${tmp}
}

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;

	set tmp [pwd]
	cdir_compile ${comp_dir} ${comp_srcfile} ${comp_binfile}
	if {${srcfile_dir} != ""} {
		system "mv ${srcfile} ${srcfile_dir}"
	}
	cd ${gdb_wd}
	gdb_start
	if {${cmd1} != ""} {
		gdb_test ${cmd1} ""
	}
	if {${cmd2} != ""} {
		gdb_test ${cmd2} ""
	}
	gdb_test ${gdb_test_cmd} ${gdb_resp} ${txt}
	gdb_exit
	cd ${tmp}
	if {${srcfile_dir} != ""} {
		system "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}

system "mkdir -p ${testtmpdir}/subdir/src/subdir"
system "mkdir -p ${testtmpdir}/subdir/bin/subdir"
system "mkdir -p ${testtmpdir}/subdir/cwd/src"
system "mkdir -p ${testtmpdir}/subdir/dir${testtmpdir}/subdir/src/subdir"
system "mkdir -p ${testtmpdir}/subdir/dir/src"
system "echo \"main(){}\" >${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-
# XXX: Don't know how to modify the PATH in order to test with our
#      sample. Have to assume that:
#      * ls exists, is executable and is in PATH;
#      * there is no ls binary in the current dir.
test_bin ${testtmpdir}/subdir/cwd \
	 "file ls" \
	 "Reading symbols from [which ls]\\.\\.\\..*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-
# XXX: Should we match locale-specific messages?
test_bin ${testtmpdir}/subdir/cwd \
	 "file ${testtmpdir}/subdir/bin/ls" \
	 "${testtmpdir}/subdir/bin/ls: .*" \
	 "openp b2- (non-existent binary, absolute name, don't look in PATH)"

# b3+
test_bin ${testtmpdir}/subdir \
	 "file bin/${binname}" \
	 "Reading symbols from ${binfile}\\.\\.\\.done\\..*" \
	 "openp b3+ (existing binary, relative name)"

# b3-
# XXX: locale
test_bin ${testtmpdir}/subdir \
	 "file bin/ls" \
	 "bin/ls: .*" \
	 "openp b3- (non-existent binary, relative name, don't look in PATH)"

# 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/bin \
	 "file ./ls" \
	 "\\./ls: .*" \
	 "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-
# XXX: locale
test_bin ${testtmpdir}/subdir/bin/subdir \
	 "file ../ls" \
	 "\\.\\./ls: .*" \
	 "openp b5- (non-existent binary, in the upper dir name, don't look in PATH)"


# s1+
test_src ${testtmpdir}/subdir/src ${srcname} ${binfile} \
	 "" \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" "" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "openp s1+ (existing source, basename)"

# s1-.
test_src ${testtmpdir}/subdir/src ${srcname} ${binfile} \
	 ${testtmpdir}/subdir/cwd \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" ""\
	 "l main" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "openp s1-da (non-existent source, basename, find in <dir>/\$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" \
	 {1.main\(\){}.*} \
	 "openp s1-d (non-existent source, basename, find in <dir>/basename)"

# s2+
test_src ${testtmpdir} ${srcfile} ${binfile} \
	 "" \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" ""\
	 "l main" \
	 {1.main\(\){}.*} \
	 "openp s2+ (existing source, absolute name)"

# s2-.
test_src ${testtmpdir} ${srcfile} ${binfile} \
	 ${testtmpdir}/subdir/cwd \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" "" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "openp s2-da (non-existent source, absolute name, find in <dir>/absolute)"

# s2-d
test_src ${testtmpdir} ${srcfile} ${binfile} \
	 ${testtmpdir}/subdir/dir \
	 ${testtmpdir}/subdir/cwd \
	 "dir ${testtmpdir}/subdir/dir" "file ${binfile}" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "openp s2-d (non-existent source, absolute name, find in <dir>/basename)"

# s3+
test_src ${testtmpdir}/subdir src/${srcname} ${binfile} \
	 "" \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" "" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "openp s3-da (non-existent source, relative name, find in <dir>/\$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" \
	 {1.main\(\){}.*} \
	 "openp s3-dr (non-existent source, relative name, find in <dir>/relative)"

# s3-d
test_src ${testtmpdir}/subdir src/${srcname} ${binfile} \
	 ${testtmpdir}/subdir/dir \
	 ${testtmpdir}/subdir/cwd \
	 "dir ${testtmpdir}/subdir/dir" "file ${binfile}" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "openp s3-d (non-existent source, relative name, find in <dir>/basename)"

# s4+
test_src ${testtmpdir}/subdir/src ./${srcname} ${binfile} \
	 "" \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" "" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "openp s4-da (non-existent source, in the current dir, find in <dir>/\$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" \
	 {1.main\(\){}.*} \
	 "openp s4-d (non-existent source, in the current dir, find in <dir>/basename)"

# s5+
test_src ${testtmpdir}/subdir/src/subdir ../${srcname} ${binfile} \
	 "" \
	 ${testtmpdir}/subdir/cwd \
	 "file ${binfile}" "" \
	 "l main" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "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" \
	 {1.main\(\){}.*} \
	 "openp s5-da (non-existent source, in the upper dir, find in <dir>/\$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" \
	 {1.main\(\){}.*} \
	 "openp s5-dr (non-existent source, in the upper dir, find in <dir>/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" \
	 {1.main\(\){}.*} \
	 "openp s5-d (non-existent source, in the upper dir, find in <dir>/basename)"


system "rm -rf ${testtmpdir}"

             reply	other threads:[~2004-08-16 14:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-16 14:41 Baurzhan Ismagulov [this message]
2004-08-16 15:56 ` Michael Chastain
2004-08-16 18:21   ` Baurjan Ismagulov
2004-08-16 19:15 ` Michael Chastain
2004-08-16 20:38   ` Andreas Schwab
2004-08-18 13:03   ` Baurzhan Ismagulov
2004-08-18 15:31     ` Michael Chastain
2004-08-18 15:50       ` Daniel Jacobowitz
2004-08-18 15:56         ` Baurjan Ismagulov
2004-08-18 16:04           ` Andreas Schwab
2004-08-18 15:50       ` Baurzhan Ismagulov
2004-08-18 17:10         ` Michael Chastain
2004-08-18 19:00         ` Michael Chastain
2004-08-18 22:03           ` Baurjan Ismagulov
2004-08-18 22:46             ` Michael Chastain
2004-08-18 23:33             ` Michael Chastain
2004-08-19  4:03               ` Eli Zaretskii
2004-08-19  8:34                 ` Michael Chastain
2004-08-19  8:56               ` Michael Chastain
2004-08-19  9:37                 ` Baurjan Ismagulov
2004-08-19  9:34               ` Baurjan Ismagulov
2004-08-19  9:55                 ` Michael Chastain
2004-08-19 10:10                   ` Baurjan Ismagulov
2004-08-19 10:20                     ` Michael Chastain
2004-08-26 20:36                   ` Baurjan Ismagulov
2004-08-26 20:52                     ` Michael Chastain
2004-08-26 20:32               ` Baurjan Ismagulov
2004-08-27 14:16                 ` Michael Chastain
2004-08-27 16:45                   ` Baurjan Ismagulov
2004-08-29 11:56                     ` Michael Chastain
2004-08-31 15:01                     ` Michael Chastain
2004-09-25 21:12                       ` Baurjan Ismagulov

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=20040816144349.GB1509@ata.cs.hun.edu.tr \
    --to=baurzhan.ismagulov@sbs.com.tr \
    --cc=gdb-patches@sources.redhat.com \
    /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