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

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