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

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