Blame SOURCES/gdb-6.7-testsuite-stable-results.patch

132741
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
132741
From: Jan Kratochvil <jan.kratochvil@redhat.com>
132741
Date: Fri, 27 Oct 2017 21:07:50 +0200
132741
Subject: gdb-6.7-testsuite-stable-results.patch
132741
132741
;; Testsuite fixes for more stable/comparable results.
132741
;;=fedoratest
132741
132741
gdb/testsuite/gdb.base/fileio.c:
132741
gdb/testsuite/gdb.base/fileio.exp:
132741
2007-12-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
132741
132741
	* gdb.base/fileio.c (ROOTSUBDIR): New macro.
132741
	(main): CHDIR into ROOTSUBDIR.  CHOWN ROOTSUBDIR and CHDIR into
132741
	ROOTSUBDIR if we are being run as root.
132741
	* gdb.base/fileio.exp: Change the startup and finish cleanup.
132741
	Change the test file reference to be into the `fileio.dir' directory.
132741
132741
sources/gdb/testsuite/gdb.base/dump.exp:
132741
Found on RHEL-5.s390x.
132741
132741
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
132741
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
132741
132741
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
132741
frames-invalid can happen asynchronously.
132741
132741
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
132741
--- a/gdb/testsuite/gdb.base/fileio.c
132741
+++ b/gdb/testsuite/gdb.base/fileio.c
132741
@@ -559,6 +559,28 @@ strerrno (int err)
132741
 int
132741
 main ()
132741
 {
132741
+  /* These tests
132741
+       Open for write but no write permission returns EACCES
132741
+       Unlinking a file in a directory w/o write access returns EACCES
132741
+     fail if we are being run as root - drop the privileges here.  */
132741
+
132741
+  if (geteuid () == 0)
132741
+    {
132741
+      uid_t uid = 99;
132741
+
132741
+      if (chown (OUTDIR, uid, uid) != 0)
132741
+	{
132741
+	  printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
132741
+		  OUTDIR, strerror (errno));
132741
+	  exit (1);
132741
+	}
132741
+      if (setuid (uid) || geteuid () == 0)
132741
+	{
132741
+	  printf ("setuid %d: %s\n", (int) uid, strerror (errno));
132741
+	  exit (1);
132741
+	}
132741
+    }
132741
+
132741
   /* Don't change the order of the calls.  They partly depend on each other */
132741
   test_open ();
132741
   test_write ();
132741
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
132741
--- a/gdb/testsuite/gdb.base/fileio.exp
132741
+++ b/gdb/testsuite/gdb.base/fileio.exp
132741
@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] {
132741
 standard_testfile
132741
 
132741
 if {[is_remote host]} {
132741
-    set outdir .
132741
+    set outdir "fileio.dir"
132741
 } else {
132741
-    set outdir [standard_output_file {}]
132741
+    set outdir [standard_output_file "fileio.dir"]
132741
 }
132741
 
132741
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
132741
@@ -47,7 +47,8 @@ set dir2 [standard_output_file dir2.fileio.test]
132741
 if {[file exists $dir2] && ![file writable $dir2]} {
132741
     system "chmod +w $dir2"
132741
 }
132741
-system "rm -rf [standard_output_file *.fileio.test]"
132741
+system "rm -rf [standard_output_file fileio.dir]"
132741
+system "mkdir -m777 [standard_output_file fileio.dir]"
132741
 
132741
 set oldtimeout $timeout
132741
 set timeout [expr "$timeout + 60"]
132741
@@ -89,7 +90,7 @@ gdb_test continue \
132741
 
132741
 gdb_test "continue" ".*" ""
132741
 
132741
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
132741
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
132741
 
132741
 gdb_test continue \
132741
 "Continuing\\..*open 5:.*EACCES$stop_msg" \
132741
@@ -276,9 +277,7 @@ gdb_test continue \
132741
 gdb_exit
132741
 
132741
 # Make dir2 writable again so rm -rf of a build tree Just Works.
132741
-if {[file exists $dir2] && ![file writable $dir2]} {
132741
-    system "chmod +w $dir2"
132741
-}
132741
+system "chmod -R +w $outdir"
132741
 
132741
 set timeout $oldtimeout
132741
 return 0