1 gdb/testsuite/gdb.base/fileio.c:
2 gdb/testsuite/gdb.base/fileio.exp:
3 2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
5 * gdb.base/fileio.c (ROOTSUBDIR): New macro.
6 (main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
7 ROOTSUBDIR if we are being run as root.
8 * gdb.base/fileio.exp: Change the startup and finish cleanup.
9 Change the test file reference to be into the `fileio.dir' directory.
12 sources/gdb/testsuite/gdb.base/dump.exp:
13 Found on RHEL-5.s390x.
16 gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
17 random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
20 gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
21 frames-invalid can happen asynchronously.
23 --- ./gdb/testsuite/gdb.base/fileio.c 13 Jun 2006 08:55:22 -0000 1.10
24 +++ ./gdb/testsuite/gdb.base/fileio.c 8 Dec 2007 16:04:10 -0000
25 @@ -58,6 +58,8 @@ system (const char * string);
26 1) Invalid string/command. - returns 127. */
27 static const char *strerrno (int err);
29 +#define ROOTSUBDIR "fileio.dir"
31 #define FILENAME "foo.fileio.test"
32 #define RENAMED "bar.fileio.test"
33 #define NONEXISTANT "nofoo.fileio.test"
34 @@ -542,6 +544,37 @@ strerrno (int err)
38 + /* ROOTSUBDIR is already prepared by fileio.exp. We use it for easy cleanup
39 + (by fileio.exp) if we are run by multiple users in the same directory. */
41 + if (chdir (ROOTSUBDIR) != 0)
43 + printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno));
48 + Open for write but no write permission returns EACCES
49 + Unlinking a file in a directory w/o write access returns EACCES
50 + fail if we are being run as root - drop the privileges here. */
52 + if (geteuid () == 0)
56 + if (chown (".", uid, uid) != 0)
58 + printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid,
62 + if (setuid (uid) || geteuid () == 0)
64 + printf ("setuid %d: %s\n", (int) uid, strerror (errno));
69 /* Don't change the order of the calls. They partly depend on each other */
72 --- ./gdb/testsuite/gdb.base/fileio.exp 23 Aug 2007 18:14:16 -0000 1.12
73 +++ ./gdb/testsuite/gdb.base/fileio.exp 8 Dec 2007 16:04:10 -0000
74 @@ -46,8 +46,8 @@ if [get_compiler_info ${binfile}] {
78 -remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
79 -remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
80 +remote_exec build {sh -xc rm\ -rf\ fileio.dir}
81 +remote_exec build {sh -xc mkdir\ -m777\ fileio.dir}
83 set oldtimeout $timeout
84 set timeout [expr "$timeout + 60"]
85 @@ -88,7 +88,7 @@ gdb_test continue \
86 "Opening nonexistant file returns ENOENT"
88 send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
89 -catch "system \"chmod -f -w nowrt.fileio.test\""
90 +catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\""
93 "Continuing\\..*open 5:.*EACCES$stop_msg" \
94 @@ -252,8 +252,8 @@ gdb_test continue \
98 -remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
99 -remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
100 +remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test}
101 +remote_exec build {sh -xc rm\ -rf\ fileio.dir}
103 set timeout $oldtimeout