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

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