Blame SOURCES/gdb-6.3-test-movedir-20050125.patch

6240d7
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
6240d7
From: Elena Zannoni <ezannoni@redhat.com>
6240d7
Date: Fri, 27 Oct 2017 21:07:50 +0200
6240d7
Subject: gdb-6.3-test-movedir-20050125.patch
6240d7
6240d7
;; Fix to support executable moving
6240d7
;;=fedoratest
6240d7
6240d7
2005-01-25  Elena Zannoni  <ezannoni@redhat.com>
6240d7
6240d7
        * gdb.base/move-dir.exp: New test.
6240d7
        * gdb.base/move-dir.c: Ditto.
6240d7
        * gdb.base/move-dir.h: Ditto.
6240d7
6240d7
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
6240d7
new file mode 100644
6240d7
--- /dev/null
6240d7
+++ b/gdb/testsuite/gdb.base/move-dir.c
6240d7
@@ -0,0 +1,10 @@
6240d7
+#include <stdio.h>
6240d7
+#include <stdlib.h>
6240d7
+#include "move-dir.h"
6240d7
+
6240d7
+int main() {
6240d7
+   const char* hw = "hello world.";
6240d7
+   printf ("%s\n", hw);;
6240d7
+   other();
6240d7
+}
6240d7
+
6240d7
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
6240d7
new file mode 100644
6240d7
--- /dev/null
6240d7
+++ b/gdb/testsuite/gdb.base/move-dir.exp
6240d7
@@ -0,0 +1,57 @@
6240d7
+#   Copyright 2005
6240d7
+#   Free Software Foundation, Inc.
6240d7
+
6240d7
+# This program is free software; you can redistribute it and/or modify
6240d7
+# it under the terms of the GNU General Public License as published by
6240d7
+# the Free Software Foundation; either version 2 of the License, or
6240d7
+# (at your option) any later version.
6240d7
+# 
6240d7
+# This program is distributed in the hope that it will be useful,
6240d7
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
6240d7
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6240d7
+# GNU General Public License for more details.
6240d7
+# 
6240d7
+# You should have received a copy of the GNU General Public License
6240d7
+# along with this program; if not, write to the Free Software
6240d7
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
6240d7
+
6240d7
+set testfile "move-dir"
6240d7
+set srcfile ${testfile}.c
6240d7
+set incfile ${testfile}.h
6240d7
+set binfile [standard_output_file ${testfile}]
6240d7
+
6240d7
+set testdir [standard_output_file incdir]
6240d7
+
6240d7
+remote_exec build "mkdir $testdir"
6240d7
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} [standard_output_file ${srcfile}]"
6240d7
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} [standard_output_file ${incfile}]"
6240d7
+
6240d7
+set additional_flags "additional_flags=-I${subdir}/incdir"
6240d7
+
6240d7
+if  { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
6240d7
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
6240d7
+}
6240d7
+
6240d7
+# Create and source the file that provides information about the compiler
6240d7
+# used to compile the test case.
6240d7
+
6240d7
+if [get_compiler_info ${binfile}] {
6240d7
+    return -1;
6240d7
+}
6240d7
+
6240d7
+
6240d7
+set oldtimeout $timeout
6240d7
+set timeout [expr "$timeout + 60"]
6240d7
+
6240d7
+# Start with a fresh gdb.
6240d7
+
6240d7
+gdb_exit
6240d7
+gdb_start
6240d7
+gdb_test "cd ../.." "" ""
6240d7
+gdb_load ${binfile}
6240d7
+gdb_test "list main" ".*hw.*other.*" "found main"
6240d7
+gdb_test "list other" ".*ostring.*" "found include file"
6240d7
+
6240d7
+
6240d7
+set timeout $oldtimeout
6240d7
+return 0
6240d7
diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir.h
6240d7
new file mode 100644
6240d7
--- /dev/null
6240d7
+++ b/gdb/testsuite/gdb.base/move-dir.h
6240d7
@@ -0,0 +1,7 @@
6240d7
+#include <stdlib.h>
6240d7
+
6240d7
+void other() {
6240d7
+  const char* ostring = "other";
6240d7
+  printf ("%s\n", ostring);;
6240d7
+}
6240d7
+