From: Garrett C. <ris...@li...> - 2010-07-03 06:39:20
|
The branch, pu, has been updated via 7666e5a7215ea9c1f8934cb568b138553e14a80e (commit) via 4239a299c0d5cfd8058c3676fee30a6a787acdfe (commit) via 2f429f3d096bf565eee21c28c54cfab28286eea6 (commit) via ab091057879e20f1be19425c10959ba6fcf7ada9 (commit) via c09e1448798a849f17e5201caa05dcf170effa5e (commit) via 2e38f1438de49a9ce4bfcb1d46f417b77797f55c (commit) via ad3d8f9e50f7073a33ab7d2cd13eae5870f5da30 (commit) via 0b97f0be1d838a253a158076f98820c2cee9cbba (commit) via fb968b9e2ed3bc81f27b16e070c45caf03971126 (commit) from 3dd341e0a9108e85b5cdc58d7faa8c91f3dd76cd (commit) - Log ----------------------------------------------------------------- commit 7666e5a7215ea9c1f8934cb568b138553e14a80e Author: Garrett Cooper <yan...@gm...> Date: Fri Jul 2 23:32:23 2010 -0700 Divide and conquer Makefiles to for gmake/pmake. The problem with the previous Makefiles is that it worked on pmake, but not gmake, as the previous Makefiles made use of a non-POSIX secondary expansion extension in pmake (gmake uses the .SECONDEXPANSION keyword to achieve the same thing). So, make this completely POSIX. Still doesn't fix the phantom targets issue. I need to start digging at the locate-tests level. Signed-off-by: Garrett Cooper <yan...@gm...> commit 4239a299c0d5cfd8058c3676fee30a6a787acdfe Author: Garrett Cooper <yan...@gm...> Date: Wed Jun 30 09:47:43 2010 -0700 Checkpoint working version of Makefile generator. There's some sort of random issue with the generated data from locate-tests that I need to track down because it's generating `phantom entries': $ make -C ./conformance/interfaces/sigwaitinfo/ all cc -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=nocona -I../../../include -o 1-1.run-test 1-1.c cc -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=nocona -I../../../include -o 2-1.run-test 2-1.c cc -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=nocona -I../../../include -o 3-1.run-test 3-1.c make: don't know how to make 4-1.c. Stop $ ls ./conformance/interfaces/sigwaitinfo/ 1-1.c 2-1.c 3-1.c 5-1.c 7-1.c 9-1.c assertions.xml 1-1.run-test 2-1.run-test 3-1.run-test 6-1.c 8-1.c Makefile coverage.txt Signed-off-by: Garrett Cooper <yan...@gm...> commit 2f429f3d096bf565eee21c28c54cfab28286eea6 Author: Garrett Cooper <yan...@gm...> Date: Tue Jun 29 22:11:47 2010 -0700 Disambiguate targets and sort out bits. Signed-off-by: Garrett Cooper <yan...@gm...> commit ab091057879e20f1be19425c10959ba6fcf7ada9 Author: Garrett Cooper <yan...@gm...> Date: Tue Jun 29 22:10:24 2010 -0700 Fix script and simplify find call. Signed-off-by: Garrett Cooper <yan...@gm...> commit c09e1448798a849f17e5201caa05dcf170effa5e Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 27 01:09:53 2010 -0700 Simplify search criterion and add an error check. Signed-off-by: Garrett Cooper <yan...@gm...> commit 2e38f1438de49a9ce4bfcb1d46f417b77797f55c Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 27 00:33:11 2010 -0700 POSIXify the last bit in the top-level Makefile. Signed-off-by: Garrett Cooper <yan...@gm...> commit ad3d8f9e50f7073a33ab7d2cd13eae5870f5da30 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 27 00:32:45 2010 -0700 Good bye dead Makefile. Signed-off-by: Garrett Cooper <yan...@gm...> commit 0b97f0be1d838a253a158076f98820c2cee9cbba Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 27 00:24:28 2010 -0700 Add top-level component makefiles. Signed-off-by: Garrett Cooper <yan...@gm...> commit fb968b9e2ed3bc81f27b16e070c45caf03971126 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 27 00:24:04 2010 -0700 Fix a typo and add a diag message. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: testcases/open_posix_testsuite/Makefile | 67 +++++++-------- .../{functional/threads => conformance}/Makefile | 0 .../functional/{threads => }/Makefile | 0 .../functional/threads/robust_test/Makefile | 12 --- .../scripts/generate-makefiles.sh | 45 +++++++---- testcases/open_posix_testsuite/scripts/locate-test | 55 +++++------- testcases/open_posix_testsuite/stress/Makefile | 12 ++- testcases/open_posix_testsuite/t0.c | 87 -------------------- 8 files changed, 90 insertions(+), 188 deletions(-) copy testcases/open_posix_testsuite/{functional/threads => conformance}/Makefile (100%) copy testcases/open_posix_testsuite/functional/{threads => }/Makefile (100%) delete mode 100644 testcases/open_posix_testsuite/functional/threads/robust_test/Makefile delete mode 100644 testcases/open_posix_testsuite/t0.c diff --git a/testcases/open_posix_testsuite/Makefile b/testcases/open_posix_testsuite/Makefile index 01dc591..e849ecf 100644 --- a/testcases/open_posix_testsuite/Makefile +++ b/testcases/open_posix_testsuite/Makefile @@ -9,11 +9,15 @@ # copyright notice stands above. # +# Makefiles that are considered critical to execution; if they don't exist +# all of the Makefiles will be rebuilt by default. CRITICAL_CONFORMANCE_MAKEFILE= conformance/interfaces/timer_settime/Makefile CRITICAL_FUNCTIONAL_MAKEFILE= functional/threads/pi_test/Makefile +CRITICAL_SECTION_MAKEFILE= stress/threads/sem_open/Makefile CRITICAL_MAKEFILES= $(CRITICAL_CONFORMANCE_MAKEFILE) \ - $(CRITICAL_FUNCTIONAL_MAKEFILE) + $(CRITICAL_FUNCTIONAL_MAKEFILE) \ + $(CRITICAL_SECTION_MAKEFILE) # The default expiration delay is 240 seconds TIMEOUT_VAL?= 240 @@ -32,65 +36,54 @@ CFLAGS+= -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 top_srcdir?= . -all: conformance-all functional-all stress-all t0 +all: conformance-all functional-all stress-all tools clean: - rm -f $(LOGFILE)* t0.val t0 + rm -f $(LOGFILE)* t0 t0.val for d in $(SUBDIRS); do \ $(MAKE) -C $$d clean >/dev/null; \ done -distclean: - @find conformance/*/*/ functional/*/*/ -name Makefile -print0 | xargs rm -f +# Clean out all of the generated Makefiles; this is done this way to ensure +# there won't be an argument overflow, and to remain POSIXly correct (POSIX +# find(1) doesn't support -mindepth like BSD and GNU find do...). +distclean-makefiles: + for dir in $(SUBDIRS); do \ + (cd $$dir && for subdir in */; do \ + (cd $$subdir && find */ -name Makefile 2>/dev/null | xargs rm -f); \ + done); \ + done -generate-makefiles: +generate-makefiles: distclean-makefiles @export top_srcdir=$(top_srcdir); \ $(top_srcdir)/scripts/generate-makefiles.sh $(CRITICAL_MAKEFILES): scripts/generate-makefiles.sh - $(MAKE) generate-makefiles - -.PRECIOUS: %.test -%.test: %.o t0 - @COMPLOG=$(LOGFILE).$$$$; \ - TEST=`echo "$@" | sed -e 's,.test$$,,'`; \ - [ -f $< ] || exit 0; \ - { nm -g $< | grep -q ' T main\| D main'; } || \ - { echo "$$TEST: link: SKIP" >> $(LOGFILE) && exit 0; }; \ - if $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -o $@ >$$COMPLOG 2>&1; \ - then \ - echo "$$TEST: link: PASS" >> $(LOGFILE); \ - echo "$$TEST: link: PASS"; \ - else \ - ( \ - echo "$$TEST: link: FAILED. Linker output: "; \ - cat $$COMPLOG; \ - ) >> $(LOGFILE); \ - echo "$$TEST: link: FAILED "; \ - fi; \ - rm -f $$COMPLOG; - -t0: $(top_srcdir)/t0.c - @echo Building timeout helper files - $(CC) -o $@ $< - -t0.val: t0 - echo `./t0 0; echo $$?` > t0.val + @$(MAKE) generate-makefiles + +tools: + @$(MAKE) -C tools all + +tools/t0: $(srcdir)/tools/t0.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/$(@F) $(LDLIBS) + +#build/t0.val: build/t0 +# echo `./t0 0; echo $$?` > t0.val # Test build and execution targets. -conformance-all: conformance/interfaces/timer_settime/Makefile +conformance-all: $(CRITICAL_CONFORMANCE_MAKEFILE) $(MAKE) -C conformance all conformance-test: $(MAKE) -C conformance all -functional-all: functional/threads/pi_test/Makefile +functional-all: $(CRITICAL_FUNCTIONAL_MAKEFILE) $(MAKE) -C functional all functional-test: $(MAKE) -C functional test -stress-all: +stress-all: $(CRITICAL_STRESS_MAKEFILE) $(MAKE) -C stress all stress-test: diff --git a/testcases/open_posix_testsuite/functional/threads/Makefile b/testcases/open_posix_testsuite/conformance/Makefile similarity index 100% copy from testcases/open_posix_testsuite/functional/threads/Makefile copy to testcases/open_posix_testsuite/conformance/Makefile diff --git a/testcases/open_posix_testsuite/functional/threads/Makefile b/testcases/open_posix_testsuite/functional/Makefile similarity index 100% copy from testcases/open_posix_testsuite/functional/threads/Makefile copy to testcases/open_posix_testsuite/functional/Makefile diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile b/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile deleted file mode 100644 index 0c3ba1b..0000000 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CFLAGS+= -I../include -LDLIBS= -lpthread -TARGETS= robust1-mode2 robust1-sun robust2-mode2 robust2-sun \ - robust3-mode2 - -all: $(TARGETS) - -clean: - -rm -rf $(TARGETS) - -test: - ./run.sh diff --git a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh index ed38a9d..e4beda5 100755 --- a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh +++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh @@ -23,6 +23,8 @@ generate_locate_test_makefile() { local maketype=$1; shift + echo "Generating $maketype Makefiles" + locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype generate_makefile make-gen.$maketype $* @@ -61,14 +63,14 @@ generate_makefile() { done # Print out the Makefile header for the first round. - if [ ! -f "$makefile" ]; then + if [ ! -f "$makefile.1" ]; then # The empty set for {INSTALL,MAKE}_TARGETS is # because some versions of make (like gmake) # must predefine the variables beforehand in # order for the value to be expanded properly # in the make rules. - cat > "$makefile" <<EOF + cat > "$makefile.1" <<EOF # # Automatically generated by $(basename "$0") -- DO NOT EDIT. # @@ -80,48 +82,55 @@ generate_makefile() { # Path variables. top_srcdir?= $(echo "$(dirname "$filename")" | sed -E -e 's,[^/]+,\.\.,g') -srcdir= \$(top_srcdir) subdir= $prereq_cache_dir +srcdir= \$(top_srcdir)/\$(subdir) EXEC_PREFIX= $EXEC_PREFIX +INSTALL_DIR= \$(DESTDIR)/\$(EXEC_PREFIX)/\$(subdir) # Build variables CFLAGS+= -I\$(top_srcdir)/include -INSTALL_TARGETS= -MAKE_TARGETS= +EOF + + cat > "$makefile.3" <<EOF all: \$(MAKE_TARGETS) clean: rm -f \$(MAKE_TARGETS) *.core -install: - for i in \$(INSTALL_TARGETS); do \ - install $$i \$(DESTDIR)/\$(EXEC_PREFIX)/\$(subdir)/$$i; \ +install: \$(INSTALL_DIR) + for i in \$(INSTALL_TARGETS); do \\ + install \$\$i \$(INSTALL_DIR)/\$\$i;\\ done test: all \$(top_srcdir)/scripts/run.sh \$(MAKE_TARGETS) +\$(INSTALL_DIR): + mkdir -p \$@ + EOF fi - cat >> "$makefile" <<EOF - + cat >> "$makefile.2" <<EOF INSTALL_TARGETS+= ${prereq_cache} MAKE_TARGETS+= ${make_target_prereq_cache} + EOF # Produce _awesome_ target rules for everything that # needs it. for prereq in ${make_target_prereq_cache}; do - cat >> "$makefile" <<EOF -$prereq: \$(srcdir)/$(echo "$prereq" | sed -e "s,\.$suffix,\.c,") - \$(CC) $compiler_args \$(CFLAGS) \$(LDFLAGS) -o \$@ \$(srcdir)/\$(@F) \$(LDLIBS) + 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) EOF + done # Prep for the next round.. @@ -145,6 +154,7 @@ EOF DEFAULT_PREFIX= if uname -a | grep -i linux +then DEFAULT_PREFIX=/opt else DEFAULT_PREFIX=/usr/local @@ -154,7 +164,10 @@ PREFIX=${PREFIX:=$DEFAULT_PREFIX/openposix_testsuite} EXEC_PREFIX="${PREFIX}/bin" # For the generic cases. -generate_locate_test_makefile buildable "test" -c -generate_locate_test_makefile execs "run-test" - +generate_locate_test_makefile buildonly "test" -c +generate_locate_test_makefile runnable "run-test" +find . -name Makefile.1 -exec dirname {} \; | while read dir; do + cat $dir/Makefile.1 $dir/Makefile.2 $dir/Makefile.3 $dir/Makefile.4 > $dir/Makefile + rm $dir/Makefile.1 $dir/Makefile.2 $dir/Makefile.3 $dir/Makefile.4 +done diff --git a/testcases/open_posix_testsuite/scripts/locate-test b/testcases/open_posix_testsuite/scripts/locate-test index e18642c..b4065d8 100755 --- a/testcases/open_posix_testsuite/scripts/locate-test +++ b/testcases/open_posix_testsuite/scripts/locate-test @@ -13,8 +13,8 @@ Usage: $(basename $0) [OPTIONs] DIRECTORY Lists the tests (source/binary) available from the DIRECTORY directory and down. - --buildable List only tests that require building - --execs List only tests that are executable + --buildonly List only tests that require building + --runnable List only tests that are executable If you just want to build a test, but not run it, do not include a main function into the .c file or name it something including the "-buildonly" string. @@ -36,21 +36,18 @@ not support TESTs compiled from many different sources. EOF } -buildable=""; -execs="" -print_execs=0 +mode= # Go through the cmd line options while true do case "$1" in - "--buildable") - buildable="( -name [0-9]*-*.c ! -name [0-9]*-[0-9]*.sh )" + "--buildonly") + mode="buildable" shift ;; - "--execs") - print_execs=1 - execs="( ( -name [0-9]*-[0-9]*.c -o -name [0-9]*-[0-9]*.sh ) -a ! -name *-buildonly* )" + "--runnable") + mode="runnable" shift ;; "--help") @@ -58,13 +55,13 @@ do exit 0 ;; --*) - echo >&2 "Unknown option $1" + echo >&2 "Unknown option: $1" usage >&2 exit 1 ;; *) - break 2 - ;; + break + ;; esac done @@ -72,26 +69,20 @@ done WHERE=${1:-.} # Need the DIRECTORY arg ... -if [ ! -d "$WHERE" ] -then - echo >&2 "Error: no root directory specified" +if [ ! -d "$WHERE" ]; then + echo >&2 "Error: $WHERE: no such directory" + exit 1 +elif [ "x$mode" = x ]; then + echo >&2 "Error: no options specified" usage >&2 exit 1 fi -# Force something .c or .sh -# Avoid .o, backups -# IF --execs, force it has no "-buildonly" -# If --buildable, remove the .sh files -find "$WHERE" -type f \ - \( \ - \( -name "[0-9]*-*.c" -o -name "[0-9]*-[0-9]*.sh" \) \ - ! -name \*.o ! -name \*~ \ - \) \ - $buildable $execs | \ - if [ $print_execs -eq 1 ] - then - sed 's/\.\(sh\|c\)$/.test/' - else - cat - fi +case "$mode" in +buildonly) + find "$WHERE" -type f -name "*-buildonly*.c" + ;; +runnable) + find "$WHERE" -type f \( -name '*.c' -a ! -name '*-buildonly*.c' \) -o -name '[0-9]*-[0-9]*.sh' + ;; +esac diff --git a/testcases/open_posix_testsuite/stress/Makefile b/testcases/open_posix_testsuite/stress/Makefile index 6b989fc..1b70252 100644 --- a/testcases/open_posix_testsuite/stress/Makefile +++ b/testcases/open_posix_testsuite/stress/Makefile @@ -1,6 +1,10 @@ -SUBDIRS= mqueues semaphores +# +# Read COPYING for licensing details. +# +# Garrett Cooper, June 2010 +# -all clean test: - for d in $(SUBDIRS); do \ - $(MAKE) -C $$d $@; \ +all clean install test: + for dir in `ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'`; do \ + $(MAKE) -C $$dir $@; \ done diff --git a/testcases/open_posix_testsuite/t0.c b/testcases/open_posix_testsuite/t0.c deleted file mode 100644 index 89b47ff..0000000 --- a/testcases/open_posix_testsuite/t0.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 |