import posixtestsuite 1.5.2

OK pirofti@

Comment:
open POSIX test suite

Description:
The Open POSIX Test Suite is a test suite for POSIX 2001 APIs, not
tied to specific implementations.  It provides conformance, functional,
and stress testing.  Initial focus is on Threads, Clocks & Timers,
Signals, Message Queues, and Semaphores.

To run POSIX test suite on a regular basis as a OpenBSD regression
test, compile the software as a port.  All files needed to run the
tests are installed as package.  The port specific tool posixtestsuite
creates a run time environment, runs the tests, and stores the
results in the current directory.
This commit is contained in:
bluhm 2018-05-02 21:06:46 +00:00
parent 13fa5dbad8
commit 6e11cfaca0
8 changed files with 6025 additions and 0 deletions

View File

@ -0,0 +1,125 @@
# $OpenBSD: Makefile,v 1.1.1.1 2018/05/02 21:06:46 bluhm Exp $
COMMENT = open POSIX test suite
DISTNAME = posixtestsuite-1.5.2
CATEGORIES = misc
HOMEPAGE = http://posixtest.sourceforge.net/
MAINTAINER = Alexander Bluhm <bluhm@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
WANTLIB = c m pthread
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=posixtest/}
BUILD_DEPENDS = textproc/gsed
USE_GMAKE = Yes
WRKDIST = ${WRKDIR}/posixtestsuite
ALL_TARGET = build-tests t0 t0.val
TEST_TARGET = run-tests
LIBEXEC_DIR = ${PREFIX}/libexec/posixtestsuite
LIBDATA_DIR = ${PREFIX}/libdata/posixtestsuite
pre-build:
cd ${WRKBUILD} && ./locate-test --buildable . >build.list
cd ${WRKBUILD} && ./locate-test --execs . >run.list
post-build:
cd ${WRKBUILD} &&\
while read test; do\
if [ -f "$$test" -o -f "$${test%.test}".sh ]; then\
echo "$$test";\
fi;\
done <run.list >test.list
cd ${WRKBUILD} &&\
file="";\
while read line; do\
IFS=' :.';\
set -- $$line;\
unset IFS;\
name="$$1";\
action="$$2";\
result="$$3";\
case "$$action" in\
build)\
file="$$name".build;\
true >"$$file";\
case "$$result" in\
PASS)\
;;\
FAILED)\
;;\
*)\
echo "$$name": "$$action" >&2;\
echo unknown result: "$$result" in "$$line" >&2;\
exit 1;\
;;\
esac;\
echo $$action: $$result >>"$$file";\
;;\
link)\
case "$$result" in\
PASS)\
;;\
SKIP)\
;;\
FAILED)\
;;\
*)\
echo test action: "$$test" "$$action" >&2;\
echo unknown result: "$$result" in "$$line" >&2;\
exit 1;\
;;\
esac;\
echo $$action: $$result >>"$$file";\
;;\
esac;\
echo "$$line" >>"$$file";\
done <logfile
do-install:
${INSTALL_PROGRAM_DIR} ${LIBEXEC_DIR}
${INSTALL_DATA_DIR} ${LIBDATA_DIR}
${INSTALL_PROGRAM} ${WRKBUILD}/t0 ${LIBEXEC_DIR}/
${INSTALL_DATA} ${WRKBUILD}/t0.val ${LIBDATA_DIR}/
${INSTALL_DATA} ${WRKBUILD}/build.list ${LIBDATA_DIR}/
${INSTALL_DATA} ${WRKBUILD}/run.list ${LIBDATA_DIR}/
${INSTALL_DATA} ${WRKBUILD}/test.list ${LIBDATA_DIR}/
cd ${WRKBUILD} &&\
while read test; do\
echo test $$test;\
${INSTALL_PROGRAM_DIR} ${LIBEXEC_DIR}/`dirname "$$test"`;\
${INSTALL_DATA_DIR} ${LIBDATA_DIR}/`dirname "$$test"`;\
name="$${test%.test}";\
if [ -f "$$name".sh ]; then\
${INSTALL_SCRIPT} "$$name".sh ${LIBEXEC_DIR}/"$${test}";\
${INSTALL_DATA} "$$name".sh ${LIBDATA_DIR}/"$$name".sh;\
elif [ -f "$$name".c ]; then\
${INSTALL_PROGRAM} "$$test" ${LIBEXEC_DIR}/"$$test";\
${INSTALL_DATA} "$$name".c ${LIBDATA_DIR}/"$$name".c;\
else\
echo no test source for: $$name >&2;\
exit 1;\
fi;\
done <test.list
cd ${WRKBUILD} &&\
while read source; do\
echo source $$source;\
${INSTALL_DATA_DIR} ${LIBDATA_DIR}/`dirname "$$source"`;\
${INSTALL_DATA} "$$source" ${LIBDATA_DIR}/"$$source";\
name="$${source%.c}";\
${INSTALL_DATA} "$$name".build ${LIBDATA_DIR}/"$$name".build;\
done <build.list
${SUBST_PROGRAM} ${FILESDIR}/posixtestsuite.sh\
${PREFIX}/bin/posixtestsuite
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (posixtestsuite-1.5.2.tar.gz) = FaIYVnISfLqFHTXsnVOP9hSN79u3X5nH6cUK66D5R1c=
SIZE (posixtestsuite-1.5.2.tar.gz) = 1092856

View File

@ -0,0 +1,93 @@
#!/bin/sh
# $OpenBSD: posixtestsuite.sh,v 1.1.1.1 2018/05/02 21:06:48 bluhm Exp $
# Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
libexec_dir=${TRUEPREFIX}/libexec/posixtestsuite
libdata_dir=${TRUEPREFIX}/libdata/posixtestsuite
timeout_val=240
timeout_ret=`cat $libdata_dir/t0.val`
timeout="$libexec_dir/t0 $timeout_val"
exec 3>logfile
while read test; do
(
dir=${test%/*}
mkdir -p $dir
cd $dir
name=${test%.test}
name=${name##*/}
echo -n execution: "" >$name.run
echo -n ${test%.test}: execution: "" >&3
echo -n ${test%.test}: execution: ""
set +e
$timeout $libexec_dir/$test >$name.log 2>&1
result=$?
set -e
if [ -f $libdata_dir/${test%.test}.c ]; then
cat $libdata_dir/${test%.test}.c >$name.c
cat $libdata_dir/${test%.test}.build >$name.build
case $result in
0)
msg=PASS
;;
1)
msg=FAILED
;;
2)
msg=UNRESOLVED
;;
4)
msg=UNSUPPORTED
;;
5)
msg=UNTESTED
;;
$timeout)
msg=HUNG
;;
1??)
msg=INTERRUPTED
;;
*)
msg=UNKNOWN
;;
esac
else
cat $libdata_dir/${test%.test}.sh >$name.sh
case $result in
0)
msg=PASS
;;
*)
msg=FAILED
;;
esac
fi
echo $msg >>$name.run
cat $name.log >>$name.run
if [ "$result" -eq 0 ]; then
echo $msg >&3
else
echo $msg: Output: >&3
cat $name.log >&3
fi
echo $msg
rm -f $name.log
)
done <${libdata_dir}/test.list

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2018/05/02 21:06:48 bluhm Exp $
Do not pass linker flags to compiler, clang fails due to -Werror
-Wunused-command-line-argument. Set CFLAGS and LDFLAGS directly
in Makefile.
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -29,7 +29,7 @@ top_builddir = .
LOGFILE = $(top_builddir)/logfile
-LDFLAGS := $(shell cat LDFLAGS | grep -v \^\#)
+LDFLAGS := -lpthread -lm
RUN_TESTS := $(shell $(top_builddir)/locate-test \
--execs $(top_builddir)/$(POSIX_TARGET))
@@ -54,7 +54,7 @@ stress-tests: stress-make stress-run
tests-pretty:
$(MAKE) all | column -t -s:
-CFLAGS = -g -O2 -Wall -Werror -D_POSIX_C_SOURCE=200112L
+CFLAGS = -g -O2 -Wall -Werror -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600
# add -std=c99, -std=gnu99 if compiler supports it (gcc-2.95.3 does not).
check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
@@ -165,7 +165,7 @@ $(top_builddir)/t0.val: $(top_builddir)/t0
.PRECIOUS: %.o
%.o: %.c
@COMPLOG=$(LOGFILE).$$$$; \
- if $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS) > $$COMPLOG 2>&1; \
+ if $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ > $$COMPLOG 2>&1; \
then \
echo "$(@:.o=): build: PASS" | tee -a $(LOGFILE); \
else \

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-locate-test,v 1.1.1.1 2018/05/02 21:06:48 bluhm Exp $
In shell break does not exit case blocks, so break 1 is enough.
The POSIX test suite requires features of GNU sed, use it explicitly.
Index: locate-test
--- locate-test.orig
+++ locate-test
@@ -85,7 +85,7 @@ do
exit 1;
;;
*)
- break 2;
+ break;
;;
esac
done
@@ -113,7 +113,7 @@ find "$WHERE" -type f \
$buildable $execs \
| if [ $print_execs -eq 1 ]
then
- sed 's/\.\(sh\|c\)$/.test/'
+ gsed 's/\.\(sh\|c\)$/.test/'
else
cat
fi

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-t0_c,v 1.1.1.1 2018/05/02 21:06:48 bluhm Exp $
strcmp(3) needs string.h, posix test suite should know that.
Index: t0.c
--- t0.c.orig
+++ t0.c
@@ -40,6 +40,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <signal.h>

View File

@ -0,0 +1,10 @@
The Open POSIX Test Suite is a test suite for POSIX 2001 APIs, not
tied to specific implementations. It provides conformance, functional,
and stress testing. Initial focus is on Threads, Clocks & Timers,
Signals, Message Queues, and Semaphores.
To run POSIX test suite on a regular basis as a OpenBSD regression
test, compile the software as a port. All files needed to run the
tests are installed as package. The port specific tool posixtestsuite
creates a run time environment, runs the tests, and stores the
results in the current directory.

File diff suppressed because it is too large Load Diff