]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | gdb/testsuite/gdb.base/fileio.c: |
2 | gdb/testsuite/gdb.base/fileio.exp: | |
3 | 2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com> | |
4 | ||
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. | |
10 | ||
11 | ||
12 | sources/gdb/testsuite/gdb.base/dump.exp: | |
13 | Found on RHEL-5.s390x. | |
14 | ||
15 | ||
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 | |
18 | ||
19 | ||
20 | gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp: | |
21 | frames-invalid can happen asynchronously. | |
22 | ||
f412e1b4 | 23 | Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c |
51a5ef0f | 24 | =================================================================== |
f412e1b4 PS |
25 | --- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200 |
26 | +++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c 2012-01-03 15:21:28.122729249 +0100 | |
3a58abaf AM |
27 | @@ -58,6 +58,8 @@ system (const char * string); |
28 | 1) Invalid string/command. - returns 127. */ | |
29 | static const char *strerrno (int err); | |
30 | ||
31 | +#define ROOTSUBDIR "fileio.dir" | |
32 | + | |
33 | #define FILENAME "foo.fileio.test" | |
34 | #define RENAMED "bar.fileio.test" | |
35 | #define NONEXISTANT "nofoo.fileio.test" | |
36 | @@ -542,6 +544,37 @@ strerrno (int err) | |
37 | int | |
38 | main () | |
39 | { | |
40 | + /* ROOTSUBDIR is already prepared by fileio.exp. We use it for easy cleanup | |
41 | + (by fileio.exp) if we are run by multiple users in the same directory. */ | |
42 | + | |
43 | + if (chdir (ROOTSUBDIR) != 0) | |
44 | + { | |
45 | + printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno)); | |
46 | + exit (1); | |
47 | + } | |
48 | + | |
49 | + /* These tests | |
50 | + Open for write but no write permission returns EACCES | |
51 | + Unlinking a file in a directory w/o write access returns EACCES | |
52 | + fail if we are being run as root - drop the privileges here. */ | |
53 | + | |
54 | + if (geteuid () == 0) | |
55 | + { | |
56 | + uid_t uid = 99; | |
57 | + | |
58 | + if (chown (".", uid, uid) != 0) | |
59 | + { | |
60 | + printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid, | |
61 | + strerror (errno)); | |
62 | + exit (1); | |
63 | + } | |
64 | + if (setuid (uid) || geteuid () == 0) | |
65 | + { | |
66 | + printf ("setuid %d: %s\n", (int) uid, strerror (errno)); | |
67 | + exit (1); | |
68 | + } | |
69 | + } | |
70 | + | |
71 | /* Don't change the order of the calls. They partly depend on each other */ | |
72 | test_open (); | |
73 | test_write (); | |
f412e1b4 | 74 | Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp |
51a5ef0f | 75 | =================================================================== |
f412e1b4 PS |
76 | --- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.exp 2011-12-26 12:24:55.000000000 +0100 |
77 | +++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp 2012-01-03 15:22:02.716601956 +0100 | |
51a5ef0f | 78 | @@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] { |
3a58abaf AM |
79 | return -1; |
80 | } | |
81 | ||
82 | -remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test} | |
83 | -remote_exec build {sh -xc rm\ -rf\ *.fileio.test} | |
84 | +remote_exec build {sh -xc rm\ -rf\ fileio.dir} | |
85 | +remote_exec build {sh -xc mkdir\ -m777\ fileio.dir} | |
86 | ||
87 | set oldtimeout $timeout | |
88 | set timeout [expr "$timeout + 60"] | |
51a5ef0f PS |
89 | @@ -85,7 +85,7 @@ gdb_test continue \ |
90 | ||
91 | gdb_test "continue" ".*" "" | |
3a58abaf | 92 | |
3a58abaf AM |
93 | -catch "system \"chmod -f -w nowrt.fileio.test\"" |
94 | +catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\"" | |
95 | ||
96 | gdb_test continue \ | |
97 | "Continuing\\..*open 5:.*EACCES$stop_msg" \ | |
f412e1b4 PS |
98 | @@ -251,8 +251,8 @@ gdb_exit |
99 | # Wait till GDB really exits. | |
100 | sleep 1 | |
3a58abaf AM |
101 | |
102 | -remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test} | |
103 | -remote_exec build {sh -xc rm\ -rf\ *.fileio.test} | |
104 | +remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test} | |
105 | +remote_exec build {sh -xc rm\ -rf\ fileio.dir} | |
106 | ||
107 | set timeout $oldtimeout | |
108 | return 0 |