From: Garrett C. <su...@li...> - 2011-01-07 00:01:11
|
The branch, master, has been updated via 2d5280c20e0ad4d7788906869ce157993b26864e (commit) via 5790ecf2bca500aaacef50e78fa31e20423cbd2c (commit) via 474273972fb285aea32745192997af0fd079c3b3 (commit) via 10c925cbe6555d4494e10c355fe5cbedbe95aad3 (commit) via 4aef43433833d75f87b92a6ea9bd7f2589426897 (commit) via 50a9f936ca37626f372a42d836c8f696a6bfac04 (commit) via 14f54896f5e5db0291a879fd9e18a57a5da3a183 (commit) from 56abfc32603a361e0c03ee1b6bf4c9a2322c56a6 (commit) - Log ----------------------------------------------------------------- commit 2d5280c20e0ad4d7788906869ce157993b26864e Author: Garrett Cooper <yan...@gm...> Date: Sun Dec 19 00:04:16 2010 -0800 Just capture the errors in make-errors. Signed-off-by: Garrett Cooper <yan...@gm...> commit 5790ecf2bca500aaacef50e78fa31e20423cbd2c Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:45:20 2010 -0800 Fix the fstat testcases. Signed-off-by: Garrett Cooper <yan...@gm...> commit 474273972fb285aea32745192997af0fd079c3b3 Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:35:21 2010 -0800 Fix compile. Signed-off-by: Garrett Cooper <yan...@gm...> commit 10c925cbe6555d4494e10c355fe5cbedbe95aad3 Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:35:01 2010 -0800 Fix compile. Signed-off-by: Garrett Cooper <yan...@gm...> commit 4aef43433833d75f87b92a6ea9bd7f2589426897 Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:34:41 2010 -0800 Add missing var. Signed-off-by: Garrett Cooper <yan...@gm...> commit 50a9f936ca37626f372a42d836c8f696a6bfac04 Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:32:01 2010 -0800 +x the script. Signed-off-by: Garrett Cooper <yan...@gm...> commit 14f54896f5e5db0291a879fd9e18a57a5da3a183 Author: Garrett Cooper <yan...@gm...> Date: Sat Dec 18 21:31:37 2010 -0800 Add tools for finding make errors. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: testcases/kernel/syscalls/dup/dup04.c | 2 + testcases/kernel/syscalls/fchdir/fchdir03.c | 65 +++++-------------- testcases/kernel/syscalls/flock/flock04.c | 5 +- testcases/kernel/syscalls/fstat/fstat02.c | 91 +++++++-------------------- testcases/kernel/syscalls/fstat/fstat04.c | 75 +++++++--------------- tools/build/find_all_make_errors.patch | 24 +++++++ tools/build/find_make_errors.sh | 10 +++ 7 files changed, 104 insertions(+), 168 deletions(-) create mode 100644 tools/build/find_all_make_errors.patch create mode 100755 tools/build/find_make_errors.sh diff --git a/testcases/kernel/syscalls/dup/dup04.c b/testcases/kernel/syscalls/dup/dup04.c index 927bf3d..2ad8e60 100644 --- a/testcases/kernel/syscalls/dup/dup04.c +++ b/testcases/kernel/syscalls/dup/dup04.c @@ -207,6 +207,8 @@ void setup() void cleanup() { + int i; + TEST_CLEANUP; for (i = 0; i <= 6; i++) diff --git a/testcases/kernel/syscalls/fchdir/fchdir03.c b/testcases/kernel/syscalls/fchdir/fchdir03.c index 9c3457a..996aef4 100644 --- a/testcases/kernel/syscalls/fchdir/fchdir03.c +++ b/testcases/kernel/syscalls/fchdir/fchdir03.c @@ -53,15 +53,15 @@ #include "test.h" #include "usctest.h" -#include <errno.h> +#include <sys/types.h> #include <sys/stat.h> +#include <sys/wait.h> +#include <errno.h> #include <fcntl.h> -#include <string.h> +#include <pwd.h> #include <stdio.h> -#include <sys/types.h> +#include <string.h> #include <unistd.h> -#include <pwd.h> -#include <sys/wait.h> char *TCID = "fchdir03"; int TST_TOTAL = 1; @@ -88,25 +88,20 @@ int main(int ac, char **av) pid_t pid; int status; - /* parse standard options */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); - /* set up the expected errnos */ TEST_EXP_ENOS(exp_enos); - /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ Tst_count = 0; - if ((pid = FORK_OR_VFORK()) < 0) { + if ((pid = FORK_OR_VFORK()) == -1) tst_brkm(TBROK, cleanup, "fork failed"); - } - if (pid == 0) { /* child */ + if (pid == 0) { /* * set the child's ID to ltpuser1 using seteuid() * so that the ID can be changed back after the @@ -133,15 +128,12 @@ int main(int ac, char **av) printf("Expected %d - got %d\n", EACCES, TEST_ERRNO); exit(1); - } else { - TEST_ERROR_LOG(TEST_ERRNO); - printf("Got EACCES\n"); - } + } else + printf("Got EACCES as expected\n"); - /* reset the process ID to the saved ID (root) */ - if (setuid(0) == -1) { + /* reset the UID to root */ + if (setuid(0) == -1) perror("setuid(0) failed"); - } } else { if (wait(&status) == -1) @@ -156,59 +148,38 @@ int main(int ac, char **av) } } - /* clean up things in case we are looping */ - if (rmdir(good_dir) == -1) { - tst_brkm(TBROK, cleanup, "Couldn't remove directory"); - } + if (rmdir(good_dir) == -1) + tst_brkm(TBROK, cleanup, "rmdir failed"); } cleanup(); + tst_exit(); } -/* - * setup() - performs all ONE TIME setup for this test. - */ void setup() { char *cur_dir = NULL; - /* make sure the process ID is root */ - if (geteuid() != 0) { - tst_brkm(TBROK, NULL, "Test must be run as root."); - } + tst_require_root(NULL); tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; - /* make a temporary directory and cd to it */ tst_tmpdir(); - /* get the currect directory name */ - if ((cur_dir = getcwd(cur_dir, 0)) == NULL) { - tst_brkm(TBROK, cleanup, "Couldn't get current directory name"); - } + if ((cur_dir = getcwd(cur_dir, 0)) == NULL) + tst_brkm(TBROK|TERRNO, cleanup, "getcwd failed"); sprintf(good_dir, "%s.%d", cur_dir, getpid()); ltpuser1 = my_getpwnam(user1name); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ void cleanup() { - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ TEST_CLEANUP; - /* - * Delete the test directory created in setup(). - */ tst_rmdir(); -} \ No newline at end of file +} diff --git a/testcases/kernel/syscalls/flock/flock04.c b/testcases/kernel/syscalls/flock/flock04.c index cd6b230..342bb1d 100644 --- a/testcases/kernel/syscalls/flock/flock04.c +++ b/testcases/kernel/syscalls/flock/flock04.c @@ -123,7 +123,8 @@ int main(int argc, char **argv) exit(0); } else if (wait(&status) == -1) - tst_brkm(TBROK|TERRNO, "wait failed"); + tst_brkm(TBROK|TERRNO, cleanup, + "wait failed"); pid = FORK_OR_VFORK(); if (pid == -1) @@ -144,7 +145,7 @@ int main(int argc, char **argv) exit(0); } else if (wait(&status) == -1) - tst_brkm(TBROK|TERRNO, "wait failed"); + tst_resm(TBROK|TERRNO, "wait failed"); TEST(flock(fd, LOCK_UN)); } else tst_resm(TFAIL|TERRNO, "flock failed"); diff --git a/testcases/kernel/syscalls/fstat/fstat02.c b/testcases/kernel/syscalls/fstat/fstat02.c index df3e981..56b1f11 100644 --- a/testcases/kernel/syscalls/fstat/fstat02.c +++ b/testcases/kernel/syscalls/fstat/fstat02.c @@ -101,130 +101,85 @@ int main(int ac, char **av) int lc; /* loop counter */ char *msg; /* message returned from parse_opts */ - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, NULL, NULL); - if (msg != NULL) { + if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - } - setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; - /* - * Call fstat(2) to get the status of - * specified 'file' pointed to by 'fd' - * into stat structure. - */ TEST(fstat(fildes, &stat_buf)); if (TEST_RETURN == -1) { tst_resm(TFAIL|TTERRNO, "fstat(%s) failed", TESTFILE); continue; } - /* - * Perform functional verification if test - * executed without (-f) option. - */ if (STD_FUNCTIONAL_TEST) { - /* - * Verify the data returned by fstat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != user_id) || - (stat_buf.st_gid != group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { + if (stat_buf.st_uid != user_id || + stat_buf.st_gid != group_id || + stat_buf.st_size != FILE_SIZE || + (stat_buf.st_mode & MASK) != FILE_MODE) { + tst_resm(TFAIL, + "functionality of fstat incorrect"); + } else + tst_resm(TPASS, + "functionality of fstat correct"); + } else tst_resm(TPASS, "call succeeded"); - } } cleanup(); + tst_exit(); } -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and chdir to it. - * Creat a temporary file and write some known data into it. - * Get the effective uid/gid of test process. - */ void setup() { - int i; char tst_buff[BUF_SIZE]; int wbytes; int write_len = 0; tst_sig(NOFORK, DEF_HANDLER, cleanup); - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, NULL, "Test must be run as root"); - } ltpuser = getpwnam(nobody_uid); + if (ltpuser == NULL) + tst_brkm(TBROK|TERRNO, NULL, "getpwnam failed"); if (setuid(ltpuser->pw_uid) == -1) - tst_resm(TINFO|TERRNO, "setuid(%d) failed", ltpuser->pw_uid); + tst_brkm(TBROK|TERRNO, NULL, "setuid failed"); TEST_PAUSE; tst_tmpdir(); - fildes = open(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE); + fildes = open(TESTFILE, O_WRONLY|O_CREAT, FILE_MODE); if (fildes == -1) - tst_brkm(TBROK|TERRNO, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) failed", - TESTFILE, FILE_MODE); + tst_brkm(TBROK|TERRNO, cleanup, "open failed"); /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } + memset(tst_buff, 'a', BUF_SIZE-1); /* Write to the file 1k data from the buffer */ while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK|TERRNO, cleanup, - "write(%s) failed", TESTFILE); - } else { + if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) + tst_brkm(TBROK|TERRNO, cleanup, "write failed"); + else write_len += wbytes; - } } - /* Get the uid/gid of the process */ user_id = getuid(); group_id = getgid(); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the test file and remove the test file and temporary directory. - */ void cleanup() { - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ TEST_CLEANUP; - /* Close the test file */ if (close(fildes) == -1) - tst_brkm(TFAIL|TERRNO, NULL, "close(%s) failed", TESTFILE); + tst_resm(TWARN|TERRNO, "close failed"); tst_rmdir(); -} \ No newline at end of file +} diff --git a/testcases/kernel/syscalls/fstat/fstat04.c b/testcases/kernel/syscalls/fstat/fstat04.c index edc5b7f..77d0e68 100644 --- a/testcases/kernel/syscalls/fstat/fstat04.c +++ b/testcases/kernel/syscalls/fstat/fstat04.c @@ -101,12 +101,9 @@ int main(int ac, char **av) char *msg; /* message returned from parse_opts */ /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, NULL, NULL); - if (msg != NULL) { + if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - } - setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { @@ -121,7 +118,7 @@ int main(int ac, char **av) TEST(fstat(fildes, &stat_buf)); if (TEST_RETURN == -1) { - tst_resm(TFAIL|TTERRNO, "fstat(%s) failed", TESTFILE); + tst_resm(TFAIL|TTERRNO, "fstat failed"); continue; } /* @@ -133,23 +130,20 @@ int main(int ac, char **av) * Verify the data returned by fstat(2) * aganist the expected data. */ - if ((stat_buf.st_uid != user_id) || - (stat_buf.st_gid != group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { + if (stat_buf.st_uid != user_id || + stat_buf.st_gid != group_id || + stat_buf.st_size != FILE_SIZE || + (stat_buf.st_mode & MASK) != FILE_MODE) { + tst_resm(TFAIL, "fstat functionality incorrect"); + } else + tst_resm(TPASS, "fstat functionality correct"); + } else tst_resm(TPASS, "call succeeded"); - } } cleanup(); + tst_exit(); } /* @@ -161,20 +155,19 @@ int main(int ac, char **av) */ void setup() { - int i; /* counter */ char tst_buff[BUF_SIZE]; /* data buffer */ int wbytes; /* no. of bytes written */ int write_len = 0; /* data length */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); + tst_require_root(NULL); - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, NULL, "Test must be run as root"); - } ltpuser = getpwnam(nobody_uid); + if (ltpuser == NULL) + tst_brkm(TBROK|TERRNO, NULL, "getpwnam failed"); if (setuid(ltpuser->pw_uid) == -1) - tst_resm(TINFO|TERRNO, "setuid(%d) failed", ltpuser->pw_uid); + tst_brkm(TBROK|TERRNO, NULL, "setuid failed"); + + tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; @@ -182,49 +175,29 @@ void setup() fildes = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE); if (fildes == -1) - tst_brkm(TBROK|TERRNO, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) failed", - TESTFILE, FILE_MODE); + tst_brkm(TBROK|TERRNO, cleanup, "open failed"); - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } + memset(tst_buff, 'a', BUF_SIZE-1); - /* Write to the file 1k data from the buffer */ while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK|TERRNO, cleanup, - "write(%s) failed", TESTFILE); - } else { + if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) + tst_brkm(TBROK|TERRNO, cleanup, "write failed"); + else write_len += wbytes; - } } - /* Get the uid/gid of the process */ user_id = getuid(); group_id = getgid(); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the testfile opened for reading/writing. - * Delete the testfile and temporary directory. - */ void cleanup() { - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ TEST_CLEANUP; - /* Close the test file */ if (close(fildes) == -1) - tst_brkm(TFAIL|TERRNO, NULL, "close(%s) failed", TESTFILE); + tst_resm(TWARN|TERRNO, "close failed"); tst_rmdir(); -} \ No newline at end of file +} diff --git a/tools/build/find_all_make_errors.patch b/tools/build/find_all_make_errors.patch new file mode 100644 index 0000000..6f73350 --- /dev/null +++ b/tools/build/find_all_make_errors.patch @@ -0,0 +1,24 @@ +diff --git a/include/mk/generic_trunk_target.inc b/include/mk/generic_trunk_target.inc +index 7ffb9e9..c81b9b4 100644 +--- a/include/mk/generic_trunk_target.inc ++++ b/include/mk/generic_trunk_target.inc +@@ -75,7 +75,8 @@ trunk-install: $(INSTALL_FILES) + all: trunk-all + + clean:: trunk-clean +- set -e; for dir in $(SUBDIRS); do \ ++ #@set -e; for dir in $(SUBDIRS); do ++ for dir in $(SUBDIRS); do \ + $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done + ifneq ($(abs_builddir),$(abs_srcdir)) +@@ -90,7 +91,8 @@ ifeq ($(strip $(SUBDIRS)),) + $(error SUBDIRS empty -- did you want generic_leaf_target instead?) + else + $(RECURSIVE_TARGETS): %: | $(SUBDIRS) +- @set -e; for dir in $(SUBDIRS); do \ ++ #@set -e; for dir in $(SUBDIRS); do ++ @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done + endif diff --git a/tools/build/find_make_errors.sh b/tools/build/find_make_errors.sh new file mode 100755 index 0000000..d644cdc --- /dev/null +++ b/tools/build/find_make_errors.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +MAKE=${MAKE:=gmake} + +$MAKE -k clean +$MAKE -k all 2>&1 | grep ' error: ' > make-errors + +cut -f 1 -d : < make-errors | sort -u | while read f; do + find . -name $f -type f + done > make-errors-files-only hooks/post-receive -- ltp |