MFC r272343,r272458,r272890,r272891,r272901,r272902,r272903,r272905,r272908,r272909,r272910,r272914,r272915,r272979,r272980,r273010,r273011,r273012,r273015,r273017,r273019,r273020,r273021,r273022,r273023,r273024,r273025,r273389,r273390,r273391,r273393,r273395,r273396,r273397,r273410,r273516,r273517,r273520,r273521,r273522,r273523,r273524,r273525,r273526,r273527,r273528,r273529,r273530,r273533,r273534,r273535,r273536,r273537,r273538,r273539,r273540,r273572,r273574,r273578,r273579,r273591,r273592,r273928,r273933,r273935,r273936,r273937,r273938,r273942,r273943,r273945,r273946,r273947,r273948,r273949,r273950,r273951,r273952,r274061,r274062,r274066,r274067,r274072,r274074,r274079,r274090,r274142,r274143,r274571,r274572,r274573,r274574,r274575,r274576,r274577,r274579,r274597,r274598,r274599,r274600,r274601,r274626,r275033,r276046,r276430:
r272343: r272458: Import the NetBSD test suite from ^/vendor/NetBSD/tests/09.30.2014_20.45 , minus the vendor Makefiles Provide directions for how to bootstrap the vendor sources in FREEBSD-upgrade MFC after 2 weeks Discussed with: rpaulo Sponsored by: EMC / Isilon Storage Division r272890: Only build/run hsearch_basic and hsearch_r_basic on NetBSD hdestroy1 is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division r272891: Expect SIGSEGV in lib/libc/stdlib/t_getenv:setenv_basic See bin/189805 for more details In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272901: Disable tests that don't pass on FreeBSD due to missing support in humanize_number(3). Bringing in additional revisions from NetBSD's humanize_number(3) will fix the tests Account for the fact that util.h on NetBSD is libutil.h on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division r272902: Add missing #include <sys/time.h> for gettimeofday Sponsored by: EMC / Isilon Storage Division r272903: FreeBSD returns ENOTTY instead of EBADF in ttyname_r; mark it as an expected failure PR: 191936 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272905: FreeBSD doesn't support strings greater than MAXHOSTNAMELEN-1 in {get,set}{domain,host}name. Adjust the tests to not exceed that value when testing out the code Add a positive and negative test for MAXHOSTNAMELEN-1 and MAXHOSTNAMELEN, respectively PR: 181127 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272908: Disable the invalid pointer test on FreeBSD FreeBSD segfaults on invalid pointers passed to getcwd because it throbs the address passed in in libc, whereas NetBSD just passes the information off to the syscall, which allows the kernel to return EFAULT on bad pointers. In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272909: Handle getting/setting niceness/priority correctly on FreeBSD vs NetBSD This might be fallout from PR: 189821 Submitted by: pho Sponsored by: EMC / Isilon Storage Division r272910: SIGPWR does not exist on FreeBSD Sponsored by: EMC / Isilon Storage Division r272914: Skip over t_spawn_open_nonexistent_diag because it requires NetBSD specific additions to posix_spawn Sponsored by: EMC / Isilon Storage Division r272915: Port the testcase to FreeBSD - Make #include path to h_macros.h a non-relative path - __gl_stat_t is synonymous with struct stat on FreeBSD - FreeBSD doesn't have _DIRENT_RECLEN - Skip over glob_star on FreeBSD (testcase doesn't pass) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272979: Only #include <sys/tls.h> on NetBSD Sponsored by: EMC / Isilon Storage Division r272980: #include libutil.h for fparseln on FreeBSD Sponsored by: EMC / Isilon Storage Division r273010: Implement 64MB memory limit for test to ensure that it fails reliably in 600 seconds; it would previously fail inconsistently when run in some virtual machine configurations This patch might need to be reverted or revisited later (see the attached PR for more details) PR: 169302 Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273011: Fix compilation errors with missing wide-type headers and fix compilation warnings with -Wformat In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273012: - Add libutil #include for fparseln - Change ATF_REQUIRE_EQ_MSG to ATF_CHECK_EQ_MSG to gather all failing results possible (currently 12 with leftassoc) - Mark leftassoc "atf_tc_expect_fail" on FreeBSD (PR coming soon after further analysis is done on the code) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273015: Expect nice_err to fail on FreeBSD with unprivileged users PR: 189821 Sponsored by: EMC / Isilon Storage Division r273017: Add #include <stdio.h> for printf Sponsored by: EMC / Isilon Storage Division r273019: Do initial port of contrib/netbsd-tests/lib/libc/locale t_io: - Expect failures potentially related to implementation-specific knowledge of the zh_TW.Big5 locale [*] t_mbrtowc: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) - Expect failure with mbrtowc_internal dealing with Japanese locales (potentially related to implementation detail knowledge of the ja_* locales) [*]. t_mbstowcs, t_mbtowc, t_wctomb: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) t_wcstod: - Treat FreeBSD like NetBSD and Linux in the XXX: FIXME section [*] More investigation is required to determine the root cause of the failures Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273020: memmem with NUL length "needle" (aka small) strings on FreeBSD/OSX returns NULL instead of the "haystack" value (aka big) Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273021: Use 1 as a random seed, as recommended in srandom(3). Adjust the random values accordingly Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273022: Add #include <stdio.h> to get sys_nerr definition Sponsored by: EMC / Isilon Storage Division r273023: __isnanl is automatically picked according to data type in <math.h>. There isn't a need for the explicit __isnanl test Sponsored by: EMC / Isilon Storage Division r273024: Only test the return value in mktime_negyear Testing for the errno is an optional requirement according to POSIX, and FreeBSD doesn't document that errno would be set on failure with mktime Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273025: Change ATF_REQUIRE_MSG calls to ATF_CHECK_MSG to get as many errors as possible t_strptime:common.. - Expect the testcase body as a whole to fail. Multiple PRs will be filed to track the issues (there are 18 check failures) t_strptime:day.. - %EA and %OA seem to be case insensitive on FreeBSD r273389: Port lib/libc/gen/t_siginfo to FreeBSD - mcontext_t on FreeBSD doesn't have a __gregs field (it's split out on FreeBSD into separate fields). In order to avoid muddying the test code with MD code, the debugging trace info has not been implemented - FreeBSD does not implement the si_stime and si_utime fields in siginfo_t, so omit the debugging code that dumps the values - sys/inttypes.h doesn't exist on FreeBSD Sponsored by: EMC / Isilon Storage Division r273390: libutil.h is required for fparseln on FreeBSD Sponsored by: EMC / Isilon Storage Division r273391: Add missing #include for sys/stat.h for fchmod Sponsored by: EMC / Isilon Storage Division r273393: Port t_write to FreeBSD - Mark the signo variable for the signal handle __unused - Use limits.h instead of sys/syslimits.h (the latter does not exist on FreeBSD) Sponsored by: EMC / Isilon Storage Division r273395: Mark osi __unused so this compiles cleanly on FreeBSD Sponsored by: EMC / Isilon Storage Division r273396: unlink("/") fails with EISDIR instead of EBUSY on FreeBSD; test for that instead Sponsored by: EMC / Isilon Storage Division r273397: Port t_chroot to FreeBSD - Add missing #include sys/stat.h for mkdir(2) - Omit the fchroot(2) tests because the support is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division r273410: Add sys/socket.h #include for bind(2), et al Sponsored by: EMC / Isilon Storage Division r273516: Add netinet/in.h for struct sockaddr_in Sponsored by: EMC / Isilon Storage Division r273517: Expect getgroups_err to fail on FreeBSD PR: 189941 Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273520: Port t_pipe2.c to FreeBSD - Omit the pipe2_nosigpipe testcase on FreeBSD (FreeBSD doesn't have O_NOSIGPIPE). - Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)". - Save and restore the resource limit on the number of files (RLIMIT_NOFILE). In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273521: Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)" Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273522: - Mark unused parameters __unused in handler - Call sigqueue with getpid() instead of 0 -- the latter idiom appears to only be valid on NetBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273523: Add limits.h #include for LINE_MAX Sponsored by: EMC / Isilon Storage Division r273524: Add sys/socket.h #include for struct sockaddr_in Sponsored by: EMC / Isilon Storage Division r273525: Port t_mmap.c to FreeBSD - Add needed headers for the testcases - Omit mmap_block on non-NetBSD OSes - Use "security.bsd.map_at_zero" instead of "vm.user_va0_disable" Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273526: Omit the pollts testcases on FreeBSD Sponsored by: EMC / Isilon Storage Division r273527: Omit all of the testcases as revoke(2) is only implemented on devfs(5) Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273528: Mark signo __unused in handler(..) Sponsored by: EMC / Isilon Storage Division r273529: - Omit the poll testcases on FreeBSD (they require pollts) - Add necessary headers for the testcases Sponsored by: EMC / Isilon Storage Division r273530: Add limits.h #include for INT_MAX Sponsored by: EMC / Isilon Storage Division r273533: Use <atf_srcdir>/truncate_test.root_owned instead of /usr/bin/fpr as fpr does not exist on FreeBSD truncate_test.root_owned will be generated at build time and owned by root In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273534: - Mark sig/signo __unused - Do not provide a relative path via #include "h_macros.h" Sponsored by: EMC / Isilon Storage Division r273535: - Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al) - Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t on FreeBSD) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273536: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division r273537: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division r273538: Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr) r273539: Mark signum __unused Sponsored by: EMC / Isilon Storage Division r273540: Omit the mprotect_exec testcase on FreeBSD Sponsored by: EMC / Isilon Storage Division r273572: - Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always executed on a non-devfs filesystem - Expect mknod(path, S_IFREG, 0) to fail on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273574: - Test for EINVAL requirement when passing an invalid flag in to msync(2) - Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division r273578: - Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD - Use #include "h_macros.h" instead of relative path analog Sponsored by: EMC / Isilon Storage Division r273579: - Mark signo __unused in the signal handler function - Effectively #if 0 out some code that does not fail on FreeBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273591: Correct my previous commit: - getrusage_utime_back succeeds reliably on FreeBSD - getrusage_utime_zero passes/fails in a seemingly non-deterministic manner. Skip it for now (and fix it later) In the initial port of this testcase to FreeBSD, the results failed reliably in the same manner as it does on NetBSD Sponsored by: EMC / Isilon Storage Division r273592: - Add sys/types.h for the APIs in sys/sysctl.h - Poke at VM_MIN_ADDRESS in machine/vmparam.h because FreeBSD doesn't have a vm.minaddress sysctl analog - Expect ENOMEM instead of EAGAIN in mlock_limits - Provide mlock an mmap'ed page twice to simulate MAP_WIRED on NetBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r273928: Put mtree test files into a subdirectory. Kyua 0.11 points TMPDIR to the test's work directory, and atf_check creates auxiliary files in TMPDIR. This confuses a couple of mtree tests that were using the work directory's root to validate the contents of the directory. Fix the two affected tests by creating an auxiliary directory to use for the mtree tests. (Kyua should probably do this on its own; filed bug #133 upstream to take a look at this.) r273933: Don't prune duplicate services in the expected output from /etc/services on FreeBSD Submitted by: pho r273935: Port tests to FreeBSD/Linux Some of the testcases don't work outside of NetBSD, and the behavior of ether_aton_r differs between FreeBSD, Linux, and NetBSD, and the calls to the API need to be massaged for FreeBSD and Linux. Submitted by: pho r273936: Port lib/libc/net/h_dns_server to FreeBSD Submitted by: pho r273937: Port lib/libc/sys/t_dup to FreeBSD/Linux - The requirements differ between FreeBSD/Linux when dealing with oldd/newd being equal (both fail with EINVAL, not EBADF) - Add an EBADF testcase - Fix compilation issues on clang In collaboration with: pho r273938: getitimer on FreeBSD returns the last set time instead of the remaining time; test for that instead Submitted by: pho r273942: Skip :sethostname_basic because it messes up the test host's hostname Convert code from #if defined(__FreeBSD__) to #ifdef __FreeBSD__ r273943: Port t_kevent to FreeBSD Submitted by: pho r273945: Port t_mincore to FreeBSD Mark :mincore_resid as atf_tc_expect_fail on FreeBSD because of new bug discovered in running the tests (it succeeded from earlier on in the year to September/October on FreeBSD, at least) Submitted by: pho r273946: Port h_atexit to FreeBSD __cxa_atexit varies between FreeBSD and NetBSD, and thus we must use pointers instead of static fields in the BSS. More extensive discussion is included in the source code In collaboration with: kib Submitted by: pho r273947: Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes r273948: Disable testcases 12 and 15-22 on FreeBSD Submitted by: pho r273949: Add new atf_tc_expect_fail to fflush_err; this is a new (within the past couple months) bug r273950: Skip :fopen_regular on !NetBSD because it's a NetBSD specific test Submitted by: pho r273951: Expect :sscanf_whitespace to fail on !NetBSD OSes Submitted by: pho r273952: Port h_hash and t_sha2 to FreeBSD t_sha2 contains dirty copy-paste hacks that need to be fixed with the openssh OpenBSD compat layer Submitted by: pho r274061: Port t_db.sh to FreeBSD - The blocksize on FreeBSD is 32kB, not 64kB - Add some detection for MK_DICT == no; /nonexistent is echoed along with atf_skip to ensure that the test will fail if dict(..) is called in the non-final stage of the pipeline Submitted by: pho r274062: inet_network on FreeBSD returns NULL when provided "0x" to inet_network Submitted by: pho r274066: Port lib/libc/ssp to FreeBSD In most cases, the buffers and data were resized, but when dealing with the helpers, some of the code was adjusted to fail more reliably Submitted by: pho r274067: rpc_control on FreeBSD is a public-ish API (not prefixed with __), not private like NetBSD Submitted by: pho r274072: Finish off lib/libc/stdlib/t_strtod.c port by checking for "y" twice on FreeBSD, and always assume long long double exists on FreeBSD Submitted by: pho r274074: Add Makefile snippet to ease porting NetBSD testcases to FreeBSD from contrib/netbsd-tests This Makefile snippet handles polluting testcases with -lnetbsd, specific headers for ATF version differences, and does necessary rewriting for the testcases to match the format discussed on the TestSuite wiki page (t_<foo> -> <foo>_test) One must define SRCTOP (inspired by projects/bmake), OBJTOP, and TESTSRC (e.g. contrib/netbsd-tests/lib/libc/gen) to use the Makefile snippet Test programs are specific either via NETBSD_ATF_TESTS_C or NETBSD_ATF_TESTS_SH C++ analogs aren't currently implemented. The imported testcases will be cleaned up to use this Makefile snippet pseudo "API". r274079: Import proper fix for misc/49356 (/usr/include/atf-c/config.h) after atf-c/config.h was removed from the build Pointyhat to: me (again, for not running make delete-old after running test builds) r274090: Fix the Jenkins test run by skipping the negative testcases earlier The problem is that lib.libc.locale.t_io:bad_big5_wprintf was printing out illegal Unicode characters, which causes XML parsers to bail immediately, e.g. % kyua report-junit > ~/report.junit % python2 -c 'import xml.dom.minidom as md; md.parse("/home/ngie/report.junit")' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1918, in parse return expatbuilder.parse(file) File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse result = builder.parseFile(fp) File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile parser.Parse(buffer, 0) xml.parsers.expat.ExpatError: not well-formed (invalid token): line 27137, column 13 r274142: Remove expected failure from lib.libc.sys.t_mincore:mincore_resid The failure was added based on observation seen on 11.0-CURRENT @ r273153, not based on internal testing at EMC/Isilon PR: 194829 Tested with the following configuration: - amd64/i386 - 11.0-CURRENT @ r273153 - 100 times in a tight loop as root with the following commands... -- kyua test lib/libc -- kyua test lib/libc/sys -- kyua test lib/libc/sys/mincore_test r274143: Expect lib.libc.sys.getcontext_test.setcontext_link to fail on amd64; add additional debugging to make the underlying problem more visible Calling setcontext(2) on amd64 as shown in the test program is failing on amd64, not i386, with a return code of -1 and an errno of EINVAL Further investigation is being done in the PR to determine the root cause for the failure PR: 194828 Tested with the following configuration: - amd64/i386 - 11.0-CURRENT @ r273153 - 100 times in a tight loop as root with the following commands... -- kyua test lib/libc -- kyua test lib/libc/sys -- kyua test lib/libc/sys/getcontext_test r274571: Use _exit instead of exit so the file descriptors aren't flushed twice in the child processes Submitted by: pho r274572: Only expect timeouts on powerpc with NetBSD Submitted by: pho r274573: Expect :pthread_detach to fail with EINVAL instead of ESRCH on FreeBSD PR: 191906 In collaboration with: pho r274574: Add pthread_np.h #include and initialize the pthread attribute on FreeBSD Submitted by: pho r274575: #ifdef out a printf on !NetBSD that causes the testcase to fail when comparing the output from the helper program Submitted by: pho r274576: Port helper program to FreeBSD, similar to ../../lib/libc/stdlib/h_atexit.c Submitted by: pho In collaboration with: kib r274577: Add missing sys/time.h #include for timespecsub macro in lib/libnetbsd/sys/time.h r274579: Call sem_unlink on semaphores before attempting to create them Due to the lack of uniqueness in the semaphore name, and the fact that the tests don't have cleanup routines, an interrupted test can leave a semaphore "laying around", causing all subsequent attempts to run the test to fail I will file a NetBSD PR for this issue soon r274597: Skip the long-double epsilon checks on FreeBSD/i386 Sponsored by: EMC / Isilon Storage Division r274598: Reset errno to 0 before running scalbn to be sure that the tested errno is valid Sponsored by: EMC / Isilon Storage Division r274599: Alias isinff to isinf on FreeBSD isinf on FreeBSD automatically picks the appropriate type per math.h Sponsored by: EMC / Isilon Storage Division r274600: - Expect exp2_powers to fail on FreeBSD/i386 - Expect exp2_values to fail on FreeBSD due to the small epsilon Sponsored by: EMC / Isilon Storage Division r274601: - Skip over the testcases that call cbrtl on platforms where LDBL_PREC == 53 (arm, mips, powerpc). This fixes the build on these platforms, based on some ad hoc tinderbox runs I did a while ago - Skip cast the arguments to powl as long double so powl properly interprets those arugments at compile-time when picking the type Sponsored by: EMC / Isilon Storage Division r274626: Mechanically replace #if defined(__FreeBSD__) and #if defined(__NetBSD__) with their #ifdef equivalents for everything changed in contrib/netbsd-tests. There are some items from the vendor tree that use #if defined(__FreeBSD__) or #if defined(__NetBSD__) which are being left alone Requested by: bde, rpaulo Sponsored by: EMC / Isilon Storage Division r275033: Only pass 6 arguments to the 'run' function on amd64. amd64's makecontext on FreeBSD only supports a maximum of 6 arguments. This fixes the setcontext_link test on amd64. PR: 194828 r276046: Add __FreeBSD_version guards around hsearch_r to ease MFCing the code to stable/10 It was added when __FreeBSD_version was ~1100027 r276430: Expect access_test:access_inval to fail before __FreeBSD_version == 1100033 This will allow me to MFC the test, as jilles@ requested that I don't MFC the access(2) KBI change to 10-STABLE in r271655
This commit is contained in:
parent
155ee9c2f7
commit
b429a2bfd1
38
contrib/netbsd-tests/FREEBSD-upgrade
Normal file
38
contrib/netbsd-tests/FREEBSD-upgrade
Normal file
@ -0,0 +1,38 @@
|
||||
$FreeBSD$
|
||||
|
||||
This document contains a collection of notes specific to the import
|
||||
of the NetBSD test suite into head. These notes are built on the instructions
|
||||
in the FreeBSD Subversion Primer that detail how to deal with vendor
|
||||
branches and you are supposed to follow those:
|
||||
|
||||
http://www.freebsd.org/doc/en/articles/committers-guide/subversion-primer.html
|
||||
|
||||
The NetBSD test source code was originally obtained via NetBSD anoncvs as
|
||||
described in the NetBSD handbook:
|
||||
|
||||
http://www.netbsd.org/docs/guide/en/chap-fetch.html#chap-fetch-cvs
|
||||
|
||||
and is imported into the NetBSD/tests vendor branch (see
|
||||
base/vendor/NetBSD/tests/).
|
||||
|
||||
The process used to bootstrap the vendor tree was similar to the following:
|
||||
|
||||
/bin/sh
|
||||
export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
|
||||
cvs -z9 co -D "09/30/2014 20:45" -P src/tests
|
||||
mv src/tests/* tests/dist/.
|
||||
|
||||
Please adjust the checkout date spec (the argument passed via -D) to match
|
||||
the desired checkout time.
|
||||
|
||||
To merge the vendor branch into head do something like this:
|
||||
|
||||
cd .../base/head/contrib/netbsd-tests
|
||||
svn merge --accept=postpone \
|
||||
svn+ssh://svn.freebsd.org/base/vendor/NetBSD/tests/dist .
|
||||
find . -name Makefile\* | xargs svn rm --force
|
||||
|
||||
and resolve any conflicts that may arise at this point.
|
||||
|
||||
Lastly, with the list of old and new files in this import, make sure
|
||||
to update the reachover Makefiles accordingly.
|
3
contrib/netbsd-tests/bin/cat/d_align.in
Normal file
3
contrib/netbsd-tests/bin/cat/d_align.in
Normal file
@ -0,0 +1,3 @@
|
||||
a b c
|
||||
1 2 3
|
||||
x y z
|
3
contrib/netbsd-tests/bin/cat/d_align.out
Normal file
3
contrib/netbsd-tests/bin/cat/d_align.out
Normal file
@ -0,0 +1,3 @@
|
||||
1 a b c$
|
||||
2 1 2 3$
|
||||
3 x y z$
|
59
contrib/netbsd-tests/bin/cat/t_cat.sh
Executable file
59
contrib/netbsd-tests/bin/cat/t_cat.sh
Executable file
@ -0,0 +1,59 @@
|
||||
# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jukka Ruohonen.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case align
|
||||
align_head() {
|
||||
atf_set "descr" "Test that cat(1) aligns the output " \
|
||||
"right with options '-be' (PR bin/4841)"
|
||||
}
|
||||
|
||||
align_body() {
|
||||
|
||||
atf_check -s ignore -o file:$(atf_get_srcdir)/d_align.out \
|
||||
-x "cat -be $(atf_get_srcdir)/d_align.in"
|
||||
}
|
||||
|
||||
atf_test_case nonexistent
|
||||
nonexistent_head() {
|
||||
atf_set "descr" "Test that cat(1) doesn't return zero exit " \
|
||||
"status for a nonexistent file (PR bin/3538)"
|
||||
}
|
||||
|
||||
nonexistent_body() {
|
||||
|
||||
atf_check -s not-exit:0 -o empty -e not-empty \
|
||||
-x "cat /some/name/that/does/not/exist"
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case align
|
||||
atf_add_test_case nonexistent
|
||||
}
|
294
contrib/netbsd-tests/bin/cp/t_cp.sh
Executable file
294
contrib/netbsd-tests/bin/cp/t_cp.sh
Executable file
@ -0,0 +1,294 @@
|
||||
# $NetBSD: t_cp.sh,v 1.1 2012/03/17 16:33:10 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
FILES="file file2 file3 link dir dir2 dirlink target"
|
||||
|
||||
cleanup() {
|
||||
rm -fr ${FILES}
|
||||
}
|
||||
|
||||
cp_compare() {
|
||||
echo "Ensuring that $2 and $3 are identical"
|
||||
cmp -s $2 $3 || atf_fail "$2 and $3 are different"
|
||||
}
|
||||
|
||||
reset() {
|
||||
cleanup
|
||||
echo "I'm a file" > file
|
||||
echo "I'm a file, 2" > file2
|
||||
echo "I'm a file, 3" > file3
|
||||
ln -s file link
|
||||
mkdir dir
|
||||
ln -s dir dirlink
|
||||
}
|
||||
|
||||
atf_test_case file_to_file
|
||||
file_to_file_head() {
|
||||
atf_set "descr" "Checks the copy of a file to a file"
|
||||
}
|
||||
file_to_file_body() {
|
||||
reset
|
||||
|
||||
file_to_file_simple
|
||||
file_to_file_preserve
|
||||
file_to_file_noflags
|
||||
}
|
||||
|
||||
file_to_file_simple() {
|
||||
rm -f file2
|
||||
umask 022
|
||||
chmod 777 file
|
||||
atf_check -s eq:0 -o empty -e empty cp file file2
|
||||
cp_compare file_to_file_simple file file2
|
||||
if [ `stat -f "%Lp" file2` != "755" ]; then
|
||||
atf_fail "new file not created with umask"
|
||||
fi
|
||||
|
||||
chmod 644 file
|
||||
chmod 777 file2
|
||||
cp_compare file_to_file_simple file file2
|
||||
if [ `stat -f "%Lp" file2` != "777" ]; then
|
||||
atf_fail "existing files permissions not retained"
|
||||
fi
|
||||
}
|
||||
|
||||
file_to_file_preserve() {
|
||||
rm file3
|
||||
chmod 644 file
|
||||
chflags nodump file
|
||||
atf_check -s eq:0 -o empty -e empty cp -p file file3
|
||||
finfo=`stat -f "%p%u%g%m%z%f" file`
|
||||
f3info=`stat -f "%p%u%g%m%z%f" file3`
|
||||
if [ $finfo != $f3info ]; then
|
||||
atf_fail "attributes not preserved"
|
||||
fi
|
||||
}
|
||||
|
||||
file_to_file_noflags() {
|
||||
rm file3
|
||||
chmod 644 file
|
||||
chflags nodump file
|
||||
atf_check -s eq:0 -o empty -e empty cp -p -N file file3
|
||||
finfo=`stat -f "%f" file`
|
||||
f3info=`stat -f "%f" file3`
|
||||
if [ $finfo = $f3info ]; then
|
||||
atf_fail "-p -N preserved file flags"
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case file_to_link
|
||||
file_to_link_head() {
|
||||
atf_set "descr" "Checks the copy of a file to a symbolic link"
|
||||
}
|
||||
file_to_link_body() {
|
||||
reset
|
||||
atf_check -s eq:0 -o empty -e empty cp file2 link
|
||||
cp_compare file_to_link file file2
|
||||
}
|
||||
|
||||
atf_test_case link_to_file
|
||||
link_to_file_head() {
|
||||
atf_set "descr" "Checks the copy of a symbolic link to a file"
|
||||
}
|
||||
link_to_file_body() {
|
||||
reset
|
||||
# file and link are identical (not copied).
|
||||
atf_check -s eq:1 -o empty -e ignore cp link file
|
||||
atf_check -s eq:0 -o empty -e empty cp link file2
|
||||
cp_compare link_to_file file file2
|
||||
}
|
||||
|
||||
atf_test_case file_over_link
|
||||
file_over_link_head() {
|
||||
atf_set "descr" "Checks the copy of a file to a symbolic link" \
|
||||
"without following it"
|
||||
}
|
||||
file_over_link_body() {
|
||||
reset
|
||||
atf_check -s eq:0 -o empty -e empty cp -P file link
|
||||
cp_compare file_over_link file link
|
||||
}
|
||||
|
||||
atf_test_case link_over_file
|
||||
link_over_file_head() {
|
||||
atf_set "descr" "Checks the copy of a symbolic link to a file" \
|
||||
"without following the former"
|
||||
}
|
||||
link_over_file_body() {
|
||||
reset
|
||||
atf_check -s eq:0 -o empty -e empty cp -P link file
|
||||
if [ `readlink link` != `readlink file` ]; then
|
||||
atf_fail "readlink link != readlink file"
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case files_to_dir
|
||||
files_to_dir_head() {
|
||||
atf_set "descr" "Checks the copy of multiple files into a directory"
|
||||
}
|
||||
files_to_dir_body() {
|
||||
reset
|
||||
# can't copy multiple files to a file
|
||||
atf_check -s eq:1 -o empty -e ignore cp file file2 file3
|
||||
atf_check -s eq:0 -o empty -e empty cp file file2 link dir
|
||||
cp_compare files_to_dir file "dir/file"
|
||||
}
|
||||
|
||||
atf_test_case dir_to_file
|
||||
dir_to_file_head() {
|
||||
atf_set "descr" "Checks the copy of a directory onto a file, which" \
|
||||
"should not work"
|
||||
}
|
||||
dir_to_file_body() {
|
||||
reset
|
||||
# can't copy a dir onto a file
|
||||
atf_check -s eq:1 -o empty -e ignore cp dir file
|
||||
atf_check -s eq:1 -o empty -e ignore cp -R dir file
|
||||
}
|
||||
|
||||
atf_test_case file_to_linkdir
|
||||
file_to_linkdir_head() {
|
||||
atf_set "descr" "Checks the copy of a file to a symbolic link that" \
|
||||
"points to a directory"
|
||||
}
|
||||
file_to_linkdir_body() {
|
||||
reset
|
||||
atf_check -s eq:0 -o empty -e empty cp file dirlink
|
||||
cp_compare file_to_linkdir file "dir/file"
|
||||
|
||||
# overwrite the link
|
||||
atf_check -s eq:0 -o empty -e empty cp -P file dirlink
|
||||
atf_check -s eq:1 -o empty -e empty readlink dirlink
|
||||
cp_compare file_to_linkdir file dirlink
|
||||
}
|
||||
|
||||
atf_test_case linkdir_to_file
|
||||
linkdir_to_file_head() {
|
||||
atf_set "descr" "Checks the copy of a symbolic link that points to" \
|
||||
"a directory onto a file"
|
||||
}
|
||||
linkdir_to_file_body() {
|
||||
reset
|
||||
# cannot copy a dir onto a file
|
||||
atf_check -s eq:1 -o empty -e ignore cp dirlink file
|
||||
|
||||
# overwrite the link
|
||||
atf_check -s eq:0 -o empty -e empty cp -P dirlink file
|
||||
if [ `readlink file` != `readlink dirlink` ]; then
|
||||
atf_fail "readlink link != readlink file"
|
||||
fi
|
||||
}
|
||||
|
||||
dir_to_dne_no_R() {
|
||||
atf_check -s eq:1 -o empty -e ignore cp dir dir2
|
||||
}
|
||||
|
||||
dir_to_dne() {
|
||||
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
|
||||
cp_compare dir_to_dne "dir/file" "dir2/file"
|
||||
readlink dir2/link >/dev/null
|
||||
if [ $? -gt 0 ]; then
|
||||
atf_fail "-R didn't copy a link as a link"
|
||||
fi
|
||||
}
|
||||
|
||||
dir_to_dir_H() {
|
||||
dir_to_dir_setup
|
||||
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
|
||||
|
||||
chmod 777 dir
|
||||
|
||||
# copy a dir into a dir, only command-line links are followed
|
||||
atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
|
||||
cp_compare dir_to_dir_H "dir/file" "dir2/dirlink/file"
|
||||
readlink dir2/dirlink/link >/dev/null
|
||||
if [ $? -gt 0 ]; then
|
||||
atf_fail "didn't copy a link as a link"
|
||||
fi
|
||||
|
||||
# Created directories have the same mode as the corresponding
|
||||
# source directory, unmodified by the process's umask.
|
||||
if [ `stat -f "%Lp" dir2/dirlink` != "777" ]; then
|
||||
atf_fail "-R modified dir perms with umask"
|
||||
fi
|
||||
}
|
||||
|
||||
dir_to_dir_L() {
|
||||
dir_to_dir_setup
|
||||
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
|
||||
atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
|
||||
|
||||
# copy a dir into a dir, following all links
|
||||
atf_check -s eq:0 -o empty -e empty cp -R -H -L dirlink dir2/dirlink
|
||||
cp_compare dir_to_dir_L "dir/file" "dir2/dirlink/dirlink/file"
|
||||
# fail if -R -L copied a link as a link
|
||||
atf_check -s eq:1 -o ignore -e empty readlink dir2/dirlink/dirlink/link
|
||||
}
|
||||
|
||||
dir_to_dir_subdir_exists() {
|
||||
# recursively copy a dir into another dir, with some subdirs already
|
||||
# existing
|
||||
cleanup
|
||||
|
||||
mkdir -p dir/1 dir/2 dir/3 target/2
|
||||
echo "file" > dir/2/file
|
||||
atf_check -s eq:0 -o empty -e empty cp -R dir/* target
|
||||
cp_compare dir_to_dir_subdir_exists "dir/2/file" "target/2/file"
|
||||
}
|
||||
|
||||
dir_to_dir_setup() {
|
||||
reset
|
||||
umask 077
|
||||
cp -P file file2 file3 link dir
|
||||
}
|
||||
|
||||
atf_test_case dir_to_dir
|
||||
dir_to_dir_head() {
|
||||
atf_set "descr" "Checks the copy of a directory onto another directory"
|
||||
}
|
||||
dir_to_dir_body() {
|
||||
dir_to_dir_setup
|
||||
dir_to_dne_no_R
|
||||
dir_to_dne
|
||||
dir_to_dir_H
|
||||
dir_to_dir_L
|
||||
dir_to_dir_subdir_exists
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case file_to_file
|
||||
atf_add_test_case file_to_link
|
||||
atf_add_test_case link_to_file
|
||||
atf_add_test_case file_over_link
|
||||
atf_add_test_case link_over_file
|
||||
atf_add_test_case files_to_dir
|
||||
atf_add_test_case file_to_linkdir
|
||||
atf_add_test_case linkdir_to_file
|
||||
atf_add_test_case dir_to_file
|
||||
atf_add_test_case dir_to_dir
|
||||
}
|
130
contrib/netbsd-tests/bin/dd/t_dd.sh
Executable file
130
contrib/netbsd-tests/bin/dd/t_dd.sh
Executable file
@ -0,0 +1,130 @@
|
||||
# $NetBSD: t_dd.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
test_dd_length() {
|
||||
result=$1
|
||||
cmd=$2
|
||||
set -- x `eval $cmd | wc -c`
|
||||
res=$2
|
||||
if [ x"$res" != x"$result" ]; then
|
||||
atf_fail "Expected $result bytes of output, got $res: $cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case length
|
||||
length_head() {
|
||||
# XXX The PR should be stored in a tag.
|
||||
atf_set "descr" "Test for result messages accidentally pumped into" \
|
||||
"the output file if the standard IO descriptors are" \
|
||||
"closed. The last of the three following tests is" \
|
||||
"the one expected to fail. (NetBSD PR bin/8521)"
|
||||
}
|
||||
length_body() {
|
||||
test_dd_length 512 \
|
||||
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >/dev/null 2>/dev/null"
|
||||
test_dd_length 512 \
|
||||
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>/dev/null"
|
||||
test_dd_length 512 \
|
||||
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>&-"
|
||||
}
|
||||
|
||||
test_dd_io() {
|
||||
res="`echo -n "$2" | eval $1`"
|
||||
if [ x"$res" != x"$3" ]; then
|
||||
atf_fail "Expected \"$3\", got \"$res\": $1"
|
||||
fi
|
||||
}
|
||||
|
||||
allbits1="\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"
|
||||
|
||||
ebcdicbits1="\000\001\002\003\067\055\056\057\026\005\045\013\014\015\016\017\020\021\022\023\074\075\062\046\030\031\077\047\034\035\036\037\100\132\177\173\133\154\120\175\115\135\134\116\153\140\113\141\360\361\362\363\364\365\366\367\370\371\172\136\114\176\156\157\174\301\302\303\304\305\306\307\310\311\321\322\323\324\325\326\327\330\331\342\343\344\345\346\347\350\351\255\340\275\232\155\171\201\202\203\204\205\206\207\210\211\221\222\223\224\225\226\227\230\231\242\243\244\245\246\247\250\251\300\117\320\137\007\040\041\042\043\044\025\006\027\050\051\052\053\054\011\012\033\060\061\032\063\064\065\066\010\070\071\072\073\004\024\076\341\101\102\103\104\105\106\107\110\111\121\122\123\124\125\126\127\130\131\142\143\144\145\146\147\150\151\160\161\162\163\164\165\166\167\170\200\212\213\214\215\216\217\220\152\233\234\235\236\237\240\252\253\254\112\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\241\276\277\312\313\314\315\316\317\332\333\334\335\336\337\352\353\354\355\356\357\372\373\374\375\376\377"
|
||||
|
||||
allvisbits=`echo -n "$allbits1" | unvis | vis`
|
||||
ebcdicvisbits=`echo -n "$ebcdicbits1" | unvis | vis`
|
||||
|
||||
atf_test_case io
|
||||
io_head() {
|
||||
atf_set "descr" "This checks the combination of bs= with" \
|
||||
"conv=ebcdic. Prior to revision 1.24 of dd's" \
|
||||
"args.c, the conv option would be ignored."
|
||||
}
|
||||
io_body() {
|
||||
test_dd_io "unvis | dd 2>/dev/null | vis" \
|
||||
"$allvisbits" "$allvisbits"
|
||||
test_dd_io "unvis | dd ibs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$allvisbits"
|
||||
test_dd_io "unvis | dd obs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$allvisbits"
|
||||
test_dd_io "unvis | dd bs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$allvisbits"
|
||||
|
||||
test_dd_io "unvis | dd conv=ebcdic 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic ibs=512 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic obs=512 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic bs=512 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
|
||||
test_dd_io "unvis | dd conv=ebcdic 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic ibs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic obs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
test_dd_io "unvis | dd conv=ebcdic bs=1 2>/dev/null | vis" \
|
||||
"$allvisbits" "$ebcdicvisbits"
|
||||
}
|
||||
|
||||
atf_test_case seek
|
||||
seek_head() {
|
||||
atf_set "descr" "Tests output file seeking"
|
||||
}
|
||||
|
||||
seek_body() {
|
||||
echo TEST1234 > testfile
|
||||
atf_check -s exit:0 -e ignore \
|
||||
dd if=/dev/zero of=testfile seek=1 bs=8k count=1
|
||||
atf_check -s exit:0 -e ignore -o match:'^TEST1234$' dd if=testfile
|
||||
eval $(stat -s testfile)
|
||||
atf_check_equal $st_size $((2*8192))
|
||||
|
||||
echo -n TEST1234 > tf2
|
||||
atf_check -s exit:0 -e ignore -x \
|
||||
'dd bs=4 if=/dev/zero count=1 | tr \\0 \\n | dd of=tf2 bs=4 seek=1'
|
||||
atf_check -s exit:0 -e ignore -o match:'^TEST$' dd if=tf2
|
||||
eval $(stat -s tf2)
|
||||
atf_check_equal $st_size 8
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case length
|
||||
atf_add_test_case io
|
||||
atf_add_test_case seek
|
||||
}
|
218
contrib/netbsd-tests/bin/df/getmntinfo.c
Normal file
218
contrib/netbsd-tests/bin/df/getmntinfo.c
Normal file
@ -0,0 +1,218 @@
|
||||
/* $NetBSD: getmntinfo.c,v 1.1 2012/03/17 16:33:11 jruoho Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define KB * 1024
|
||||
#define MB * 1024 KB
|
||||
#define GB * 1024 MB
|
||||
|
||||
static struct statvfs *getnewstatvfs(void);
|
||||
static void other_variants(const struct statvfs *, const int *, int,
|
||||
const int *, int);
|
||||
static void setup_filer(void);
|
||||
static void setup_ld0g(void);
|
||||
static void setup_strpct(void);
|
||||
|
||||
static struct statvfs *allstatvfs;
|
||||
static int sftotal, sfused;
|
||||
|
||||
struct statvfs *
|
||||
getnewstatvfs(void)
|
||||
{
|
||||
|
||||
if (sftotal == sfused) {
|
||||
sftotal = sftotal ? sftotal * 2 : 1;
|
||||
allstatvfs = realloc(allstatvfs,
|
||||
sftotal * sizeof(struct statvfs));
|
||||
if (allstatvfs == NULL)
|
||||
err(EXIT_FAILURE, "realloc");
|
||||
}
|
||||
|
||||
return (&allstatvfs[sfused++]);
|
||||
}
|
||||
|
||||
void
|
||||
other_variants(const struct statvfs *tmpl, const int *minfree, int minfreecnt,
|
||||
const int *consumed, int consumedcnt)
|
||||
{
|
||||
int64_t total, used;
|
||||
struct statvfs *sf;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < minfreecnt; i++)
|
||||
for (j = 0; j < consumedcnt; j++) {
|
||||
sf = getnewstatvfs();
|
||||
*sf = *tmpl;
|
||||
total = (int64_t)(u_long)sf->f_blocks * sf->f_bsize;
|
||||
used = total * consumed[j] / 100;
|
||||
sf->f_bfree = (total - used) / sf->f_bsize;
|
||||
sf->f_bavail = (total * (100 - minfree[i]) / 100 -
|
||||
used) / (int)sf->f_bsize;
|
||||
sf->f_bresvd = sf->f_bfree - sf->f_bavail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parameter taken from:
|
||||
* http://mail-index.NetBSD.org/tech-userlevel/2004/03/24/0001.html
|
||||
*/
|
||||
void
|
||||
setup_filer(void)
|
||||
{
|
||||
static const struct statvfs tmpl = {
|
||||
#define BSIZE 512
|
||||
#define TOTAL 1147ULL GB
|
||||
#define USED 132ULL MB
|
||||
.f_bsize = BSIZE,
|
||||
.f_frsize = BSIZE,
|
||||
.f_blocks = TOTAL / BSIZE,
|
||||
.f_bfree = (TOTAL - USED) / BSIZE,
|
||||
.f_bavail = (TOTAL - USED) / BSIZE,
|
||||
.f_bresvd = 0,
|
||||
.f_mntfromname = "filer:/",
|
||||
.f_mntonname = "/filer",
|
||||
#undef USED
|
||||
#undef TOTAL
|
||||
#undef BSIZE
|
||||
};
|
||||
static const int minfree[] = { 0, 5, 10, 15, };
|
||||
static const int consumed[] = { 0, 20, 60, 95, 100 };
|
||||
|
||||
*getnewstatvfs() = tmpl;
|
||||
other_variants(&tmpl, minfree, sizeof(minfree) / sizeof(minfree[0]),
|
||||
consumed, sizeof(consumed) / sizeof(consumed[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
* Parameter taken from:
|
||||
* http://mail-index.NetBSD.org/current-users/2004/03/01/0038.html
|
||||
*/
|
||||
void
|
||||
setup_ld0g(void)
|
||||
{
|
||||
static const struct statvfs tmpl = {
|
||||
#define BSIZE 4096 /* Guess */
|
||||
#define TOTAL 1308726116ULL KB
|
||||
#define USED 17901268ULL KB
|
||||
#define AVAIL 1225388540ULL KB
|
||||
.f_bsize = BSIZE,
|
||||
.f_frsize = BSIZE,
|
||||
.f_blocks = TOTAL / BSIZE,
|
||||
.f_bfree = (TOTAL - USED) / BSIZE,
|
||||
.f_bavail = AVAIL / BSIZE,
|
||||
.f_bresvd = (TOTAL - USED) / BSIZE - AVAIL / BSIZE,
|
||||
.f_mntfromname = "/dev/ld0g",
|
||||
.f_mntonname = "/anon-root",
|
||||
#undef AVAIL
|
||||
#undef USED
|
||||
#undef TOTAL
|
||||
#undef BSIZE
|
||||
};
|
||||
static const int minfree[] = { 0, 5, 10, 15, };
|
||||
static const int consumed[] = { 0, 20, 60, 95, 100 };
|
||||
|
||||
*getnewstatvfs() = tmpl;
|
||||
other_variants(&tmpl, minfree, sizeof(minfree) / sizeof(minfree[0]),
|
||||
consumed, sizeof(consumed) / sizeof(consumed[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
* Test of strpct() with huge number.
|
||||
*/
|
||||
void
|
||||
setup_strpct(void)
|
||||
{
|
||||
static const struct statvfs tmpl = {
|
||||
#define BSIZE 4096 /* Guess */
|
||||
#define TOTAL 0x4ffffffffULL KB
|
||||
#define USED (TOTAL / 2)
|
||||
#define AVAIL (TOTAL / 2)
|
||||
.f_bsize = BSIZE,
|
||||
.f_frsize = BSIZE,
|
||||
.f_blocks = TOTAL / BSIZE,
|
||||
.f_bfree = (TOTAL - USED) / BSIZE,
|
||||
.f_bavail = AVAIL / BSIZE,
|
||||
.f_bresvd = (TOTAL - USED) / BSIZE - AVAIL / BSIZE,
|
||||
.f_mntfromname = "/dev/strpct",
|
||||
.f_mntonname = "/strpct",
|
||||
#undef AVAIL
|
||||
#undef USED
|
||||
#undef TOTAL
|
||||
#undef BSIZE
|
||||
};
|
||||
|
||||
*getnewstatvfs() = tmpl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parameter taken from:
|
||||
* http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=23600
|
||||
*/
|
||||
static void
|
||||
setup_pr23600(void)
|
||||
{
|
||||
static const struct statvfs tmpl = {
|
||||
#define BSIZE 512
|
||||
#define TOTAL 20971376ULL
|
||||
#define USED 5719864ULL
|
||||
#define AVAIL 15251512ULL
|
||||
.f_bsize = BSIZE,
|
||||
.f_frsize = BSIZE,
|
||||
.f_blocks = TOTAL,
|
||||
.f_bfree = TOTAL - USED,
|
||||
.f_bavail = AVAIL,
|
||||
.f_bresvd = TOTAL - USED - AVAIL,
|
||||
.f_mntfromname = "/dev/wd0e",
|
||||
.f_mntonname = "/mount/windows/C",
|
||||
#undef AVAIL
|
||||
#undef USED
|
||||
#undef TOTAL
|
||||
#undef BSIZE
|
||||
};
|
||||
|
||||
*getnewstatvfs() = tmpl;
|
||||
}
|
||||
|
||||
int
|
||||
getmntinfo(struct statvfs **mntbuf, int flags)
|
||||
{
|
||||
|
||||
setup_filer();
|
||||
setup_ld0g();
|
||||
setup_strpct();
|
||||
setup_pr23600();
|
||||
|
||||
*mntbuf = allstatvfs;
|
||||
return (sfused);
|
||||
}
|
148
contrib/netbsd-tests/bin/df/t_df.sh
Executable file
148
contrib/netbsd-tests/bin/df/t_df.sh
Executable file
@ -0,0 +1,148 @@
|
||||
# $NetBSD: t_df.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case normal
|
||||
normal_head() {
|
||||
atf_set "descr" "Checks that the output of df without flags is" \
|
||||
"correct according to some already-known, sane" \
|
||||
"output"
|
||||
}
|
||||
normal_body() {
|
||||
cat >expout <<EOF
|
||||
Filesystem 1K-blocks Used Avail %Cap Mounted on
|
||||
filer:/ 1202716672 135168 1202581504 0% /filer
|
||||
filer:/ 1202716672 0 1202716672 0% /filer
|
||||
filer:/ 1202716672 240543334 962173337 20% /filer
|
||||
filer:/ 1202716672 721630003 481086668 60% /filer
|
||||
filer:/ 1202716672 1142580838 60135833 95% /filer
|
||||
filer:/ 1202716672 1202716672 0 100% /filer
|
||||
filer:/ 1202716672 0 1142580838 0% /filer
|
||||
filer:/ 1202716672 240543334 902037504 21% /filer
|
||||
filer:/ 1202716672 721630003 420950835 63% /filer
|
||||
filer:/ 1202716672 1142580838 0 100% /filer
|
||||
filer:/ 1202716672 1202716672 -60135833 105% /filer
|
||||
filer:/ 1202716672 0 1082445004 0% /filer
|
||||
filer:/ 1202716672 240543334 841901670 22% /filer
|
||||
filer:/ 1202716672 721630003 360815001 66% /filer
|
||||
filer:/ 1202716672 1142580838 -60135833 105% /filer
|
||||
filer:/ 1202716672 1202716672 -120271667 111% /filer
|
||||
filer:/ 1202716672 0 1022309171 0% /filer
|
||||
filer:/ 1202716672 240543334 781765836 23% /filer
|
||||
filer:/ 1202716672 721630003 300679168 70% /filer
|
||||
filer:/ 1202716672 1142580838 -120271667 111% /filer
|
||||
filer:/ 1202716672 1202716672 -180407500 117% /filer
|
||||
/dev/ld0g 1308726116 17901268 1225388540 1% /anon-root
|
||||
/dev/ld0g 1308726116 0 1308726116 0% /anon-root
|
||||
/dev/ld0g 1308726116 261745224 1046980892 20% /anon-root
|
||||
/dev/ld0g 1308726116 785235672 523490444 60% /anon-root
|
||||
/dev/ld0g 1308726116 1243289812 65436304 95% /anon-root
|
||||
/dev/ld0g 1308726116 1308726116 0 100% /anon-root
|
||||
/dev/ld0g 1308726116 0 1243289808 0% /anon-root
|
||||
/dev/ld0g 1308726116 261745224 981544584 21% /anon-root
|
||||
/dev/ld0g 1308726116 785235672 458054140 63% /anon-root
|
||||
/dev/ld0g 1308726116 1243289812 0 100% /anon-root
|
||||
/dev/ld0g 1308726116 1308726116 -65436304 105% /anon-root
|
||||
/dev/ld0g 1308726116 0 1177853504 0% /anon-root
|
||||
/dev/ld0g 1308726116 261745224 916108280 22% /anon-root
|
||||
/dev/ld0g 1308726116 785235672 392617832 66% /anon-root
|
||||
/dev/ld0g 1308726116 1243289812 -65436304 105% /anon-root
|
||||
/dev/ld0g 1308726116 1308726116 -130872608 111% /anon-root
|
||||
/dev/ld0g 1308726116 0 1112417196 0% /anon-root
|
||||
/dev/ld0g 1308726116 261745224 850671972 23% /anon-root
|
||||
/dev/ld0g 1308726116 785235672 327181528 70% /anon-root
|
||||
/dev/ld0g 1308726116 1243289812 -130872608 111% /anon-root
|
||||
/dev/ld0g 1308726116 1308726116 -196308916 117% /anon-root
|
||||
/dev/strpct 21474836476 10737418240 10737418236 50% /strpct
|
||||
/dev/wd0e 10485688 2859932 7625756 27% /mount/windows/C
|
||||
EOF
|
||||
atf_check -s eq:0 -o file:expout -e empty \
|
||||
-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
|
||||
}
|
||||
|
||||
atf_test_case hflag
|
||||
hflag_head() {
|
||||
atf_set "descr" "Checks that the output of df is correct according" \
|
||||
"to some already-known, sane output when using the" \
|
||||
"human readable format"
|
||||
}
|
||||
hflag_body() {
|
||||
cat >expout <<EOF
|
||||
Filesystem Size Used Avail %Cap Mounted on
|
||||
filer:/ 1.1T 132M 1.1T 0% /filer
|
||||
filer:/ 1.1T 0B 1.1T 0% /filer
|
||||
filer:/ 1.1T 229G 918G 20% /filer
|
||||
filer:/ 1.1T 688G 459G 60% /filer
|
||||
filer:/ 1.1T 1.1T 57G 95% /filer
|
||||
filer:/ 1.1T 1.1T 0B 100% /filer
|
||||
filer:/ 1.1T 0B 1.1T 0% /filer
|
||||
filer:/ 1.1T 229G 860G 21% /filer
|
||||
filer:/ 1.1T 688G 401G 63% /filer
|
||||
filer:/ 1.1T 1.1T 0B 100% /filer
|
||||
filer:/ 1.1T 1.1T -57G 105% /filer
|
||||
filer:/ 1.1T 0B 1.0T 0% /filer
|
||||
filer:/ 1.1T 229G 803G 22% /filer
|
||||
filer:/ 1.1T 688G 344G 66% /filer
|
||||
filer:/ 1.1T 1.1T -57G 105% /filer
|
||||
filer:/ 1.1T 1.1T -115G 111% /filer
|
||||
filer:/ 1.1T 0B 975G 0% /filer
|
||||
filer:/ 1.1T 229G 746G 23% /filer
|
||||
filer:/ 1.1T 688G 287G 70% /filer
|
||||
filer:/ 1.1T 1.1T -115G 111% /filer
|
||||
filer:/ 1.1T 1.1T -172G 117% /filer
|
||||
/dev/ld0g 1.2T 17G 1.1T 1% /anon-root
|
||||
/dev/ld0g 1.2T 0B 1.2T 0% /anon-root
|
||||
/dev/ld0g 1.2T 250G 998G 20% /anon-root
|
||||
/dev/ld0g 1.2T 749G 499G 60% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T 62G 95% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T 0B 100% /anon-root
|
||||
/dev/ld0g 1.2T 0B 1.2T 0% /anon-root
|
||||
/dev/ld0g 1.2T 250G 936G 21% /anon-root
|
||||
/dev/ld0g 1.2T 749G 437G 63% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T 0B 100% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T -62G 105% /anon-root
|
||||
/dev/ld0g 1.2T 0B 1.1T 0% /anon-root
|
||||
/dev/ld0g 1.2T 250G 874G 22% /anon-root
|
||||
/dev/ld0g 1.2T 749G 374G 66% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T -62G 105% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T -125G 111% /anon-root
|
||||
/dev/ld0g 1.2T 0B 1.0T 0% /anon-root
|
||||
/dev/ld0g 1.2T 250G 811G 23% /anon-root
|
||||
/dev/ld0g 1.2T 749G 312G 70% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T -125G 111% /anon-root
|
||||
/dev/ld0g 1.2T 1.2T -187G 117% /anon-root
|
||||
/dev/strpct 20T 10T 10T 50% /strpct
|
||||
/dev/wd0e 10G 2.7G 7.3G 27% /mount/windows/C
|
||||
EOF
|
||||
atf_check -s eq:0 -o file:expout -e empty \
|
||||
-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case normal
|
||||
atf_add_test_case hflag
|
||||
}
|
228
contrib/netbsd-tests/bin/expr/t_expr.sh
Executable file
228
contrib/netbsd-tests/bin/expr/t_expr.sh
Executable file
@ -0,0 +1,228 @@
|
||||
# $NetBSD: t_expr.sh,v 1.3 2012/03/27 07:23:06 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# The first arg will get eval'd so escape any meta characters
|
||||
# The 2nd arg is an expected string/response from expr for that op.
|
||||
test_expr() {
|
||||
echo "Expression '${1}', expecting '${2}'"
|
||||
res=`eval expr $1 2>&1`
|
||||
if [ "$res" != "$2" ]; then
|
||||
atf_fail "Expected $2, got $res from expression: " \
|
||||
"`eval echo $1`"
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case lang
|
||||
lang_ops_head() {
|
||||
atf_set "descr" "Test that expr(1) works with non-C LANG (PR bin/2486)"
|
||||
}
|
||||
lang_body() {
|
||||
|
||||
export LANG=nonexistent
|
||||
atf_check -s exit:0 -o inline:"21\n" -e empty -x "expr 10 + 11"
|
||||
|
||||
export LANG=ru_RU.KOI8-R
|
||||
atf_check -s exit:0 -o inline:"21\n" -e empty -x "expr 10 + 11"
|
||||
}
|
||||
|
||||
atf_test_case overflow
|
||||
overflow_head() {
|
||||
atf_set "descr" "Test overflow cases"
|
||||
}
|
||||
overflow_body() {
|
||||
test_expr '4611686018427387904 + 4611686018427387903' \
|
||||
'9223372036854775807'
|
||||
test_expr '4611686018427387904 + 4611686018427387904' \
|
||||
"expr: integer overflow or underflow occurred for operation '4611686018427387904 + 4611686018427387904'"
|
||||
test_expr '4611686018427387904 - -4611686018427387904' \
|
||||
"expr: integer overflow or underflow occurred for operation '4611686018427387904 - -4611686018427387904'"
|
||||
test_expr '-4611686018427387904 - 4611686018427387903' \
|
||||
'-9223372036854775807'
|
||||
test_expr '-4611686018427387904 - 4611686018427387905' \
|
||||
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 - 4611686018427387905'"
|
||||
test_expr '-4611686018427387904 \* 1' '-4611686018427387904'
|
||||
test_expr '-4611686018427387904 \* -1' '4611686018427387904'
|
||||
test_expr '-4611686018427387904 \* 2' '-9223372036854775808'
|
||||
test_expr '-4611686018427387904 \* 3' \
|
||||
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 * 3'"
|
||||
test_expr '-4611686018427387904 \* -2' \
|
||||
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 * -2'"
|
||||
test_expr '4611686018427387904 \* 1' '4611686018427387904'
|
||||
test_expr '4611686018427387904 \* 2' \
|
||||
"expr: integer overflow or underflow occurred for operation '4611686018427387904 * 2'"
|
||||
test_expr '4611686018427387904 \* 3' \
|
||||
"expr: integer overflow or underflow occurred for operation '4611686018427387904 * 3'"
|
||||
}
|
||||
|
||||
atf_test_case gtkmm
|
||||
gtkmm_head() {
|
||||
atf_set "descr" "Test from gtk-- configure that cause problems on old expr"
|
||||
}
|
||||
gtkmm_body() {
|
||||
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1'
|
||||
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '0'
|
||||
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 3 \& 5 \>= 5' '0'
|
||||
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 2 \& 4 = 4 \& 5 \>= 5' '0'
|
||||
test_expr '3 \> 2 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '1'
|
||||
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 3 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1'
|
||||
}
|
||||
|
||||
atf_test_case colon_vs_math
|
||||
colon_vs_math_head() {
|
||||
atf_set "descr" "Basic precendence test with the : operator vs. math"
|
||||
}
|
||||
colon_vs_math_body() {
|
||||
test_expr '2 : 4 / 2' '0'
|
||||
test_expr '4 : 4 % 3' '1'
|
||||
}
|
||||
|
||||
atf_test_case arithmetic_ops
|
||||
arithmetic_ops_head() {
|
||||
atf_set "descr" "Dangling arithemtic operator"
|
||||
}
|
||||
arithmetic_ops_body() {
|
||||
test_expr '.java_wrapper : /' '0'
|
||||
test_expr '4 : \*' '0'
|
||||
test_expr '4 : +' '0'
|
||||
test_expr '4 : -' '0'
|
||||
test_expr '4 : /' '0'
|
||||
test_expr '4 : %' '0'
|
||||
}
|
||||
|
||||
atf_test_case basic_math
|
||||
basic_math_head() {
|
||||
atf_set "descr" "Basic math test"
|
||||
}
|
||||
basic_math_body() {
|
||||
test_expr '2 + 4 \* 5' '22'
|
||||
}
|
||||
|
||||
atf_test_case basic_functional
|
||||
basic_functional_head() {
|
||||
atf_set "descr" "Basic functional tests"
|
||||
}
|
||||
basic_functional_body() {
|
||||
test_expr '2' '2'
|
||||
test_expr '-4' '-4'
|
||||
test_expr 'hello' 'hello'
|
||||
}
|
||||
|
||||
atf_test_case compare_ops_precedence
|
||||
compare_ops_precedence_head() {
|
||||
atf_set "descr" "Compare operator precendence test"
|
||||
}
|
||||
compare_ops_precedence_body() {
|
||||
test_expr '2 \> 1 \* 17' '0'
|
||||
}
|
||||
|
||||
atf_test_case compare_ops
|
||||
compare_ops_head() {
|
||||
atf_set "descr" "Compare operator tests"
|
||||
}
|
||||
compare_ops_body() {
|
||||
test_expr '2 \!= 5' '1'
|
||||
test_expr '2 \!= 2' '0'
|
||||
test_expr '2 \<= 3' '1'
|
||||
test_expr '2 \<= 2' '1'
|
||||
test_expr '2 \<= 1' '0'
|
||||
test_expr '2 \< 3' '1'
|
||||
test_expr '2 \< 2' '0'
|
||||
test_expr '2 = 2' '1'
|
||||
test_expr '2 = 4' '0'
|
||||
test_expr '2 \>= 1' '1'
|
||||
test_expr '2 \>= 2' '1'
|
||||
test_expr '2 \>= 3' '0'
|
||||
test_expr '2 \> 1' '1'
|
||||
test_expr '2 \> 2' '0'
|
||||
}
|
||||
|
||||
atf_test_case multiply
|
||||
multiply_head() {
|
||||
atf_set "descr" "Test the multiply operator (PR bin/12838)"
|
||||
}
|
||||
multiply_body() {
|
||||
test_expr '1 \* -1' '-1'
|
||||
test_expr '2 \> 1 \* 17' '0'
|
||||
}
|
||||
|
||||
atf_test_case negative
|
||||
negative_head() {
|
||||
atf_set "descr" "Test the additive inverse"
|
||||
}
|
||||
negative_body() {
|
||||
test_expr '-1 + 5' '4'
|
||||
test_expr '- 1 + 5' 'expr: syntax error'
|
||||
|
||||
test_expr '5 + -1' '4'
|
||||
test_expr '5 + - 1' 'expr: syntax error'
|
||||
|
||||
test_expr '1 - -5' '6'
|
||||
}
|
||||
|
||||
atf_test_case math_precedence
|
||||
math_precedence_head() {
|
||||
atf_set "descr" "More complex math test for precedence"
|
||||
}
|
||||
math_precedence_body() {
|
||||
test_expr '-3 + -1 \* 4 + 3 / -6' '-7'
|
||||
}
|
||||
|
||||
atf_test_case precedence
|
||||
precedence_head() {
|
||||
atf_set "descr" "Test precedence"
|
||||
}
|
||||
precedence_body() {
|
||||
# This is messy but the shell escapes cause that
|
||||
test_expr 'X1/2/3 : X\\\(.\*[^/]\\\)//\*[^/][^/]\*/\*$ \| . : \\\(.\\\)' '1/2'
|
||||
}
|
||||
|
||||
atf_test_case regex
|
||||
regex_head() {
|
||||
atf_set "descr" "Test proper () returning \1 from a regex"
|
||||
}
|
||||
regex_body() {
|
||||
# This is messy but the shell escapes cause that
|
||||
test_expr '1/2 : .\*/\\\(.\*\\\)' '2'
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case lang
|
||||
atf_add_test_case overflow
|
||||
atf_add_test_case gtkmm
|
||||
atf_add_test_case colon_vs_math
|
||||
atf_add_test_case arithmetic_ops
|
||||
atf_add_test_case basic_math
|
||||
atf_add_test_case basic_functional
|
||||
atf_add_test_case compare_ops_precedence
|
||||
atf_add_test_case compare_ops
|
||||
atf_add_test_case multiply
|
||||
atf_add_test_case negative
|
||||
atf_add_test_case math_precedence
|
||||
atf_add_test_case precedence
|
||||
atf_add_test_case regex
|
||||
}
|
54
contrib/netbsd-tests/bin/pax/t_pax.sh
Executable file
54
contrib/netbsd-tests/bin/pax/t_pax.sh
Executable file
@ -0,0 +1,54 @@
|
||||
# $NetBSD: t_pax.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case append
|
||||
append_head() {
|
||||
atf_set "descr" "Ensure that appending a file to an archive" \
|
||||
"produces the same results as if the file" \
|
||||
"had been there during the archive's creation"
|
||||
}
|
||||
append_body() {
|
||||
touch foo bar
|
||||
|
||||
# store both foo and bar into file1.tar
|
||||
atf_check -s eq:0 -o empty -e empty \
|
||||
pax -w -b 512 -x ustar -f file1.tar foo bar
|
||||
|
||||
# store foo into file2.tar, then append bar to file2.tar
|
||||
atf_check -s eq:0 -o empty -e empty \
|
||||
pax -w -b 512 -x ustar -f file2.tar foo
|
||||
atf_check -s eq:0 -o empty -e empty \
|
||||
pax -w -b 512 -x ustar -f file2.tar -a bar
|
||||
|
||||
# ensure that file1.tar and file2.tar are equal
|
||||
atf_check -s eq:0 -o empty -e empty cmp file1.tar file2.tar
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case append
|
||||
}
|
123
contrib/netbsd-tests/bin/ps/keywords
Normal file
123
contrib/netbsd-tests/bin/ps/keywords
Normal file
@ -0,0 +1,123 @@
|
||||
# $NetBSD: keywords,v 1.2 2014/01/16 04:16:32 mlelstv Exp $
|
||||
#
|
||||
# Table of keywords for use with ps "-o" option.
|
||||
#
|
||||
# The first column (keyword) is the name of a keyword.
|
||||
#
|
||||
# The second column (header) is the default column header associated
|
||||
# with the keyword, except if the keyword is an alias, in which case the
|
||||
# second column is the name of another keyword.
|
||||
#
|
||||
# The third column (flag) may be blank, "LJUST", or "ALIAS". "ALIAS"
|
||||
# means that the keyword is an alias. "LJUST" means that the keyword
|
||||
# should be displayed in a left-justified column. The default is that
|
||||
# the keyword should be displayed in a right-justified column.
|
||||
#
|
||||
# keyword header flag
|
||||
#
|
||||
ktracep KTRACEP
|
||||
nwchan WCHAN
|
||||
p_ru P_RU
|
||||
paddr PADDR
|
||||
rlink RLINK
|
||||
%cpu %CPU
|
||||
%mem %MEM
|
||||
acflag ACFLG
|
||||
acflg acflag ALIAS
|
||||
args command ALIAS
|
||||
blocked sigmask ALIAS
|
||||
caught sigcatch ALIAS
|
||||
comm COMMAND LJUST
|
||||
command COMMAND LJUST
|
||||
cpu CPU
|
||||
cputime time ALIAS
|
||||
ctime CTIME
|
||||
egid EGID
|
||||
egroup EGROUP LJUST
|
||||
etime ELAPSED
|
||||
euid EUID
|
||||
euser EUSER LJUST
|
||||
f F
|
||||
flags f ALIAS
|
||||
gid GID
|
||||
group GROUP LJUST
|
||||
groupnames GROUPNAMES LJUST
|
||||
groups GROUPS LJUST
|
||||
holdcnt HOLDCNT
|
||||
ignored sigignore ALIAS
|
||||
inblk INBLK
|
||||
inblock inblk ALIAS
|
||||
jobc JOBC
|
||||
ktrace KTRACE
|
||||
laddr LADDR
|
||||
lid LID
|
||||
lim LIM
|
||||
login LOGIN LJUST
|
||||
logname login ALIAS
|
||||
lstart STARTED LJUST
|
||||
lstate STAT LJUST
|
||||
ltime LTIME
|
||||
majflt MAJFLT
|
||||
minflt MINFLT
|
||||
msgrcv MSGRCV
|
||||
msgsnd MSGSND
|
||||
ni nice ALIAS
|
||||
nice NI
|
||||
nivcsw NIVCSW
|
||||
nlwp NLWP
|
||||
nsignals nsigs ALIAS
|
||||
nsigs NSIGS
|
||||
nswap NSWAP
|
||||
nvcsw NVCSW
|
||||
oublk OUBLK
|
||||
oublock oublk ALIAS
|
||||
pagein PAGEIN
|
||||
pcpu %cpu ALIAS
|
||||
pending sig ALIAS
|
||||
pgid PGID
|
||||
pid PID
|
||||
pmem %mem ALIAS
|
||||
ppid PPID
|
||||
pri PRI
|
||||
re RE
|
||||
rgid RGID
|
||||
rgroup RGROUP LJUST
|
||||
rlwp RLWP
|
||||
rss RSS
|
||||
rssize rsz ALIAS
|
||||
rsz RSZ
|
||||
ruid RUID
|
||||
ruser RUSER LJUST
|
||||
sess SESS
|
||||
sid SID
|
||||
sig PENDING
|
||||
sigcatch CAUGHT
|
||||
sigignore IGNORED
|
||||
sigmask BLOCKED
|
||||
sl SL
|
||||
start STARTED
|
||||
stat state ALIAS
|
||||
state STAT LJUST
|
||||
stime STIME
|
||||
svgid SVGID
|
||||
svgroup SVGROUP LJUST
|
||||
svuid SVUID
|
||||
svuser SVUSER LJUST
|
||||
tdev TDEV
|
||||
time TIME
|
||||
tpgid TPGID
|
||||
tsess TSESS
|
||||
tsiz TSIZ
|
||||
tt TTY LJUST
|
||||
tty TTY LJUST
|
||||
uaddr UADDR
|
||||
ucomm UCOMM LJUST
|
||||
uid UID
|
||||
upr UPR
|
||||
user USER LJUST
|
||||
usrpri upr ALIAS
|
||||
utime UTIME
|
||||
vsize vsz ALIAS
|
||||
vsz VSZ
|
||||
wchan WCHAN LJUST
|
||||
xstat XSTAT
|
404
contrib/netbsd-tests/bin/ps/t_ps.sh
Executable file
404
contrib/netbsd-tests/bin/ps/t_ps.sh
Executable file
@ -0,0 +1,404 @@
|
||||
# $NetBSD: t_ps.sh,v 1.2 2014/01/16 04:16:32 mlelstv Exp $
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# the implementation of "ps" to test
|
||||
: ${TEST_PS:="ps"}
|
||||
# tab and newline characters
|
||||
tab="$(printf '\t')"
|
||||
# nl="$(printf '\n')" doesn't work
|
||||
nl='
|
||||
'
|
||||
|
||||
#
|
||||
# Parse the "keywords" file into a load of shell variables
|
||||
#
|
||||
setup_keywords()
|
||||
{
|
||||
# Set variables representing the header text
|
||||
# for all normal keywords (except aliases), and
|
||||
# for regular expressions to match the text in left- or
|
||||
# right-justified columns.
|
||||
# For example, head_text_p_cpu="%CPU" head_regexp_p_cpu=" *%CPU".
|
||||
while read keyword heading flag
|
||||
do
|
||||
case "$keyword" in
|
||||
''|\#*) continue
|
||||
;;
|
||||
esac
|
||||
[ x"$flag" = x"ALIAS" ] && continue
|
||||
kvar="${keyword}"
|
||||
case "${keyword}" in
|
||||
%*) kvar="p_${keyword#%}"
|
||||
;;
|
||||
esac
|
||||
eval head_text_${kvar}=\'"${heading}"\'
|
||||
case "${flag}" in
|
||||
'') # right justified
|
||||
eval head_regexp_${kvar}=\'" *${heading}"\'
|
||||
;;
|
||||
LJUST) # left justified
|
||||
eval head_regexp_${kvar}=\'"${heading} *"\'
|
||||
;;
|
||||
*) atf_fail "unknown flag in keywords"
|
||||
;;
|
||||
esac
|
||||
done <"$(atf_get_srcdir)/keywords"
|
||||
|
||||
# Now do the aliases.
|
||||
while read keyword heading flag
|
||||
do
|
||||
case "$keyword" in
|
||||
''|\#*) continue
|
||||
;;
|
||||
esac
|
||||
[ x"$flag" != x"ALIAS" ] && continue
|
||||
kvar="${keyword}"
|
||||
avar="${heading}"
|
||||
case "${keyword}" in
|
||||
%*) kvar="p_${keyword#%}"
|
||||
;;
|
||||
esac
|
||||
case "${heading}" in
|
||||
%*) avar="p_${heading#%}"
|
||||
;;
|
||||
esac
|
||||
eval head_text_${kvar}=\"\$head_text_${avar}\"
|
||||
eval head_regexp_${kvar}=\"\$head_regexp_${avar}\"
|
||||
done <"$(atf_get_srcdir)/keywords"
|
||||
|
||||
# default sets of keywords
|
||||
default_keywords='pid tty stat time command'
|
||||
j_keywords='user pid ppid pgid sess jobc state tt time command'
|
||||
l_keywords='uid pid ppid cpu pri nice vsz rss wchan state tt time command'
|
||||
s_keywords='uid pid ppid cpu lid nlwp pri nice vsz rss wchan lstate tt ltime command'
|
||||
u_keywords='user pid %cpu %mem vsz rss tt state start time command'
|
||||
v_keywords='pid state time sl re pagein vsz rss lim tsiz %cpu %mem command'
|
||||
}
|
||||
|
||||
# Convert a list of keywords like "pid comm" to a regexp
|
||||
# like " *PID COMMAND *"
|
||||
heading_keywords_to_regexp()
|
||||
{
|
||||
local keywords="$1"
|
||||
local regexp
|
||||
regexp="$(echo "$keywords" | \
|
||||
sed -E -e 's/\%/p_/g' -e 's/(^| )/\1\$head_regexp_/g')"
|
||||
eval regexp=\""${regexp}"\"
|
||||
regexp="^${regexp}\$"
|
||||
echo "$regexp"
|
||||
}
|
||||
|
||||
#
|
||||
# Check that a string matches a regexp; use the specified id
|
||||
# in error or success messages.
|
||||
#
|
||||
check_regexp() {
|
||||
local id="$1" string="$2" regexp="$3"
|
||||
if ! expr "$string" : "$regexp" >/dev/null
|
||||
then
|
||||
atf_fail "${id}: expected [${regexp}], got [${string}]"
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Run "ps $args -p $$"; check that only one line is printed,
|
||||
# without a preceding header line.
|
||||
#
|
||||
check_no_heading_line()
|
||||
{
|
||||
local args="$1"
|
||||
local output="$(eval "${TEST_PS} $args -p $$")"
|
||||
case "$output" in
|
||||
*"$nl"*)
|
||||
local firstline="${output%%${nl}*}"
|
||||
atf_fail "check_no_heading_line [$args] got [$firstline]"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# Run "ps $args"; check that the heading matches the expected regexp.
|
||||
#
|
||||
check_heading_regexp()
|
||||
{
|
||||
args="$1"
|
||||
regexp="$2"
|
||||
actual="$( eval "${TEST_PS} $args" | sed -e 1q )"
|
||||
check_regexp "heading [$args]" "${actual}" "${regexp}"
|
||||
}
|
||||
|
||||
#
|
||||
# Run "ps $args"; check that the heading matches a regexp constructed
|
||||
# from the specified keywords.
|
||||
#
|
||||
check_heading_keywords()
|
||||
{
|
||||
args="$1"
|
||||
keywords="$2"
|
||||
check_heading_regexp "$args" "$(heading_keywords_to_regexp "$keywords")"
|
||||
}
|
||||
|
||||
#
|
||||
# Try several variations on "ps $flag", "ps -$flag", etc.,
|
||||
# and check that the heading always has the correct keywords.
|
||||
#
|
||||
check_heading_variations()
|
||||
{
|
||||
flag="$1"
|
||||
keywords="$2"
|
||||
for args in "$flag" "-$flag" "-$flag$flag -$flag"; do
|
||||
check_heading_keywords "$args" "$keywords"
|
||||
done
|
||||
}
|
||||
|
||||
atf_test_case default_columns
|
||||
default_columns_head()
|
||||
{
|
||||
atf_set "descr" "Checks that the default set of columns is correct" \
|
||||
"and also check that the columns printed by the -j," \
|
||||
"-l, -s, -u and -v flags alone are correct"
|
||||
}
|
||||
default_columns_body()
|
||||
{
|
||||
setup_keywords
|
||||
check_heading_keywords '' "$default_keywords"
|
||||
check_heading_variations 'j' "$j_keywords"
|
||||
check_heading_variations 'l' "$l_keywords"
|
||||
check_heading_variations 's' "$s_keywords"
|
||||
check_heading_variations 'u' "$u_keywords"
|
||||
check_heading_variations 'v' "$v_keywords"
|
||||
}
|
||||
|
||||
atf_test_case minus_O
|
||||
minus_O_head()
|
||||
{
|
||||
atf_set "descr" "Checks that 'ps -O foo' inserts columns just after" \
|
||||
"the pid column"
|
||||
}
|
||||
minus_O_body()
|
||||
{
|
||||
setup_keywords
|
||||
check_heading_keywords '-O %cpu,%mem' \
|
||||
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
|
||||
check_heading_keywords '-O %cpu -O %mem' \
|
||||
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
|
||||
check_heading_keywords '-O%cpu -O%mem' \
|
||||
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
|
||||
}
|
||||
|
||||
atf_test_case minus_o
|
||||
minus_o_head()
|
||||
{
|
||||
atf_set "descr" "Checks simple cases of 'ps -o foo' to control which" \
|
||||
"columns are printed; this does not test header" \
|
||||
"overriding via 'ps -o foo=BAR'"
|
||||
}
|
||||
minus_o_body()
|
||||
{
|
||||
setup_keywords
|
||||
# Keywords for "-o name" override the default display
|
||||
check_heading_keywords '-o pid,%cpu,%mem' \
|
||||
"pid %cpu %mem"
|
||||
check_heading_keywords '-o pid -o %cpu,%mem' \
|
||||
"pid %cpu %mem"
|
||||
check_heading_keywords '-opid -o %cpu,%mem' \
|
||||
"pid %cpu %mem"
|
||||
# Space works like comma
|
||||
check_heading_keywords '-opid -o "%cpu %mem"' \
|
||||
"pid %cpu %mem"
|
||||
# Check missing pid
|
||||
check_heading_keywords '-o comm' \
|
||||
"comm"
|
||||
# Check pid present but not first
|
||||
check_heading_keywords '-o comm,pid' \
|
||||
"comm pid"
|
||||
}
|
||||
|
||||
atf_test_case override_heading_simple
|
||||
override_heading_simple_head()
|
||||
{
|
||||
atf_set "descr" "Tests simple uses of header overriding via" \
|
||||
"'ps -o foo=BAR'. This does not test columns " \
|
||||
"with null headings, or headings with embedded" \
|
||||
"space, ',' or '='."
|
||||
}
|
||||
override_heading_simple_body()
|
||||
{
|
||||
setup_keywords
|
||||
check_heading_regexp '-o pid=PPP -o comm' \
|
||||
'^ *PPP '"${head_text_comm}"'$' # no trailing space
|
||||
check_heading_regexp '-o pid=PPP -o comm=CCC' \
|
||||
'^ *PPP CCC$'
|
||||
check_heading_regexp '-o pid,comm=CCC' \
|
||||
'^'"${head_regexp_pid}"' CCC$'
|
||||
check_heading_regexp '-o pid -o comm=CCC' \
|
||||
'^'"${head_regexp_pid}"' CCC$'
|
||||
# Check missing pid
|
||||
check_heading_regexp '-o comm=CCC' \
|
||||
'^CCC$'
|
||||
# Check pid present but not first
|
||||
check_heading_regexp '-o comm=CCC -o pid=PPP' \
|
||||
'^CCC *PPP$'
|
||||
check_heading_regexp '-o comm,pid=PPP' \
|
||||
'^'"${head_regexp_comm}"' *PPP$'
|
||||
}
|
||||
|
||||
atf_test_case override_heading_embedded_specials
|
||||
override_heading_embedded_specials_head()
|
||||
{
|
||||
atf_set "descr" "Tests header overriding with embedded space," \
|
||||
"',' or '='. Everything after the first '='" \
|
||||
"is part of the heading."
|
||||
}
|
||||
override_heading_embedded_specials_body()
|
||||
{
|
||||
setup_keywords
|
||||
# Check embedded "," or "=" in override header.
|
||||
check_heading_regexp '-o comm,pid==' \
|
||||
'^'"${head_regexp_comm}"' *=$'
|
||||
check_heading_regexp '-o comm,pid=,' \
|
||||
'^'"${head_regexp_comm}"' *,$'
|
||||
check_heading_regexp '-o pid=PPP,comm' \
|
||||
'^ *PPP,comm$' # not like '-o pid=PPP -o comm'
|
||||
check_heading_regexp '-o pid=PPP,comm=CCC' \
|
||||
'^ *PPP,comm=CCC$' # not like '-o pid=PPP -o comm=CCC'
|
||||
check_heading_regexp '-o comm,pid=PPP,QQQ' \
|
||||
'^'"${head_regexp_comm}"' *PPP,QQQ$'
|
||||
check_heading_regexp '-o comm,pid=ppid,tty=state' \
|
||||
'^'"${head_regexp_comm}"' *ppid,tty=state$'
|
||||
# Check embedded space or tab in override header.
|
||||
check_heading_regexp '-o comm,pid="PPP QQQ"' \
|
||||
'^'"${head_regexp_comm}"' *PPP QQQ$'
|
||||
check_heading_regexp '-o comm,pid="PPP${tab}QQQ"' \
|
||||
'^'"${head_regexp_comm}"' *PPP'"${tab}"'QQQ$'
|
||||
}
|
||||
|
||||
atf_test_case override_heading_some_null
|
||||
override_heading_some_null_head()
|
||||
{
|
||||
atf_set "descr" "Tests simple uses of null column headings" \
|
||||
"overriding via 'ps -o foo=BAR -o baz='. This" \
|
||||
"does not test the case where all columns have" \
|
||||
"null headings."
|
||||
}
|
||||
override_heading_some_null_body()
|
||||
{
|
||||
setup_keywords
|
||||
check_heading_regexp '-o pid=PPP -o comm=' \
|
||||
'^ *PPP *$'
|
||||
check_heading_regexp '-o pid= -o comm=CCC' \
|
||||
'^ * CCC$'
|
||||
check_heading_regexp '-o pid -o comm=' \
|
||||
'^'"${head_regexp_pid}"' *$'
|
||||
# Check missing pid
|
||||
check_heading_regexp '-o ppid= -o comm=CCC' \
|
||||
'^ * CCC$'
|
||||
check_heading_regexp '-o ppid=PPP -o comm=' \
|
||||
'^ *PPP *$'
|
||||
# Check pid present but not first
|
||||
check_heading_regexp '-o comm= -o pid=PPP' \
|
||||
'^ * PPP$'
|
||||
check_heading_regexp '-o comm,pid=' \
|
||||
'^'"${head_regexp_comm}"' *$'
|
||||
# A field with a null custom heading retains a minimum width
|
||||
# derived from the default heading. This does not apply
|
||||
# to a field with a very short (non-null) custom heading.
|
||||
#
|
||||
# We choose "holdcnt" as a column whose width is likely to be
|
||||
# determined entirely by the header width, because the values
|
||||
# are likely to be very small.
|
||||
check_heading_regexp '-o holdcnt -o holdcnt -o holdcnt' \
|
||||
'^HOLDCNT HOLDCNT HOLDCNT$'
|
||||
check_heading_regexp '-o holdcnt -o holdcnt= -o holdcnt' \
|
||||
'^HOLDCNT HOLDCNT$'
|
||||
check_heading_regexp '-o holdcnt -o holdcnt=HH -o holdcnt' \
|
||||
'^HOLDCNT HH HOLDCNT$'
|
||||
}
|
||||
|
||||
atf_test_case override_heading_all_null
|
||||
override_heading_all_null_head()
|
||||
{
|
||||
atf_set "descr" "Tests the use of 'ps -o foo= -o bar=' (with a" \
|
||||
"null heading for every column). The heading" \
|
||||
"should not be printed at all in this case."
|
||||
}
|
||||
override_heading_all_null_body()
|
||||
{
|
||||
setup_keywords
|
||||
# A heading with a space is not a null heading,
|
||||
# so should not be suppressed
|
||||
check_heading_regexp '-o comm=" "' \
|
||||
'^ *$'
|
||||
# Null headings should be suppressed
|
||||
check_no_heading_line '-o pid= -o comm='
|
||||
check_no_heading_line '-o pid= -o comm='
|
||||
# Check missing pid
|
||||
check_no_heading_line '-o ppid='
|
||||
check_no_heading_line '-o comm='
|
||||
check_no_heading_line '-o command='
|
||||
check_no_heading_line '-o ppid= -o comm='
|
||||
check_no_heading_line '-o comm= -o ppid='
|
||||
# Check pid present but not first
|
||||
check_no_heading_line '-o comm= -o pid='
|
||||
check_no_heading_line '-o ppid= -o pid= -o command='
|
||||
}
|
||||
|
||||
atf_test_case duplicate_column
|
||||
duplicate_column_head()
|
||||
{
|
||||
atf_set "descr" "Tests the use of -o options to display the" \
|
||||
"same column more than once"
|
||||
}
|
||||
duplicate_column_body()
|
||||
{
|
||||
setup_keywords
|
||||
# two custom headers
|
||||
check_heading_regexp '-o pid=PPP -o pid=QQQ' \
|
||||
'^ *PPP *QQQ$'
|
||||
# one custom header, before and after default header
|
||||
check_heading_regexp '-o pid=PPP -o pid' \
|
||||
'^ *PPP '"${head_regexp_pid}"'$'
|
||||
check_heading_regexp '-o pid -o pid=QQQ' \
|
||||
'^'"${head_regexp_pid}"' *QQQ$'
|
||||
# custom headers both before and after default header
|
||||
check_heading_regexp '-o pid=PPP -o pid -o pid=QQQ' \
|
||||
'^ *PPP '"${head_regexp_pid}"' *QQQ$'
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case default_columns
|
||||
atf_add_test_case minus_O
|
||||
atf_add_test_case minus_o
|
||||
atf_add_test_case override_heading_simple
|
||||
atf_add_test_case override_heading_embedded_specials
|
||||
atf_add_test_case override_heading_some_null
|
||||
atf_add_test_case override_heading_all_null
|
||||
atf_add_test_case duplicate_column
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before case
|
||||
before break
|
||||
after break, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
compound start
|
||||
before break
|
||||
after break, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before break
|
||||
after break, return value: 0
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,7 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before for
|
||||
before break
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before function
|
||||
before break
|
||||
after break
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
subshell start
|
||||
before break
|
||||
after break, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,7 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before until
|
||||
before break
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,7 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before while
|
||||
before break
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before case
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
compound start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before for
|
||||
before continue
|
||||
before continue
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before function
|
||||
before continue
|
||||
after continue
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
subshell start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before until
|
||||
before continue
|
||||
before continue
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before while
|
||||
before continue
|
||||
before continue
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before case
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
compound start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,5 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before for
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,7 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before function
|
||||
before return
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
subshell start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before until
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,6 @@
|
||||
before case
|
||||
before dotcmd
|
||||
before while
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
after case
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before case
|
||||
before break
|
||||
after break, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
compound start
|
||||
before break
|
||||
after break, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before break
|
||||
after break, return value: 0
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,7 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before for
|
||||
before break
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before function
|
||||
before break
|
||||
after break
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
subshell start
|
||||
before break
|
||||
after break, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,7 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before until
|
||||
before break
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,7 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before while
|
||||
before break
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before case
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
compound start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before for
|
||||
before continue
|
||||
before continue
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before function
|
||||
before continue
|
||||
after continue
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
subshell start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before until
|
||||
before continue
|
||||
before continue
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,8 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before while
|
||||
before continue
|
||||
before continue
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before case
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
compound start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,5 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before for
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,7 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before function
|
||||
before return
|
||||
after function
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
subshell start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before until
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
compound start
|
||||
before dotcmd
|
||||
before while
|
||||
before return
|
||||
after dotcmd, return value: 0
|
||||
compound end
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before case
|
||||
before break
|
||||
after break, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
compound start
|
||||
before break
|
||||
after break, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before break
|
||||
after break, return value: 0
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,5 @@
|
||||
before dotcmd
|
||||
before for
|
||||
before break
|
||||
after for
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before function
|
||||
before break
|
||||
after break
|
||||
after function
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
subshell start
|
||||
before break
|
||||
after break, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,5 @@
|
||||
before dotcmd
|
||||
before until
|
||||
before break
|
||||
after until
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,5 @@
|
||||
before dotcmd
|
||||
before while
|
||||
before break
|
||||
after while
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before case
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after case
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
compound start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
compound end
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before for
|
||||
before continue
|
||||
before continue
|
||||
after for
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before function
|
||||
before continue
|
||||
after continue
|
||||
after function
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
subshell start
|
||||
before continue
|
||||
after continue, return value: 0
|
||||
subshell end
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before until
|
||||
before continue
|
||||
before continue
|
||||
after until
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,6 @@
|
||||
before dotcmd
|
||||
before while
|
||||
before continue
|
||||
before continue
|
||||
after while
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before case
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
compound start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,3 @@
|
||||
before dotcmd
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before for
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,5 @@
|
||||
before dotcmd
|
||||
before function
|
||||
before return
|
||||
after function
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
subshell start
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before until
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,4 @@
|
||||
before dotcmd
|
||||
before while
|
||||
before return
|
||||
after dotcmd, return value: 0
|
@ -0,0 +1,5 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before case
|
||||
before break
|
||||
after for
|
@ -0,0 +1,5 @@
|
||||
before for
|
||||
before dotcmd
|
||||
compound start
|
||||
before break
|
||||
after for
|
@ -0,0 +1,4 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before break
|
||||
after for
|
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_for.out
Normal file
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_for.out
Normal file
@ -0,0 +1,12 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before for
|
||||
before break
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before for
|
||||
before break
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
after for
|
@ -0,0 +1,5 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before function
|
||||
before break
|
||||
after for
|
@ -0,0 +1,10 @@
|
||||
before for
|
||||
before dotcmd
|
||||
subshell start
|
||||
before break
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
subshell start
|
||||
before break
|
||||
after dotcmd, return value: 0
|
||||
after for
|
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_until.out
Normal file
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_until.out
Normal file
@ -0,0 +1,12 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before until
|
||||
before break
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before until
|
||||
before break
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
after for
|
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_while.out
Normal file
12
contrib/netbsd-tests/bin/sh/dotcmd/out/for_break_while.out
Normal file
@ -0,0 +1,12 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before while
|
||||
before break
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before while
|
||||
before break
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
after for
|
@ -0,0 +1,8 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before case
|
||||
before continue
|
||||
before dotcmd
|
||||
before case
|
||||
before continue
|
||||
after for
|
@ -0,0 +1,8 @@
|
||||
before for
|
||||
before dotcmd
|
||||
compound start
|
||||
before continue
|
||||
before dotcmd
|
||||
compound start
|
||||
before continue
|
||||
after for
|
@ -0,0 +1,6 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before continue
|
||||
before dotcmd
|
||||
before continue
|
||||
after for
|
14
contrib/netbsd-tests/bin/sh/dotcmd/out/for_continue_for.out
Normal file
14
contrib/netbsd-tests/bin/sh/dotcmd/out/for_continue_for.out
Normal file
@ -0,0 +1,14 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before for
|
||||
before continue
|
||||
before continue
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before for
|
||||
before continue
|
||||
before continue
|
||||
after for
|
||||
after dotcmd, return value: 0
|
||||
after for
|
@ -0,0 +1,8 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before function
|
||||
before continue
|
||||
before dotcmd
|
||||
before function
|
||||
before continue
|
||||
after for
|
@ -0,0 +1,10 @@
|
||||
before for
|
||||
before dotcmd
|
||||
subshell start
|
||||
before continue
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
subshell start
|
||||
before continue
|
||||
after dotcmd, return value: 0
|
||||
after for
|
@ -0,0 +1,14 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before until
|
||||
before continue
|
||||
before continue
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before until
|
||||
before continue
|
||||
before continue
|
||||
after until
|
||||
after dotcmd, return value: 0
|
||||
after for
|
@ -0,0 +1,14 @@
|
||||
before for
|
||||
before dotcmd
|
||||
before while
|
||||
before continue
|
||||
before continue
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
before dotcmd
|
||||
before while
|
||||
before continue
|
||||
before continue
|
||||
after while
|
||||
after dotcmd, return value: 0
|
||||
after for
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user