Date: Thu, 9 Feb 2017 21:54:18 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313485 - in stable/10: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json cddl/contrib/opensolaris/cmd/dtrace/test/tst/comm... Message-ID: <201702092154.v19LsIni085078@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Feb 9 21:54:18 2017 New Revision: 313485 URL: https://svnweb.freebsd.org/changeset/base/313485 Log: MFC r277912,r278738,r279418,r280835,r288416: r277912 (by markj): Include required headers in DTrace test programs. r278738 (by markj): Tweak the fds test program so that it actually compiles. Also use 0 instead of -1 for the bogus ioctl command so that dmesg doesn't get spammed with sign extension warnings when the test program runs. r279418 (by markj): Add infrastructure to integrate the DTrace test suite with Kyua. For each test category, we generate a script containing ATF test cases for the tests under that category. Each test case simply runs dtest.pl (the upstream test harness) with the corresponding test files. The exclude.sh script is used to record info about tests which should be skipped or are expected to fail; it is used to generate atf_skip and atf_expect_fail calls. The genmakefiles.sh script can be used to regenerate the test makefiles when new tests are brought it from upstream. The test suite is currently not connected to the build as there is a small number of lingering test issues which still need to be worked out. In the meantime however, the test suite can be easily built and installed manually from cddl/usr.sbin/dtrace/tests. r280835 (by markj): Replace dtest.pl, the upstream DTrace test suite harness, with a shell script. This reimplementation is much simpler than dtest.pl and is more amenable to being run under Kyua - dtest.pl writes error output to a temporary directory that is deleted when the run finishes, making it hard to debug test failures. This change also removes the test suite's dependency on perl. r288416 (by markj): Update DTrace test makefiles after r288415. Added: stable/10/cddl/usr.sbin/dtrace/tests/ - copied from r279418, head/cddl/usr.sbin/dtrace/tests/ stable/10/cddl/usr.sbin/dtrace/tests/tools/dtest.sh - copied unchanged from r280835, head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c stable/10/cddl/usr.sbin/dtrace/tests/Makefile stable/10/cddl/usr.sbin/dtrace/tests/Makefile.inc1 stable/10/cddl/usr.sbin/dtrace/tests/common/privs/Makefile stable/10/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile stable/10/cddl/usr.sbin/dtrace/tests/tools/gentest.sh stable/10/etc/mtree/BSD.tests.dist Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c Thu Feb 9 21:54:18 2017 (r313485) @@ -26,6 +26,8 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <sys/ioctl.h> + #include <assert.h> #include <setjmp.h> #include <signal.h> @@ -69,7 +71,7 @@ main(int argc, char *argv[]) */ if (sigsetjmp(env, 1) == 0) { for (;;) - (void) ioctl(-1, -1, NULL); + (void) ioctl(-1, 0, NULL); } /* @@ -80,20 +82,19 @@ main(int argc, char *argv[]) fds[n++] = open(file, O_WRONLY); fds[n++] = open(file, O_RDWR); - fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC | - O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC | - O_SYNC | O_TRUNC | O_XATTR, 0666); + fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | + O_NOCTTY | O_NONBLOCK | O_NDELAY | O_SYNC | O_TRUNC | 0666); fds[n++] = open(file, O_RDWR); (void) lseek(fds[n - 1], 123, SEEK_SET); /* * Once we have all the file descriptors in the state we want to test, - * issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack + * issue a bogus ioctl() on each fd with cmd 0 and arg NULL to whack * our DTrace script into recording the content of the fds[] array. */ for (i = 0; i < n; i++) - (void) ioctl(fds[i], -1, NULL); + (void) ioctl(fds[i], 0, NULL); assert(n <= sizeof (fds) / sizeof (fds[0])); exit(0); Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d Thu Feb 9 21:54:18 2017 (r313485) @@ -36,7 +36,7 @@ syscall::ioctl:entry } syscall::ioctl:entry -/pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/ +/pid == $1 && arg0 != -1u && arg1 == 0 && arg2 == NULL/ { printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name); printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname); Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c Thu Feb 9 21:54:18 2017 (r313485) @@ -14,6 +14,8 @@ */ #include <sys/sdt.h> +#include <stdio.h> +#include <stdlib.h> #include "usdt.h" #define FMT "{" \ Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c Thu Feb 9 21:54:18 2017 (r313485) @@ -28,6 +28,7 @@ #include <strings.h> #include <rpc/rpc.h> +#include <stdio.h> #include <stdlib.h> #include <sys/param.h> #include <rpcsvc/mount.h> Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c Thu Feb 9 21:54:18 2017 (r313485) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <signal.h> +#include <stdlib.h> #include <unistd.h> int Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c Thu Feb 9 21:54:18 2017 (r313485) @@ -26,6 +26,8 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <sys/types.h> +#include <sys/wait.h> #include <spawn.h> #include <signal.h> #include <stdio.h> Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c Thu Feb 9 21:54:18 2017 (r313485) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <signal.h> +#include <stdlib.h> #include <unistd.h> /* Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c Thu Feb 9 21:54:18 2017 (r313485) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <signal.h> +#include <stdlib.h> #include <unistd.h> /* Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c Thu Feb 9 21:54:18 2017 (r313485) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <signal.h> +#include <stdlib.h> #include <unistd.h> /* Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c Thu Feb 9 21:54:18 2017 (r313485) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <signal.h> +#include <stdlib.h> #include <unistd.h> /* Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Thu Feb 9 21:54:18 2017 (r313485) @@ -28,6 +28,7 @@ #include <stdio.h> #include <sys/syscall.h> +#include <unistd.h> /*ARGSUSED*/ int Modified: stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c Thu Feb 9 21:54:18 2017 (r313485) @@ -26,6 +26,10 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <sys/types.h> +#include <sys/wait.h> + +#include <stdlib.h> #include <unistd.h> #include "forker.h" Modified: stable/10/cddl/usr.sbin/dtrace/tests/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/Makefile Sat Feb 28 23:30:06 2015 (r279418) +++ stable/10/cddl/usr.sbin/dtrace/tests/Makefile Thu Feb 9 21:54:18 2017 (r313485) @@ -8,10 +8,8 @@ TESTS_SUBDIRS+= common .PATH: ${.CURDIR:H:H:H:H}/tests KYUAFILE= YES -.PATH: ${.CURDIR:H:H:H}/contrib/opensolaris/cmd/dtrace/test/cmd/scripts +.PATH: ${.CURDIR}/tools SCRIPTSDIR= ${TESTSDIR} -SCRIPTS= dtest.pl - -SUBDIR_PARALLEL= +SCRIPTS= dtest.sh .include <bsd.test.mk> Modified: stable/10/cddl/usr.sbin/dtrace/tests/Makefile.inc1 ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/Makefile.inc1 Sat Feb 28 23:30:06 2015 (r279418) +++ stable/10/cddl/usr.sbin/dtrace/tests/Makefile.inc1 Thu Feb 9 21:54:18 2017 (r313485) @@ -16,7 +16,6 @@ ${TESTGROUP}EXEDIR= ${TESTSDIR} TESTWRAPPER= t_dtrace_contrib ATF_TESTS_SH+= ${TESTWRAPPER} -TEST_METADATA.t_dtrace_contrib+= required_files="/usr/local/bin/perl" TEST_METADATA.t_dtrace_contrib+= required_files="/usr/local/bin/ksh" TEST_METADATA.t_dtrace_contrib+= required_user="root" Modified: stable/10/cddl/usr.sbin/dtrace/tests/common/privs/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Sat Feb 28 23:30:06 2015 (r279418) +++ stable/10/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Thu Feb 9 21:54:18 2017 (r313485) @@ -8,6 +8,7 @@ TESTFILES= \ tst.fds.ksh \ tst.func_access.ksh \ tst.getf.ksh \ + tst.kpriv.ksh \ tst.op_access.ksh \ tst.procpriv.ksh \ tst.providers.ksh \ Modified: stable/10/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Sat Feb 28 23:30:06 2015 (r279418) +++ stable/10/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Thu Feb 9 21:54:18 2017 (r313485) @@ -14,6 +14,8 @@ TESTFILES= \ err.D_OP_INCOMPAT.dupltype.d \ err.D_OP_INCOMPAT.dupttype.d \ err.D_SYNTAX.declare.d \ + err.bigglobal.d \ + err.biglocal.d \ tst.basicvar.d \ tst.basicvar.d.out \ tst.localvar.d \ Copied: stable/10/cddl/usr.sbin/dtrace/tests/tools/dtest.sh (from r280835, head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/cddl/usr.sbin/dtrace/tests/tools/dtest.sh Thu Feb 9 21:54:18 2017 (r313485, copy of r280835, head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh) @@ -0,0 +1,129 @@ +# $FreeBSD$ + +usage() +{ + cat >&2 <<__EOF__ +A harness for test cases in the DTrace test suite. + +usage: $(basename $0) <testfile> +__EOF__ + exit 1 +} + +gettag() +{ + local tag + + tag=$(basename $1) + tag=${tag#*.} + tag=${tag%%[a-z.]*} + echo $tag +} + +runtest() +{ + local dflags exe exstatus pid retval status + + exstatus=0 + retval=0 + + case $TFILE in + drp.DTRACEDROP_*.d|err.*.d|tst.*.d) + case $TFILE in + drp.DTRACEDROP_*.d) + dflags="-x droptags" + tag=$(gettag "$TFILE") + ;; + err.D_*.d) + exstatus=1 + dflags="-x errtags" + tag=$(gettag "$TFILE") + ;; + err.*.d) + exstatus=1 + ;; + esac + + exe=${TFILE%.*}.exe + if [ -f "$exe" -a -x "$exe" ]; then + ./$exe & + pid=$! + dflags="$dflags ${pid}" + fi + + dtrace -C -s "${TFILE}" $dflags >$STDOUT 2>$STDERR + status=$? + + if [ $status -ne $exstatus ]; then + ERRMSG="dtrace exited with status ${status}, expected ${exstatus}" + retval=1 + elif [ -n "${tag}" ] && ! grep -Fq " [${tag}] " ${STDERR}; then + ERRMSG="dtrace's error output did not contain expected tag ${tag}" + retval=1 + fi + + if [ -n "$pid" ]; then + kill -0 $pid >/dev/null 2>&1 && kill -9 $pid >/dev/null 2>&1 + wait + fi + ;; + err.*.ksh|tst.*.ksh) + expr "$TFILE" : 'err.*' >/dev/null && exstatus=1 + + ksh "$TFILE" /usr/sbin/dtrace >$STDOUT 2>$STDERR + status=$? + + if [ $status -ne $exstatus ]; then + ERRMSG="script exited with status ${status}, expected ${exstatus}" + retval=1 + fi + ;; + *) + ERRMSG="unexpected test file name $TFILE" + retval=1 + ;; + esac + + return $retval +} + +[ $# -eq 1 ] || usage + +readonly STDERR=$(mktemp) +readonly STDOUT=$(mktemp) +readonly TFILE=$(basename $1) +readonly EXOUT=${TFILE}.out + +kldstat -q -m dtrace_test || kldload dtrace_test +cd $(dirname $1) +runtest +RESULT=$? + +if [ $RESULT -eq 0 -a -f $EXOUT -a -r $EXOUT ] && \ + ! cmp $STDOUT $EXOUT >/dev/null 2>&1; then + ERRMSG="test output mismatch" + RESULT=1 +fi + +if [ $RESULT -ne 0 ]; then + echo "test $TFILE failed: $ERRMSG" >&2 + if [ $(stat -f '%z' $STDOUT) -gt 0 ]; then + cat >&2 <<__EOF__ +test stdout: +-- +$(cat $STDOUT) +-- +__EOF__ + fi + if [ $(stat -f '%z' $STDERR) -gt 0 ]; then + cat >&2 <<__EOF__ +test stderr: +-- +$(cat $STDERR) +-- +__EOF__ + fi +fi + +rm -f $STDERR $STDOUT +exit $RESULT Modified: stable/10/cddl/usr.sbin/dtrace/tests/tools/gentest.sh ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/tools/gentest.sh Sat Feb 28 23:30:06 2015 (r279418) +++ stable/10/cddl/usr.sbin/dtrace/tests/tools/gentest.sh Thu Feb 9 21:54:18 2017 (r313485) @@ -33,8 +33,8 @@ ${tcase}_head() ${tcase}_body() { $mod - atf_check -s exit:0 -o ignore -e ignore \\ - "\$(atf_get_srcdir)/../../dtest" -n "\$(atf_get_srcdir)/${tfile}" + atf_check -s exit:0 -o empty -e empty \\ + "\$(atf_get_srcdir)/../../dtest" "\$(atf_get_srcdir)/${tfile}" } __EOF__ } Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Thu Feb 9 21:37:36 2017 (r313484) +++ stable/10/etc/mtree/BSD.tests.dist Thu Feb 9 21:54:18 2017 (r313485) @@ -53,6 +53,168 @@ usr.bin .. usr.sbin + dtrace + common + aggs + .. + arithmetic + .. + arrays + .. + assocs + .. + begin + .. + bitfields + .. + buffering + .. + builtinvar + .. + cg + .. + clauses + .. + cpc + .. + decls + .. + drops + .. + dtraceUtil + .. + end + .. + enum + .. + error + .. + exit + .. + fbtprovider + .. + funcs + .. + grammar + .. + include + .. + inline + .. + io + .. + ip + .. + java_api + .. + json + .. + lexer + .. + llquantize + .. + mdb + .. + mib + .. + misc + .. + multiaggs + .. + offsetof + .. + operators + .. + pid + .. + plockstat + .. + pointers + .. + pragma + .. + predicates + .. + preprocessor + .. + print + .. + printa + .. + printf + .. + privs + .. + probes + .. + proc + .. + profile-n + .. + providers + .. + raise + .. + rates + .. + safety + .. + scalars + .. + sched + .. + scripting + .. + sdt + .. + sizeof + .. + speculation + .. + stability + .. + stack + .. + stackdepth + .. + stop + .. + strlen + .. + strtoll + .. + struct + .. + syscall + .. + sysevent + .. + tick-n + .. + trace + .. + tracemem + .. + translators + .. + typedef + .. + types + .. + uctf + .. + union + .. + usdt + .. + ustack + .. + vars + .. + version + .. + .. + .. .. .. etc
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702092154.v19LsIni085078>