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

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