From: Garrett C. <ris...@li...> - 2010-07-04 09:42:22
|
The branch, pu, has been updated via 2d87d5da9dfcda98b5c5cd41d45b924910aad1bd (commit) via a9b7de80f7d46e6091864c892cc6b385d435f3ca (commit) via 721ef9d8af62f8327a1075bc9de20c8a4cd88810 (commit) via 8c93e42ea3cf589bb663aa9dc78492f9d44f736b (commit) via 9be14150793e82064c4f9d791be322370573f314 (commit) from 7666e5a7215ea9c1f8934cb568b138553e14a80e (commit) - Log ----------------------------------------------------------------- commit 2d87d5da9dfcda98b5c5cd41d45b924910aad1bd Author: Garrett Cooper <yan...@gm...> Date: Sun Jul 4 02:39:54 2010 -0700 Update clean because t0 has been moved to tools. Signed-off-by: Garrett Cooper <yan...@gm...> commit a9b7de80f7d46e6091864c892cc6b385d435f3ca Author: Garrett Cooper <yan...@gm...> Date: Sun Jul 4 02:39:25 2010 -0700 Update clean because t0 has been moved to tools. Signed-off-by: Garrett Cooper <yan...@gm...> commit 721ef9d8af62f8327a1075bc9de20c8a4cd88810 Author: Garrett Cooper <yan...@gm...> Date: Sun Jul 4 02:39:03 2010 -0700 Add cleanup for t0. Signed-off-by: Garrett Cooper <yan...@gm...> commit 8c93e42ea3cf589bb663aa9dc78492f9d44f736b Author: Garrett Cooper <yan...@gm...> Date: Sun Jul 4 02:36:02 2010 -0700 Simplify search expressions further and fix. 1. Mode with --buildonly was accidentally the obsolete value. 2. Filter out noise with grep instead of find(1) directives. 3. Filter out tools/ files to avoid adding t0.c to the first Makefile generated. Needless to say, better criterion needs to be established for portable filtering of valid directories (basically 3+ levels deep). Signed-off-by: Garrett Cooper <yan...@gm...> commit 9be14150793e82064c4f9d791be322370573f314 Author: Garrett Cooper <yan...@gm...> Date: Sun Jul 4 02:34:36 2010 -0700 Commit last bit of fixup in this script. 1. $makefile was being incorrectly set. 2. Depend on the sourcefile in the directory, not the sourcefile in the build directory. This will unbreak out-of-build-tree builds. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: testcases/open_posix_testsuite/Makefile | 4 +- .../scripts/generate-makefiles.sh | 7 +- testcases/open_posix_testsuite/scripts/locate-test | 12 ++- testcases/open_posix_testsuite/tools/Makefile | 17 ++++ testcases/open_posix_testsuite/tools/t0.c | 87 ++++++++++++++++++++ 5 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 testcases/open_posix_testsuite/tools/Makefile create mode 100644 testcases/open_posix_testsuite/tools/t0.c diff --git a/testcases/open_posix_testsuite/Makefile b/testcases/open_posix_testsuite/Makefile index e849ecf..b926df1 100644 --- a/testcases/open_posix_testsuite/Makefile +++ b/testcases/open_posix_testsuite/Makefile @@ -39,8 +39,8 @@ top_srcdir?= . all: conformance-all functional-all stress-all tools clean: - rm -f $(LOGFILE)* t0 t0.val - for d in $(SUBDIRS); do \ + rm -f $(LOGFILE)* + for d in $(SUBDIRS) tools; do \ $(MAKE) -C $$d clean >/dev/null; \ done diff --git a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh index e4beda5..80d2f25 100755 --- a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh +++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh @@ -45,10 +45,10 @@ generate_makefile() { while read filename; do prereq_dir=$(dirname "$filename") - makefile="$prereq_dir/Makefile" # First run. if [ "$prereq_cache_dir" = "" ] ; then + makefile="$prereq_dir/Makefile" prereq_cache_dir="$prereq_dir" elif [ "$prereq_cache_dir" != "$prereq_dir" ]; then @@ -127,14 +127,15 @@ EOF c_file=$(echo "$prereq" | sed -e "s,\.$suffix,\.c,") cat >> "$makefile.4" <<EOF -$prereq: $c_file - \$(CC) $compiler_args \$(CFLAGS) \$(LDFLAGS) -o \$@ $c_file \$(LDLIBS) +$prereq: \$(srcdir)/$c_file + \$(CC) $compiler_args \$(CFLAGS) \$(LDFLAGS) -o \$@ \$(srcdir)/$c_file \$(LDLIBS) EOF done # Prep for the next round.. make_target_prereq_cache= + makefile="$prereq_dir/Makefile" prereq_cache= prereq_cache_dir="$prereq_dir" diff --git a/testcases/open_posix_testsuite/scripts/locate-test b/testcases/open_posix_testsuite/scripts/locate-test index b4065d8..c5be6fe 100755 --- a/testcases/open_posix_testsuite/scripts/locate-test +++ b/testcases/open_posix_testsuite/scripts/locate-test @@ -8,7 +8,7 @@ usage() { cat <<EOF -Usage: $(basename $0) [OPTIONs] DIRECTORY +Usage: $(basename "$0") [OPTIONs] DIRECTORY Lists the tests (source/binary) available from the DIRECTORY directory and down. @@ -43,7 +43,7 @@ while true do case "$1" in "--buildonly") - mode="buildable" + mode="buildonly" shift ;; "--runnable") @@ -80,9 +80,13 @@ fi case "$mode" in buildonly) - find "$WHERE" -type f -name "*-buildonly*.c" + find "$WHERE" -type f -name "*.c" | grep buildonly ;; runnable) - find "$WHERE" -type f \( -name '*.c' -a ! -name '*-buildonly*.c' \) -o -name '[0-9]*-[0-9]*.sh' + # XXX (garrcoop): the tools part is a hack to ensure that we don't + # waltz down the tools directory and try and build t0 (which doesn't + # make sense as it's a tool, not a test). Better criterion needs to + # be established for this file. + find "$WHERE" -type f -name '*.c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools' ;; esac diff --git a/testcases/open_posix_testsuite/tools/Makefile b/testcases/open_posix_testsuite/tools/Makefile new file mode 100644 index 0000000..127bfec --- /dev/null +++ b/testcases/open_posix_testsuite/tools/Makefile @@ -0,0 +1,17 @@ +# +# Read COPYING for licensing details. +# +# Garrett Cooper, June 2010 +# + +srcdir?= . + +clean: + rm -f t0 + +t0: $(srcdir)/t0.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) + +#build/t0.val: build/t0 +# echo `./t0 0; echo $$?` > t0.val + diff --git a/testcases/open_posix_testsuite/tools/t0.c b/testcases/open_posix_testsuite/tools/t0.c new file mode 100644 index 0000000..89b47ff --- /dev/null +++ b/testcases/open_posix_testsuite/tools/t0.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2004, Bull S.A.. All rights reserved. + * Created by: Sebastien Decugis + + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + + + * This utility software allows to run any executable file with a timeout limit. + * The syntax is: + * $ ./t0 n exe arglist + * where n is the timeout duration in seconds, + * exe is the executable filename to run, + * arglist is the arguments to be passed to executable. + * + * The use of this utility is intended to be "transparent", which means + * everything is as if + * $ exe arglist + * had been called, and a call to "alarm(n)" had been added inside exe's main. + * + * SPECIAL CASE: + * $ ./t0 0 + * Here another arg is not required. This special case will return immediatly + * as if it has been timedout. This is usefull to check a timeout return code value. + * + */ + +/* This utility should compile on any POSIX-conformant implementation. */ +#define _POSIX_C_SOURCE 200112L + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +int main (int argc, char * argv[]) +{ + int ret, timeout; + + /* Special case: t0 0 */ + if (argc == 2 && (strncmp(argv[1], "0", 1) == 0)) { + kill(getpid(), SIGALRM); + sleep(1); + return 1; + } + + /* General case */ + if (argc < 3) { + printf("\nUsage: \n"); + printf(" $ %s n exe arglist\n", argv[0]); + printf(" $ %s 0\n", argv[0]); + printf("\nWhere:\n"); + printf(" n is the timeout duration in seconds,\n"); + printf(" exe is the executable filename to run,\n"); + printf(" arglist is the arguments to be passed to executable.\n\n"); + printf(" The second use case will emulate an immediate timeout.\n\n"); + return 1; + } + + timeout = atoi(argv[1]); + if (timeout < 1) + { + fprintf(stderr, "Invalid timeout value \"%s\". Timeout must be a positive integer.\n", argv[1]); + return 1; + } + + /* Set the timeout */ + alarm(timeout); + + /* Execute the command */ + ret = execvp(argv[2], &argv[2]); + + /* Application was not launched */ + perror("Unable to run child application"); + return 1; +} hooks/post-receive -- ltp |