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

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