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

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