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

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