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

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