summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-12-12 13:24:19 -0500
committerEric S. Raymond <esr@thyrsus.com>2010-12-12 13:24:19 -0500
commit555f33504cc04a92a1749b54256457fc7be74bb6 (patch)
treee513228efc1050960a1d95955c270c1e89340cf6
parentf80b1c7d5b7cb50bc021407815d17595fcbcf145 (diff)
downloaddeheader-555f33504cc04a92a1749b54256457fc7be74bb6.tar.gz
deheader-555f33504cc04a92a1749b54256457fc7be74bb6.tar.bz2
deheader-555f33504cc04a92a1749b54256457fc7be74bb6.tar.xz
deheader-555f33504cc04a92a1749b54256457fc7be74bb6.zip
Add tests for chdir(2), chown(2), chmod(2). Fix some earlier ones.
-rwxr-xr-xdeheader2
-rw-r--r--test/cfgetispeed.c2
-rw-r--r--test/cfgetospeed.c2
-rw-r--r--test/cfsetispeed.c2
-rw-r--r--test/cfsetospeed.c2
-rw-r--r--test/chdir.c12
-rw-r--r--test/chmod.c13
-rw-r--r--test/chown.c13
-rw-r--r--test/regress.chk16
9 files changed, 59 insertions, 5 deletions
diff --git a/deheader b/deheader
index 0f9f4c4..c5d4f41 100755
--- a/deheader
+++ b/deheader
@@ -69,6 +69,8 @@ requirements = map(lambda (r, h): (re.compile(r), h), (
(r"\Wcfgetospeed\s*\(", ["<termios.h>"]),
(r"\Wcfsetispeed\s*\(", ["<termios.h>"]),
(r"\Wcfsetospeed\s*\(", ["<termios.h>"]),
+ (r"\Wchdir\s*\(", ["<unistd.h>"]),
+ (r"\Wchmod\s*\(", ["<sys/stat.h>", "<sys/types.h>"]),
(r"\Wumask\s*\(", ["<sys/stat.h>", "<sys/types.h>"]),
# Dependencies observed on systems other than the Linux this was
# developed under.
diff --git a/test/cfgetispeed.c b/test/cfgetispeed.c
index 3002759..9ca40cf 100644
--- a/test/cfgetispeed.c
+++ b/test/cfgetispeed.c
@@ -8,6 +8,6 @@
main(int arg, char **argv)
{
- struct termios *t;
+ struct termios t;
cfgetispeed(&t);
}
diff --git a/test/cfgetospeed.c b/test/cfgetospeed.c
index c5fc1f1..c448ff0 100644
--- a/test/cfgetospeed.c
+++ b/test/cfgetospeed.c
@@ -8,6 +8,6 @@
main(int arg, char **argv)
{
- struct termios *t;
+ struct termios t;
cfgetospeed(&t);
}
diff --git a/test/cfsetispeed.c b/test/cfsetispeed.c
index 4071186..2cdd37f 100644
--- a/test/cfsetispeed.c
+++ b/test/cfsetispeed.c
@@ -8,6 +8,6 @@
main(int arg, char **argv)
{
- struct termios *t;
+ struct termios t;
cfsetispeed(&t, 0);
}
diff --git a/test/cfsetospeed.c b/test/cfsetospeed.c
index 41c8679..92392c2 100644
--- a/test/cfsetospeed.c
+++ b/test/cfsetospeed.c
@@ -8,6 +8,6 @@
main(int arg, char **argv)
{
- struct termios *t;
+ struct termios t;
cfsetospeed(&t, 0);
}
diff --git a/test/chdir.c b/test/chdir.c
new file mode 100644
index 0000000..42dbf54
--- /dev/null
+++ b/test/chdir.c
@@ -0,0 +1,12 @@
+/*
+ * Items: chdir(
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <unistd.h>
+
+main(int arg, char **argv)
+{
+ (void)chdir("/");
+}
diff --git a/test/chmod.c b/test/chmod.c
new file mode 100644
index 0000000..51e866f
--- /dev/null
+++ b/test/chmod.c
@@ -0,0 +1,13 @@
+/*
+ * Items: chmod(
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+main(int arg, char **argv)
+{
+ (void)chmod("/", 0);
+}
diff --git a/test/chown.c b/test/chown.c
new file mode 100644
index 0000000..1b46960
--- /dev/null
+++ b/test/chown.c
@@ -0,0 +1,13 @@
+/*
+ * Items: chown(
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+main(int arg, char **argv)
+{
+ (void)chown("/", 0, 0);
+}
diff --git a/test/regress.chk b/test/regress.chk
index 4be1bf5..cd09724 100644
--- a/test/regress.chk
+++ b/test/regress.chk
@@ -1,3 +1,5 @@
+deheader: ./chdir.c has requires <unistd.h> from \Wchdir\s*\(
+deheader: ./chdir.c includes <unistd.h>
deheader: ./string.c includes <string.h>
deheader: ./bzero.c has requires <string.h> from \Wbzero\s*\(
deheader: ./bzero.c includes <string.h>
@@ -48,6 +50,9 @@ deheader: ./abort.c has requires <stdlib.h> from \Wabort\s*\(
deheader: ./abort.c includes <stdlib.h>
deheader: ./atanh.c has requires <math.h> from \Watanh\s*\(
deheader: ./atanh.c includes <math.h>
+deheader: ./chmod.c has requires <sys/stat.h>,<sys/types.h> from \Wchmod\s*\(
+deheader: ./chmod.c includes <sys/types.h>
+deheader: ./chmod.c includes <sys/stat.h>
deheader: ./atof.c has requires <stdlib.h> from \Wl64a\s*\(
deheader: ./atof.c includes <stdlib.h>
deheader: ./acosh.c has requires <math.h> from \Wacosh\s*\(
@@ -67,6 +72,8 @@ deheader: ./catgets.c has requires <nl_types.h> from \Wcatgets\s*\(
deheader: ./catgets.c includes <nl_types.h>
deheader: ./cbrt.c has requires <math.h> from \Wcbrt\s*\(
deheader: ./cbrt.c includes <math.h>
+deheader: ./chown.c includes <sys/types.h>
+deheader: ./chown.c includes <unistd.h>
deheader: ./advance.c has requires <regexp.h> from \Wadvance\s*\(
deheader: ./advance.c includes <regexp.h>
deheader: ./catopen.c has requires <nl_types.h> from \Wcatopen\s*\(
@@ -100,6 +107,7 @@ deheader: ./duplicate.c without <stdio.h> succeeded.
deheader: ./duplicate.c without <stdio.h> succeeded.
deheader: remove <stdio.h> from ./duplicate.c
deheader: remove <stdio.h> from ./duplicate.c
+deheader: in ./chdir.c, retaining required '#include <unistd.h>\n'
deheader: in ./atanh.c, retaining required '#include <math.h>\n'
deheader: ./bcopy.c without <string.h> failed (512).
deheader: in ./cfsetispeed.c, retaining required '#include <termios.h>\n'
@@ -124,5 +132,11 @@ deheader: in ./acosh.c, retaining required '#include <math.h>\n'
deheader: in ./catgets.c, retaining required '#include <nl_types.h>\n'
deheader: in ./bcmp.c, retaining required '#include <string.h>\n'
deheader: in ./a64l.c, retaining required '#include <stdlib.h>\n'
+deheader: in ./chmod.c, retaining required '#include <sys/stat.h>\n'
+deheader: in ./chmod.c, retaining required '#include <sys/types.h>\n'
+deheader: ./chown.c without <unistd.h> succeeded.
+deheader: ./chown.c without <sys/types.h> succeeded.
+deheader: remove <unistd.h> from ./chown.c
+deheader: remove <sys/types.h> from ./chown.c
deheader: in ./advance.c, retaining required '#include <regexp.h>\n'
-deheader: saw 40 files, 42 includes, 8 removed
+deheader: saw 43 files, 47 includes, 10 removed