diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 2004-08-18 16:37:05 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 2004-08-18 16:37:05 +0000 |
| commit | 3c9270175d1bd3e7d0005e5f843a948f53ae77fb (patch) | |
| tree | b99ab05eb34f00ad805361803ba5ec1607b3a372 /tools | |
| parent | 9b932e9e048ade36fd50bad5eb8b9475b0a6082d (diff) | |
Notes
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/build/make_check/Makefile | 241 | ||||
| -rw-r--r-- | tools/build/make_check/regress.sysvmatch.out | 1 | ||||
| -rw-r--r-- | tools/build/make_check/regress.variables.out | 1 | ||||
| -rw-r--r-- | tools/kerneldoc/Doxyfile | 211 | ||||
| -rw-r--r-- | tools/kerneldoc/Makefile | 30 | ||||
| -rw-r--r-- | tools/regression/usr.bin/sed/hanoi.sed | 103 | ||||
| -rw-r--r-- | tools/regression/usr.bin/sed/math.sed | 439 | ||||
| -rw-r--r-- | tools/regression/usr.bin/sed/multitest.t | 556 | ||||
| -rw-r--r-- | tools/regression/usr.bin/sed/sed.test | 556 |
9 files changed, 0 insertions, 2138 deletions
diff --git a/tools/build/make_check/Makefile b/tools/build/make_check/Makefile deleted file mode 100644 index a58f9ab72baa8..0000000000000 --- a/tools/build/make_check/Makefile +++ /dev/null @@ -1,241 +0,0 @@ -# $FreeBSD$ - -# Test for broken LHS expansion. -# This *must* cause make(1) to detect a recursive variable, and fail as such. -.if make(lhs_expn) -FOO= ${BAR} -BAR${NIL}= ${FOO} -FOO${BAR}= ${FOO} -.endif - -DATA1= helllo -DATA2:= ${DATA1} -DATA3= ${DATA2:S/ll/rr/g} -DATA4:= ${DATA2:S/ll/rr/g} -DATA2?= allo -DATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} -DATA2= yello -DATA1:= ${DATA5:S/l/r/g} -NIL= - -all: - @echo "Running test variables" - @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ - diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure - @echo "PASS: Test variables detected no regression, output matches." - @echo "Running test targets" - @${MAKE} double 2>/dev/null || ${MAKE} failure - @echo "PASS: Test targets detected no regression." - @echo "Running test sysvmatch" - @${MAKE} sysvmatch || ${MAKE} failure - @echo "PASS: Test sysvmatch detected no regression." - @echo "Running test lhs_expn" - @! ${MAKE} lhs_expn && true || ${MAKE} failure - @echo "PASS: Test lhs_expn detected no regression." - @echo "Running test notdef" - @${MAKE} notdef || ${MAKE} failure - @echo "PASS: Test notdef detected no regression." - @echo "Running test modifiers" - @${MAKE} modifiers || ${MAKE} failure - @echo "PASS: Test modifiers detected no regression." - @echo "Running test funny_targets" - @${MAKE} funny_targets || ${MAKE} failure - @echo "PASS: Test funny_targets detected no regression." - @echo "Running test arith_expr" - @${MAKE} arith_expr || ${MAKE} failure - @echo "PASS: Test arith_expr detected no regression." - @echo "Running test PATH_exists" - @${MAKE} PATH_exists || ${MAKE} failure - @echo "PASS: Test PATH_exists detected no regression." - @echo "Running test double_quotes" - @${MAKE} double_quotes || ${MAKE} failure - @echo "PASS: Test double_quotes detected no regression." - @echo "Running test double_quotes2" - @! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure - @echo "PASS: Test double_quotes2 detected no regression." - @echo "Running test pass_cmd_vars" - @${MAKE} pass_cmd_vars || ${MAKE} failure - @echo "PASS: Test pass_cmd_vars detected no regression." - @echo "Running test plus_flag" - @${MAKE} plus_flag || ${MAKE} failure - @echo "PASS: Test plus_flag detected no regression." - -.if make(double) -# Doubly-defined targets. make(1) will warn, but use the "right" one. If it -# switches to using the "non-right" one, it breaks things worse than a little -# regression test. -double: - @true - -double: - @false -.endif - -.if make(sysvmatch) -# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. -sysvmatch: - @echo EMPTY ${NIL:=foo} LHS | \ - diff -u ${.CURDIR}/regress.sysvmatch.out - || false -.endif - -# A bogus target for the lhs_expn test; If this is reached, then the make(1) -# program has not errored out because of the recursion caused by not expanding -# the left-hand-side's embedded variables above. -lhs_expn: - @true - -.if make(notdef) -# make(1) claims to only evaluate a conditional as far as is necessary -# to determine its value; that was not always the case. -.undef notdef -notdef: -.if defined(notdef) && ${notdef:U} -.endif -.endif - -.if make(modifiers) -# See if make(1) supports the C modifier. -modifiers: - @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ - grep -q "Unknown modifier 'C'"; then \ - false; \ - fi -.endif - -.if make(funny_targets) -funny_targets: colons::target exclamation!target -colons::target: -exclamation!target: -.endif - -.if make(arith_expr) -arith_expr: -# See if arithmetic expression parsing is broken. -# The different spacing below is intentional. -VALUE= 0 -.if (${VALUE} < 0)||(${VALUE}>0) -.endif -.endif - -.if make(PATH_exists) -PATH_exists: -.PATH: ${.CURDIR} -.if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) -.error exists() failed -.endif -.endif - -.if make(double_quotes) -VALUE= foo "" -double_quotes: -.if ${VALUE:S/$//} != ${VALUE} -.error "" reduced to " -.endif -.endif - -.if make(double_quotes2) -double_quotes2: - @cat /dev/null "" -.endif - -# -# Check passing of variable via MAKEFLAGS -# -.if make(pass_cmd_vars) -pass_cmd_vars: - @${MAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_1 - @${MAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_2 - @${MAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_3 - @${MAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_4 -.endif - -.if make(pass_cmd_vars_1) -# Check that the variable definition arrived from the calling make -pass_cmd_vars_1: - @: - -.if ${CMD1} != cmd1 || ${CMD2} != cmd2 -.error variables not passed through MAKEFLAGS -.endif - -# Check that the variable definition is in MAKEFLAGS -.if ${.MAKEFLAGS:MCMD1=*} != "CMD1=cmd1" || ${.MAKEFLAGS:MCMD2=*} != "CMD2=cmd2" -.error variable assignment not found in $${MAKEFLAGS} -.endif - -# Check that the variable definition is not in MFLAGS -.if ${MFLAGS:MCMD1=*} != "" || ${MFLAGS:MCMD2=*} != "" -.error variable assignment found in $${MFLAGS} -.endif -.endif - -.if make(pass_cmd_vars_2) -# Check that we cannot override the passed variables -CMD1=foo1 -CMD2=foo2 - -.if ${CMD1} != cmd1 || ${CMD2} != cmd2 -.error MAKEFLAGS-passed variables overridden -.endif - -pass_cmd_vars_2: - @: -.endif - -.if make(pass_cmd_vars_3) -# Check that we can override the passed variables on the next sub-make's -# command line - -pass_cmd_vars_3: - @${MAKE} CMD1=foo1 pass_cmd_vars_3_1 -.endif - -.if make(pass_cmd_vars_3_1) -.if ${CMD1} != foo1 || ${CMD2} != cmd2 -.error MAKEFLAGS-passed variables not overridden on command line -.endif -pass_cmd_vars_3_1: - @: -.endif - -.if make(pass_cmd_vars_4) -# Ensure that a variable assignment passed via MAKEFLAGS may be overwritten -# by evaluating the .MAKEFLAGS target. - -.MAKEFLAGS: CMD1=baz1 - -pass_cmd_vars_4: - @${MAKE} pass_cmd_vars_4_1 - -.if ${CMD1} != baz1 || ${CMD2} != cmd2 -.error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target -.endif - -.endif -.if make(pass_cmd_vars_4_1) -.if ${CMD1} != baz1 || ${CMD2} != cmd2 -.error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target (2) -.endif -pass_cmd_vars_4_1: - @: -.endif - -# -# Test whether make supports the '+' flag (meaning: execute even with -n) -# -.if make(plus_flag) -OUT != ${MAKE} -n plus_flag_1 -.if ${OUT} != "/tmp" -.error make doesn't handle + flag -.endif -plus_flag: - @: -.endif -.if make(plus_flag_1) -plus_flag_1: - +@cd /tmp; pwd -.endif - -failure: - @echo "FAIL: Test failed: regression detected. See above." - @false diff --git a/tools/build/make_check/regress.sysvmatch.out b/tools/build/make_check/regress.sysvmatch.out deleted file mode 100644 index 759859e677aea..0000000000000 --- a/tools/build/make_check/regress.sysvmatch.out +++ /dev/null @@ -1 +0,0 @@ -EMPTY LHS diff --git a/tools/build/make_check/regress.variables.out b/tools/build/make_check/regress.variables.out deleted file mode 100644 index 83528d57c82ea..0000000000000 --- a/tools/build/make_check/regress.variables.out +++ /dev/null @@ -1 +0,0 @@ -1:heiiro herrro 2:yello 3:yerro 4:herrlo 5:heiilo herrlo diff --git a/tools/kerneldoc/Doxyfile b/tools/kerneldoc/Doxyfile deleted file mode 100644 index 146afc32ba0f4..0000000000000 --- a/tools/kerneldoc/Doxyfile +++ /dev/null @@ -1,211 +0,0 @@ -# Doxyfile 1.3.6 -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD Kernel" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = YES -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_IF_DOC_ERROR = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = _KERNEL -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = kernel.tags -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 0 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/tools/kerneldoc/Makefile b/tools/kerneldoc/Makefile deleted file mode 100644 index ec665a7b02569..0000000000000 --- a/tools/kerneldoc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../kern - -SRCS+= kern -SRCS+= sys -MFILES+= device_if.m -MFILES+= bus_if.m - -all: ${MFILES:T:S/.m/.h/} ${SRCS} - doxygen - -LN?= ln -AWK?= awk -S?= ${.CURDIR}/.. - -CLEANFILES+= ${SRCS} -.for dir in ${SRCS} -${dir}: - ${LN} -sf ${.CURDIR}/../${dir} . -.endfor - -.for mfile in ${MFILES} -CLEANFILES+= ${mfile:T:S/.m$/.h/} -${mfile:T:S/.m$/.h/}: ${mfile} - ${AWK} -f $S/tools/makeobjops.awk $> -h -.endfor - -clean:: - rm -f ${CLEANFILES} diff --git a/tools/regression/usr.bin/sed/hanoi.sed b/tools/regression/usr.bin/sed/hanoi.sed deleted file mode 100644 index 6a45deaa94c7b..0000000000000 --- a/tools/regression/usr.bin/sed/hanoi.sed +++ /dev/null @@ -1,103 +0,0 @@ -# Towers of Hanoi in sed. -# -# @(#)hanoi.sed 8.1 (Berkeley) 6/6/93 -# $FreeBSD$ -# -# -# Ex: -# Run "sed -f hanoi.sed", and enter: -# -# :abcd: : :<CR> -# -# note -- TWO carriage returns were once required, this will output the -# sequence of states involved in moving 4 rings, the largest called "a" and -# the smallest called "d", from the first to the second of three towers, so -# that the rings on any tower at any time are in descending order of size. -# You can start with a different arrangement and a different number of rings, -# say :ce:b:ax: and it will give the shortest procedure for moving them all -# to the middle tower. The rules are: the names of the rings must all be -# lower-case letters, they must be input within 3 fields (representing the -# towers) and delimited by 4 colons, such that the letters within each field -# are in alphabetical order (i.e. rings are in descending order of size). -# -# For the benefit of anyone who wants to figure out the script, an "internal" -# line of the form -# b:0abx:1a2b3 :2 :3x2 -# has the following meaning: the material after the three markers :1, :2, -# and :3 represents the three towers; in this case the current set-up is -# ":ab : :x :". The numbers after a, b and x in these fields indicate -# that the next time it gets a chance, it will move a to tower 2, move b -# to tower 3, and move x to tower 2. The string after :0 just keeps track -# of the alphabetical order of the names of the rings. The b at the -# beginning means that it is now dealing with ring b (either about to move -# it, or re-evaluating where it should next be moved to). -# -# Although this version is "limited" to 26 rings because of the size of the -# alphabet, one could write a script using the same idea in which the rings -# were represented by arbitrary [strings][within][brackets], and in place of -# the built-in line of the script giving the order of the letters of the -# alphabet, it would accept from the user a line giving the ordering to be -# assumed, e.g. [ucbvax][decvax][hplabs][foo][bar]. -# -# George Bergman -# Math, UC Berkeley 94720 USA - -# cleaning, diagnostics -s/ *//g -/^$/d -/[^a-z:]/{a\ -Illegal characters: use only a-z and ":". Try again. -d -} -/^:[a-z]*:[a-z]*:[a-z]*:$/!{a\ -Incorrect format: use\ -\ : string1 : string2 : string3 :<CR>\ -Try again. -d -} -/\([a-z]\).*\1/{a\ -Repeated letters not allowed. Try again. -d -} -# initial formatting -h -s/[a-z]/ /g -G -s/^:\( *\):\( *\):\( *\):\n:\([a-z]*\):\([a-z]*\):\([a-z]*\):$/:1\4\2\3:2\5\1\3:3\6\1\2:0/ -s/[a-z]/&2/g -s/^/abcdefghijklmnopqrstuvwxyz/ -:a -s/^\(.\).*\1.*/&\1/ -s/.// -/^[^:]/ba -s/\([^0]*\)\(:0.*\)/\2\1:/ -s/^[^0]*0\(.\)/\1&/ -:b -# outputting current state without markers -h -s/.*:1/:/ -s/[123]//gp -g -:c -# establishing destinations -/^\(.\).*\1:1/td -/^\(.\).*:1[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/ -/^\(.\).*:1[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/ -/^\(.\).*:1[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/ -/^\(.\).*:2[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/ -/^\(.\).*:2[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/ -/^\(.\).*:2[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/ -/^\(.\).*:3[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/ -/^\(.\).*:3[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/ -/^\(.\).*:3[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/ -bc -# iterate back to find smallest out-of-place ring -:d -s/^\(.\)\(:0[^:]*\([^:]\)\1.*:\([123]\)[^:]*\1\)\4/\3\2\4/ -td -# move said ring (right, resp. left) -s/^\(.\)\(.*\)\1\([23]\)\(.*:\3[^ ]*\) /\1\2 \4\1\3/ -s/^\(.\)\(.*:\([12]\)[^ ]*\) \(.*\)\1\3/\1\2\1\3\4 / -tb -s/.*/Done! Try another, or end with ^D./p -d diff --git a/tools/regression/usr.bin/sed/math.sed b/tools/regression/usr.bin/sed/math.sed deleted file mode 100644 index cdd18d6d532b4..0000000000000 --- a/tools/regression/usr.bin/sed/math.sed +++ /dev/null @@ -1,439 +0,0 @@ -# This is ksb's infamous sed calculator. (ksb@sa.fedex.com) -# -# $FreeBSD$ -# -# $Id: math.sed,v 2.5 1998/08/02 13:23:34 ksb Exp ksb $ -# expr ::= (expr) | expr! | -# expr ^ expr | -# -expr | expr * expr | expr / expr | expr % expr | -# expr + expr | expr - expr | -# [0-9][0-9]* ; -# Bugs: some sign combinations don't work, and I got sick of added cases -# for unary +. Don't depend on signed math working all the time. -- ksb -# -# $Compile: echo "4+7*3+2^7/3" | sed -f %f - -# make sure the expression is well formed -s/[ ]//g -/[*\/^%+-]$/{ - a\ - poorly formed expression, dyadic operator on the end - q -} -/^[*\/^%]/{ - a\ - poorly formed expression, leading dyadic operator - q -} - -# fill hold space with done token -x -s/^.*/done/ -x - -# main loop, process operators ((), !, *, /, %, +, and -) -: loop -# uncomment the print below to follow the "logic" -- ksb -#p -/^[+]/{ - s/// - b loop -} -/^--/{ - s/// - b loop -} -# eval parenthesised sub expressions first -/^\(.*\)(\([^)]*\))\(.*\)$/{ - H - s//\2/ - x - s/^\(.*\)\n\(.*\)(\([^()]*\))\(.*\)$/()\2@\4@\1/ - x - b loop -} -# reduce a^b^c -> a^(b^c) -/\([0-9][0-9]*^\)\([0-9][0-9]*^[0-9][0-9^]*\)/{ - s//\1(\2)/ - b loop -} -# pull any burried exponents -/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)$/{ - s//\1(\2)/ - b loop -} -/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{ - s//\1(\2)\3/ - b loop -} -/^\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{ - s//(\1)\2/ - b loop -} -/^\([-]*[0-9]*\)^0*$/{ - s//1/ - b loop -} -/^\([-]*[0-9]*\)^0*1$/{ - s//\1/ - b loop -} -/^\([-]*[0-9]*\)^-[0-9]*$/{ - s//0/ - b loop -} -/^\([-]*\)\([0-9]*\)^\([0-9][0-9]*[13579]\)$/{ - s//\1\2*((\2*\2)^(\3\/2))/ - b loop -} -/^[-]*\([0-9]*\)^\([0-9][0-9]*[02468]\)$/{ - s//(\1*\1)^(\2\/2)/ - b loop -} -# single digit powers (2 3,9 4,6,8 5,7 -/^[-]*\([0-9]*\)^0*2$/{ - s//(\1*\1)/ - b loop -} -/^\([-]*\)\([0-9]*\)^0*\([39]\)$/{ - s//\1(\2*(\2*\2))^(\3\/3)/ - b loop -} -/^[-]*\([0-9]*\)^0*\([468]\)$/{ - s//(\1*\1)^(\2\/2)/ - b loop -} -# 5 7 -/^\([-]*[0-9]*\)^\([0-9]*\)$/{ - s//\1*(\1^(\2-1))/ - b loop -} -# reduce all number factorials -/^0*[01]!/{ - s//1/ - b loop -} -/\([*+-/%^]\)0*[01]!/{ - s//\11/ - b loop -} -/\([0-9]*\)!/{ - s//(\1-1)!*\1/ - b loop -} -# sign simplifications -/^-\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{ - s//\1\2\3/ - b loop -} -/^\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{ - s//-\1\2\3/ - b loop -} -/^-\([0-9][0-9]*\)[+]*-\([0-9][0-9]*\)$/{ - s//\1+\2/ - x - s/\(.*\)/()-@@\1/ - x - b loop -} -/^-\([0-9]*\)[+]\([0-9]\)*$/{ - s//\2-\1/ - b loop -} -/^-.*[-+*/%].*/{ - H - s/^-// - x - s/^\(.*\)\n-.*$/()-@@\1/ - x - b loop -} -# can we simplify multiplications -/^\([0-9]*\)\([*][0-9]*[1-9]\)00*$/{ - H - s//\1\2/ - x - s/^\(.*\)\n[0-9]*[*][0-9]*[1-9]\(00*\)$/()@\2@\1/ - x - b loop -} -/^\([0-9][1-9]*\)00*\([*][0-9]*\)$/{ - H - s//\1\2/ - x - s/^\(.*\)\n[0-9][1-9]*\(00*\)[*][0-9]*$/()@\2@\1/ - x - b loop -} -# can we simplify division (20/30 -> 2/3) -/^\([0-9][0-9]*\)0\([/%]\)\([0-9][0-9]*\)0$/{ - s//\1\2\3/ - b loop -} -# n/1 -> n -/^0*\([0-9][0-9]*\)0[/]0*1$/{ - s//\1/ - b loop -} -# n%2 -> last_digit(n)%2 (same for 1, BTW) N.B. NO LOOP -/^[0-9]*\([0-9]\)%0*\([12]\)$/{ - s//\1%\2/ -} -# move any mul/divs to the front via parans -/^\([0-9+]*\)\([-+]\)\([0-9]*[*/][0-9*/]*\)/{ - s//\1\2(\3)/ - b loop -} -# can we div or mul -/^[0-9]*[*][0-9]*$/{ - b mul -} -/^[0-9]*[/%]0*$/{ - i\ -divide by zero - d -} -/^[0-9]*[/%][0-9]*$/{ - H - s/\([0-9]\).*[/%]/\1-/ - x - s/^\(.*\)\n\([0-9]\)\([0-9]*\)\([/%]\)\([0-9]*\).*$/.\4\3q0r\2-\5@\1/ - x - b loop -} -/^\([0-9]*[*/%][0-9]*\)\(.*\)/{ - H - s//\1/ - x - s/^\(.*\)\n\([0-9]*[*/][0-9]*\)\(.*\)$/()@\3@\1/ - x - b loop -} -# can we add or subtract -- note subtract hold expression for underflow -/^[0-9]*[+][0-9]*$/{ - s/$/=/ - b add -} -/^[0-9][0-9]*-[0-9]*$/{ - H - s/$/=/ - b sub -} -/^\([0-9][0-9]*[-+][0-9]*\)\(.*\)/{ - H - s//\1/ - x - s/^\(.*\)\n\([0-9]*[-+][0-9]*\)\(.*\)$/()@\3@\1/ - x - b loop -} -# look in hold space for stack to reduce -x -/^done$/{ - x - s/^0*\([0-9][0-9]*\)/\1/ - p - d -} -# .[/%] numerator q quotient r remainder-divisor @stack -/^\./{ - x - /^[^-]/{ - H - x - s/.\(.\)\([0-9]*\)q\([^r]*\)r\([0-9]*\)-\([0-9]*\)@\(.*\)\n\(.*\)/.\1\2q\3+1r\7-\5@\6/ - h - s/..[0-9]*q[^r]*r\([0-9]*-[0-9]*\)@.*/\1/ - b loop - } - /^-/{ - g - /.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([^@]*\)@.*/{ - s//\5\2-\6/ - x - s/.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([0-9]*\)@\(.*\)/.\1\3q(\4)*10r\5\2-\6@\7/ - x - b loop - } -# no digits to shift on - s/^\.[/]q\([^r]*\)r[^@]*@.*/\1/ - s/^\.[%]q[^r]*r0*\([0-9][0-9]*\)-[^@]*@.*/\1/ - /^\./{ - i\ -divide error - q - } - x - s/^\.[/%]q[^r]*r[^@]*@\(.*\)/\1/ - x - b loop - } -} -/^()/{ - s/// - x - G - s/\(.*\)\n\([^@]*\)@\([^@]*\)@\(.*\)/\2\1\3/ - x - s/[^@]*@[^@]*@\(.*\)/\1/ - x - b loop -} -i\ -help, stack problem - the hold space -p -x -i\ -and the pat space -p -i\ -quit -q - -# turn mul into add until 1*x -> x, 0*x -> 0 -: mul -/^00*\*.*/{ - s//0/ - b loop -} -/^0*1\*/{ - s/// -: leading - s/^0*\([0-9][0-9]*\)/\1/ - b loop -} -s/^\([0-9]*\)0\*\([0-9]*\)/\1*\20/ -s/^\([0-9]*\)1\*\([0-9]*\)/\1*\20+\2/ -s/^\([0-9]*\)2\*\([0-9]*\)/\1*\20+(\2+\2)/ -s/^\([0-9]*\)3\*\([0-9]*\)/\1*\20+(\2+\2+\2)/ -s/^\([0-9]*\)4\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2)/ -s/^\([0-9]*\)5\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2)/ -s/^\([0-9]*\)6\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2)/ -s/^\([0-9]*\)7\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2)/ -s/^\([0-9]*\)8\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2)/ -s/^\([0-9]*\)9\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2+\2)/ -/^0*\*[0-9]*[+]*\(.*\)/{ - s//\1/ - b loop -} -b mul - -# get rid of a plus term until 0+x -> x -: add -/^[+]\([0-9+*]*\)=/{ - s//\1/ - b leading -} -/^\([0-9*]*\)[+]=/{ - s//\1/ - b loop -} -/^\([0-9]*\)0[+]\([0-9]*\)\([0-9]\)=/{ - s//\1+\2=\3/ - b add -} -/^\([0-9]*\)\([0-9]\)[+]\([0-9]*\)0=/{ - s//\1+\3=\2/ - b add -} -s/^\([0-9]*\)1[+]/\10+/ -s/^\([0-9]*\)2[+]/\11+/ -s/^\([0-9]*\)3[+]/\12+/ -s/^\([0-9]*\)4[+]/\13+/ -s/^\([0-9]*\)5[+]/\14+/ -s/^\([0-9]*\)6[+]/\15+/ -s/^\([0-9]*\)7[+]/\16+/ -s/^\([0-9]*\)8[+]/\17+/ -s/^\([0-9]*\)9[+]/\18+/ - -s/9=\([0-9]*\)$/_=\1/ -s/8=\([0-9]*\)$/9=\1/ -s/7=\([0-9]*\)$/8=\1/ -s/6=\([0-9]*\)$/7=\1/ -s/5=\([0-9]*\)$/6=\1/ -s/4=\([0-9]*\)$/5=\1/ -s/3=\([0-9]*\)$/4=\1/ -s/2=\([0-9]*\)$/3=\1/ -s/1=\([0-9]*\)$/2=\1/ -/_/{ - s//_0/ - : inc - s/9_/_0/ - s/8_/9/ - s/7_/8/ - s/6_/7/ - s/5_/6/ - s/4_/5/ - s/3_/4/ - s/2_/3/ - s/1_/2/ - s/0_/1/ - s/[+]_/+1/ - /_/b inc -} -b add - -# get rid of a sub term until /-0*=/ or underflow -: sub -/^\([0-9]*\)-0*=/{ - s//\1/ - x - s/\(.*\)\n.*$/\1/ - x - b leading -} -/^-\([0-9].*\)=/{ -: under - g - s/.*\n\([0-9]*\)-\([0-9]*\).*/-(\2-\1)/ - x - s/\(.*\)\n.*/\1/ - x - b loop -} -/^\([0-9]*\)\([0-9]\)-\([0-9]*\)0=/{ - s//\1-\3=\2/ - b sub -} -s/1=/0=/ -s/2=/1=/ -s/3=/2=/ -s/4=/3=/ -s/5=/4=/ -s/6=/5=/ -s/7=/6=/ -s/8=/7=/ -s/9=/8=/ - -s/^\([0-9]*\)1-/\1_-/ -s/^\([0-9]*\)2-/\11-/ -s/^\([0-9]*\)3-/\12-/ -s/^\([0-9]*\)4-/\13-/ -s/^\([0-9]*\)5-/\14-/ -s/^\([0-9]*\)6-/\15-/ -s/^\([0-9]*\)7-/\16-/ -s/^\([0-9]*\)8-/\17-/ -s/^\([0-9]*\)9-/\18-/ -s/^\([0-9]*\)0-/\1'9-/ -s/_/0/ - -: scarry -/0'/{ - s//'9/ - b scarry -} -/^'/{ - b under -} -s/1'/0/ -s/2'/1/ -s/3'/2/ -s/4'/3/ -s/5'/4/ -s/6'/5/ -s/7'/6/ -s/8'/7/ -s/9'/8/ - -b sub diff --git a/tools/regression/usr.bin/sed/multitest.t b/tools/regression/usr.bin/sed/multitest.t deleted file mode 100644 index 801e392561b35..0000000000000 --- a/tools/regression/usr.bin/sed/multitest.t +++ /dev/null @@ -1,556 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 1992 Diomidis Spinellis. -# Copyright (c) 1992, 1993 -# The Regents of the University of California. 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. -# 4. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -# -# @(#)sed.test 8.1 (Berkeley) 6/6/93 -# -# $FreeBSD$ -# - -# sed Regression Tests -# -# The following files are created: -# lines[1-4], script1, script2 -# Two directories *.out contain the test results - -main() -{ - BASE=/usr/bin/sed - BASELOG=sed.out - TEST=`cd ..; make whereobj`/sed - TESTLOG=nsed.out - DICT=/usr/share/dict/words - - test_error | more - - awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1 - awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2 - - exec 4>&1 5>&2 - - # Set these flags to get messages about known problems - BSD=1 - GNU=0 - SUN=0 - tests $BASE $BASELOG - - BSD=0 - GNU=0 - SUN=0 - tests $TEST $TESTLOG - exec 1>&4 2>&5 - diff -c $BASELOG $TESTLOG | more -} - -tests() -{ - SED=$1 - DIR=$2 - rm -rf $DIR - mkdir $DIR - MARK=100 - - test_args - test_addr - echo Testing commands - test_group - test_acid - test_branch - test_pattern - test_print - test_subst -} - -mark() -{ - MARK=`expr $MARK + 1` - exec 1>&4 2>&5 - exec >"$DIR/${MARK}_$1" - echo "Test $1:$MARK" - # Uncomment this line to match tests with sed error messages - echo "Test $1:$MARK" >&5 -} - -test_args() -{ - mark '1.1' - echo Testing argument parsing - echo First type - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED 's/^/e1_/p' lines1 - fi - mark '1.2' ; $SED -n 's/^/e1_/p' lines1 - mark '1.3' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED 's/^/e1_/p' <lines1 - fi - mark '1.4' ; $SED -n 's/^/e1_/p' <lines1 - echo Second type - mark '1.4.1' - if [ $SUN -eq 1 ] ; then - echo SunOS sed fails this - fi - $SED -e '' <lines1 - echo 's/^/s1_/p' >script1 - echo 's/^/s2_/p' >script2 - mark '1.5' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 lines1 - fi - mark '1.6' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 <lines1 - fi - mark '1.7' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' lines1 - fi - mark '1.8' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' <lines1 - fi - mark '1.9' ; $SED -n -f script1 lines1 - mark '1.10' ; $SED -n -f script1 <lines1 - mark '1.11' ; $SED -n -e 's/^/e1_/p' lines1 - mark '1.12' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -n -e 's/^/e1_/p' <lines1 - fi - mark '1.13' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' -e 's/^/e2_/p' lines1 - fi - mark '1.14' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 -f script2 lines1 - fi - mark '1.15' - if [ $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo GNU and SunOS sed fail this following older POSIX draft - else - $SED -e 's/^/e1_/p' -f script1 lines1 - fi - mark '1.16' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' lines1 lines1 - fi - # POSIX D11.2:11251 - mark '1.17' ; $SED p <lines1 lines1 -cat >script1 <<EOF -#n -# A comment - -p -EOF - mark '1.18' ; $SED -f script1 <lines1 lines1 -} - -test_addr() -{ - echo Testing address ranges - mark '2.1' ; $SED -n -e '4p' lines1 - mark '2.2' ; $SED -n -e '20p' lines1 lines2 - mark '2.3' ; $SED -n -e '$p' lines1 - mark '2.4' ; $SED -n -e '$p' lines1 lines2 - mark '2.5' ; $SED -n -e '$a\ -hello' /dev/null - mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2 - # Should not print anything - mark '2.7' ; $SED -n -e '20p' lines1 - mark '2.8' ; $SED -n -e '0p' lines1 - mark '2.9' ; $SED -n '/l1_7/p' lines1 - mark '2.10' ; $SED -n ' /l1_7/ p' lines1 - mark '2.11' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '\_l1\_7_p' lines1 - mark '2.12' ; $SED -n '1,4p' lines1 - mark '2.13' ; $SED -n '1,$p' lines1 lines2 - mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2 - mark '2.15' ; $SED -n '/4/,$p' lines1 lines2 - mark '2.16' ; $SED -n '/4/,20p' lines1 lines2 - mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2 - mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2 - mark '2.19' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '12,3p' lines1 lines2 - mark '2.20' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '/l1_7/,3p' lines1 lines2 -} - -test_group() -{ - echo Brace and other grouping - mark '3.1' ; $SED -e ' -4,12 { - s/^/^/ - s/$/$/ - s/_/T/ -}' lines1 - mark '3.2' ; $SED -e ' -4,12 { - s/^/^/ - /6/,/10/ { - s/$/$/ - /8/ s/_/T/ - } -}' lines1 - mark '3.3' ; $SED -e ' -4,12 !{ - s/^/^/ - /6/,/10/ !{ - s/$/$/ - /8/ !s/_/T/ - } -}' lines1 - mark '3.4' ; $SED -e '4,12!s/^/^/' lines1 -} - -test_acid() -{ - echo Testing a c d and i commands - mark '4.1' ; $SED -n -e ' -s/^/before_i/p -20i\ -inserted -s/^/after_i/p -' lines1 lines2 - mark '4.2' ; $SED -n -e ' -5,12s/^/5-12/ -s/^/before_a/p -/5-12/a\ -appended -s/^/after_a/p -' lines1 lines2 - mark '4.3' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n -e ' -s/^/^/p -/l1_/a\ -appended -8,10N -s/$/$/p -' lines1 lines2 - mark '4.4' ; $SED -n -e ' -c\ -hello -' lines1 - mark '4.5' ; $SED -n -e ' -8c\ -hello -' lines1 - mark '4.6' ; $SED -n -e ' -3,14c\ -hello -' lines1 -# SunOS and GNU sed behave differently. We follow POSIX -# mark '4.7' ; $SED -n -e ' -#8,3c\ -#hello -#' lines1 - mark '4.8' ; $SED d <lines1 -} - -test_branch() -{ - echo Testing labels and branching - mark '5.1' ; $SED -n -e ' -b label4 -:label3 -s/^/label3_/p -b end -:label4 -2,12b label1 -b label2 -:label1 -s/^/label1_/p -b -:label2 -s/^/label2_/p -b label3 -:end -' lines1 - mark '5.2' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - $SED -n -e ' -s/l1_/l2_/ -t ok -b -:ok -s/^/tested /p -' lines1 lines2 -# SunOS sed behaves differently here. Clarification needed. -# mark '5.3' ; $SED -n -e ' -#5,8b inside -#1,5 { -# s/^/^/p -# :inside -# s/$/$/p -#} -#' lines1 -# Check that t clears the substitution done flag - mark '5.4' ; $SED -n -e ' -1,8s/^/^/ -t l1 -:l1 -t l2 -s/$/$/p -b -:l2 -s/^/ERROR/ -' lines1 -# Check that reading a line clears the substitution done flag - mark '5.5' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - $SED -n -e ' -t l2 -1,8s/^/^/p -2,7N -b -:l2 -s/^/ERROR/p -' lines1 - mark '5.6' ; $SED 5q lines1 - mark '5.7' ; $SED -e ' -5i\ -hello -5q' lines1 -# Branch across block boundary - mark '5.8' ; $SED -e ' -{ -:b -} -s/l/m/ -tb' lines1 -} - -test_pattern() -{ -echo Pattern space commands -# Check that the pattern space is deleted - mark '6.1' ; $SED -n -e ' -c\ -changed -p -' lines1 - mark '6.2' ; $SED -n -e ' -4d -p -' lines1 -# SunOS sed refused to print here -# mark '6.3' ; $SED -e ' -#N -#N -#N -#D -#P -#4p -#' lines1 - mark '6.4' ; $SED -e ' -2h -3H -4g -5G -6x -6p -6x -6p -' lines1 - mark '6.5' ; $SED -e '4n' lines1 - mark '6.6' ; $SED -n -e '4n' lines1 -} - -test_print() -{ - echo Testing print and file routines - awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \ - </dev/null >lines3 - # GNU and SunOS sed behave differently here - mark '7.1' - $SED -n l lines3 - mark '7.2' ; $SED -e '/l2_/=' lines1 lines2 - rm -f lines4 - mark '7.3' ; $SED -e '3,12w lines4' lines1 - echo w results - cat lines4 - mark '7.4' ; $SED -e '4r lines2' lines1 - mark '7.5' ; $SED -e '5r /dev/dds' lines1 - mark '7.6' ; $SED -e '6r /dev/null' lines1 - mark '7.7' - if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo BSD, GNU and SunOS cannot pass this one - else - sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1 - rm -rf tmpdir - mkdir tmpdir - $SED -f script1 lines1 - cat tmpdir/* - rm -rf tmpdir - fi - mark '7.8' - if [ $BSD -eq 1 ] ; then - echo BSD sed cannot pass 7.7 - else - echo line1 > lines3 - echo "" >> lines3 - $SED -n -e '$p' lines3 /dev/null - fi - -} - -test_subst() -{ - echo Testing substitution commands - mark '8.1' ; $SED -e 's/./X/g' lines1 - mark '8.2' ; $SED -e 's,.,X,g' lines1 -# GNU and SunOS sed thinks we are escaping . as wildcard, not as separator -# mark '8.3' ; $SED -e 's.\..X.g' lines1 -# POSIX does not say that this should work -# mark '8.4' ; $SED -e 's/[/]/Q/' lines1 - mark '8.4' ; $SED -e 's/[\/]/Q/' lines1 - mark '8.5' ; $SED -e 's_\__X_' lines1 - mark '8.6' ; $SED -e 's/./(&)/g' lines1 - mark '8.7' ; $SED -e 's/./(\&)/g' lines1 - mark '8.8' ; $SED -e 's/\(.\)\(.\)\(.\)/x\3x\2x\1/g' lines1 - mark '8.9' ; $SED -e 's/_/u0\ -u1\ -u2/g' lines1 - mark '8.10' - if [ $BSD -eq 1 -o $GNU -eq 1 ] ; then - echo 'BSD/GNU sed do not understand digit flags on s commands' - fi - $SED -e 's/./X/4' lines1 - rm -f lines4 - mark '8.11' ; $SED -e 's/1/X/w lines4' lines1 - echo s wfile results - cat lines4 - mark '8.12' ; $SED -e 's/[123]/X/g' lines1 - mark '8.13' ; $SED -e 'y/0123456789/9876543210/' lines1 - mark '8.14' ; - if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo BSD/GNU/SUN sed fail this test - else - $SED -e 'y10\123456789198765432\101' lines1 - fi - mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1 - mark '8.16' - echo 'eeefff' | $SED -e ' - p - s/e/X/p - :x - s//Y/p - # Establish limit counter in the hold space - # GNU sed version 3.02 enters into an infinite loop here - x - /.\{10\}/ { - s/.*/ERROR/ - b - } - s/.*/&./ - x - /f/bx - ' -} - -test_error() -{ - exec 0>&3 4>&1 5>&2 - exec 0</dev/null - exec 2>&1 - set -x - $TEST -x && exit 1 - $TEST -f && exit 1 - $TEST -e && exit 1 - $TEST -f /dev/dds && exit 1 - $TEST p /dev/dds && exit 1 - $TEST -f /bin/sh && exit 1 - $TEST '{' && exit 1 - $TEST '{' && exit 1 - $TEST '/hello/' && exit 1 - $TEST '1,/hello/' && exit 1 - $TEST -e '-5p' && exit 1 - $TEST '/jj' && exit 1 - $TEST 'a hello' && exit 1 - $TEST 'a \ hello' && exit 1 - $TEST 'b foo' && exit 1 - $TEST 'd hello' && exit 1 - $TEST 's/aa' && exit 1 - $TEST 's/aa/' && exit 1 - $TEST 's/a/b' && exit 1 - $TEST 's/a/b/c/d' && exit 1 - $TEST 's/a/b/ 1 2' && exit 1 - $TEST 's/a/b/ 1 g' && exit 1 - $TEST 's/a/b/w' && exit 1 - $TEST 'y/aa' && exit 1 - $TEST 'y/aa/b/' && exit 1 - $TEST 'y/aa/' && exit 1 - $TEST 'y/a/b' && exit 1 - $TEST 'y/a/b/c/d' && exit 1 - $TEST '!' && exit 1 - $TEST supercalifrangolisticexprialidociussupercalifrangolisticexcius - set +x - exec 0>&3 1>&4 2>&5 -} - -main diff --git a/tools/regression/usr.bin/sed/sed.test b/tools/regression/usr.bin/sed/sed.test deleted file mode 100644 index 801e392561b35..0000000000000 --- a/tools/regression/usr.bin/sed/sed.test +++ /dev/null @@ -1,556 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 1992 Diomidis Spinellis. -# Copyright (c) 1992, 1993 -# The Regents of the University of California. 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. -# 4. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -# -# @(#)sed.test 8.1 (Berkeley) 6/6/93 -# -# $FreeBSD$ -# - -# sed Regression Tests -# -# The following files are created: -# lines[1-4], script1, script2 -# Two directories *.out contain the test results - -main() -{ - BASE=/usr/bin/sed - BASELOG=sed.out - TEST=`cd ..; make whereobj`/sed - TESTLOG=nsed.out - DICT=/usr/share/dict/words - - test_error | more - - awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1 - awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2 - - exec 4>&1 5>&2 - - # Set these flags to get messages about known problems - BSD=1 - GNU=0 - SUN=0 - tests $BASE $BASELOG - - BSD=0 - GNU=0 - SUN=0 - tests $TEST $TESTLOG - exec 1>&4 2>&5 - diff -c $BASELOG $TESTLOG | more -} - -tests() -{ - SED=$1 - DIR=$2 - rm -rf $DIR - mkdir $DIR - MARK=100 - - test_args - test_addr - echo Testing commands - test_group - test_acid - test_branch - test_pattern - test_print - test_subst -} - -mark() -{ - MARK=`expr $MARK + 1` - exec 1>&4 2>&5 - exec >"$DIR/${MARK}_$1" - echo "Test $1:$MARK" - # Uncomment this line to match tests with sed error messages - echo "Test $1:$MARK" >&5 -} - -test_args() -{ - mark '1.1' - echo Testing argument parsing - echo First type - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED 's/^/e1_/p' lines1 - fi - mark '1.2' ; $SED -n 's/^/e1_/p' lines1 - mark '1.3' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED 's/^/e1_/p' <lines1 - fi - mark '1.4' ; $SED -n 's/^/e1_/p' <lines1 - echo Second type - mark '1.4.1' - if [ $SUN -eq 1 ] ; then - echo SunOS sed fails this - fi - $SED -e '' <lines1 - echo 's/^/s1_/p' >script1 - echo 's/^/s2_/p' >script2 - mark '1.5' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 lines1 - fi - mark '1.6' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 <lines1 - fi - mark '1.7' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' lines1 - fi - mark '1.8' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' <lines1 - fi - mark '1.9' ; $SED -n -f script1 lines1 - mark '1.10' ; $SED -n -f script1 <lines1 - mark '1.11' ; $SED -n -e 's/^/e1_/p' lines1 - mark '1.12' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -n -e 's/^/e1_/p' <lines1 - fi - mark '1.13' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' -e 's/^/e2_/p' lines1 - fi - mark '1.14' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -f script1 -f script2 lines1 - fi - mark '1.15' - if [ $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo GNU and SunOS sed fail this following older POSIX draft - else - $SED -e 's/^/e1_/p' -f script1 lines1 - fi - mark '1.16' - if [ $SUN -eq 1 ] ; then - echo SunOS sed prints only with -n - else - $SED -e 's/^/e1_/p' lines1 lines1 - fi - # POSIX D11.2:11251 - mark '1.17' ; $SED p <lines1 lines1 -cat >script1 <<EOF -#n -# A comment - -p -EOF - mark '1.18' ; $SED -f script1 <lines1 lines1 -} - -test_addr() -{ - echo Testing address ranges - mark '2.1' ; $SED -n -e '4p' lines1 - mark '2.2' ; $SED -n -e '20p' lines1 lines2 - mark '2.3' ; $SED -n -e '$p' lines1 - mark '2.4' ; $SED -n -e '$p' lines1 lines2 - mark '2.5' ; $SED -n -e '$a\ -hello' /dev/null - mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2 - # Should not print anything - mark '2.7' ; $SED -n -e '20p' lines1 - mark '2.8' ; $SED -n -e '0p' lines1 - mark '2.9' ; $SED -n '/l1_7/p' lines1 - mark '2.10' ; $SED -n ' /l1_7/ p' lines1 - mark '2.11' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '\_l1\_7_p' lines1 - mark '2.12' ; $SED -n '1,4p' lines1 - mark '2.13' ; $SED -n '1,$p' lines1 lines2 - mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2 - mark '2.15' ; $SED -n '/4/,$p' lines1 lines2 - mark '2.16' ; $SED -n '/4/,20p' lines1 lines2 - mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2 - mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2 - mark '2.19' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '12,3p' lines1 lines2 - mark '2.20' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n '/l1_7/,3p' lines1 lines2 -} - -test_group() -{ - echo Brace and other grouping - mark '3.1' ; $SED -e ' -4,12 { - s/^/^/ - s/$/$/ - s/_/T/ -}' lines1 - mark '3.2' ; $SED -e ' -4,12 { - s/^/^/ - /6/,/10/ { - s/$/$/ - /8/ s/_/T/ - } -}' lines1 - mark '3.3' ; $SED -e ' -4,12 !{ - s/^/^/ - /6/,/10/ !{ - s/$/$/ - /8/ !s/_/T/ - } -}' lines1 - mark '3.4' ; $SED -e '4,12!s/^/^/' lines1 -} - -test_acid() -{ - echo Testing a c d and i commands - mark '4.1' ; $SED -n -e ' -s/^/before_i/p -20i\ -inserted -s/^/after_i/p -' lines1 lines2 - mark '4.2' ; $SED -n -e ' -5,12s/^/5-12/ -s/^/before_a/p -/5-12/a\ -appended -s/^/after_a/p -' lines1 lines2 - mark '4.3' - if [ $GNU -eq 1 ] ; then - echo GNU sed fails this - fi - $SED -n -e ' -s/^/^/p -/l1_/a\ -appended -8,10N -s/$/$/p -' lines1 lines2 - mark '4.4' ; $SED -n -e ' -c\ -hello -' lines1 - mark '4.5' ; $SED -n -e ' -8c\ -hello -' lines1 - mark '4.6' ; $SED -n -e ' -3,14c\ -hello -' lines1 -# SunOS and GNU sed behave differently. We follow POSIX -# mark '4.7' ; $SED -n -e ' -#8,3c\ -#hello -#' lines1 - mark '4.8' ; $SED d <lines1 -} - -test_branch() -{ - echo Testing labels and branching - mark '5.1' ; $SED -n -e ' -b label4 -:label3 -s/^/label3_/p -b end -:label4 -2,12b label1 -b label2 -:label1 -s/^/label1_/p -b -:label2 -s/^/label2_/p -b label3 -:end -' lines1 - mark '5.2' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - $SED -n -e ' -s/l1_/l2_/ -t ok -b -:ok -s/^/tested /p -' lines1 lines2 -# SunOS sed behaves differently here. Clarification needed. -# mark '5.3' ; $SED -n -e ' -#5,8b inside -#1,5 { -# s/^/^/p -# :inside -# s/$/$/p -#} -#' lines1 -# Check that t clears the substitution done flag - mark '5.4' ; $SED -n -e ' -1,8s/^/^/ -t l1 -:l1 -t l2 -s/$/$/p -b -:l2 -s/^/ERROR/ -' lines1 -# Check that reading a line clears the substitution done flag - mark '5.5' - if [ $BSD -eq 1 ] ; then - echo BSD sed fails this test - fi - $SED -n -e ' -t l2 -1,8s/^/^/p -2,7N -b -:l2 -s/^/ERROR/p -' lines1 - mark '5.6' ; $SED 5q lines1 - mark '5.7' ; $SED -e ' -5i\ -hello -5q' lines1 -# Branch across block boundary - mark '5.8' ; $SED -e ' -{ -:b -} -s/l/m/ -tb' lines1 -} - -test_pattern() -{ -echo Pattern space commands -# Check that the pattern space is deleted - mark '6.1' ; $SED -n -e ' -c\ -changed -p -' lines1 - mark '6.2' ; $SED -n -e ' -4d -p -' lines1 -# SunOS sed refused to print here -# mark '6.3' ; $SED -e ' -#N -#N -#N -#D -#P -#4p -#' lines1 - mark '6.4' ; $SED -e ' -2h -3H -4g -5G -6x -6p -6x -6p -' lines1 - mark '6.5' ; $SED -e '4n' lines1 - mark '6.6' ; $SED -n -e '4n' lines1 -} - -test_print() -{ - echo Testing print and file routines - awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \ - </dev/null >lines3 - # GNU and SunOS sed behave differently here - mark '7.1' - $SED -n l lines3 - mark '7.2' ; $SED -e '/l2_/=' lines1 lines2 - rm -f lines4 - mark '7.3' ; $SED -e '3,12w lines4' lines1 - echo w results - cat lines4 - mark '7.4' ; $SED -e '4r lines2' lines1 - mark '7.5' ; $SED -e '5r /dev/dds' lines1 - mark '7.6' ; $SED -e '6r /dev/null' lines1 - mark '7.7' - if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo BSD, GNU and SunOS cannot pass this one - else - sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1 - rm -rf tmpdir - mkdir tmpdir - $SED -f script1 lines1 - cat tmpdir/* - rm -rf tmpdir - fi - mark '7.8' - if [ $BSD -eq 1 ] ; then - echo BSD sed cannot pass 7.7 - else - echo line1 > lines3 - echo "" >> lines3 - $SED -n -e '$p' lines3 /dev/null - fi - -} - -test_subst() -{ - echo Testing substitution commands - mark '8.1' ; $SED -e 's/./X/g' lines1 - mark '8.2' ; $SED -e 's,.,X,g' lines1 -# GNU and SunOS sed thinks we are escaping . as wildcard, not as separator -# mark '8.3' ; $SED -e 's.\..X.g' lines1 -# POSIX does not say that this should work -# mark '8.4' ; $SED -e 's/[/]/Q/' lines1 - mark '8.4' ; $SED -e 's/[\/]/Q/' lines1 - mark '8.5' ; $SED -e 's_\__X_' lines1 - mark '8.6' ; $SED -e 's/./(&)/g' lines1 - mark '8.7' ; $SED -e 's/./(\&)/g' lines1 - mark '8.8' ; $SED -e 's/\(.\)\(.\)\(.\)/x\3x\2x\1/g' lines1 - mark '8.9' ; $SED -e 's/_/u0\ -u1\ -u2/g' lines1 - mark '8.10' - if [ $BSD -eq 1 -o $GNU -eq 1 ] ; then - echo 'BSD/GNU sed do not understand digit flags on s commands' - fi - $SED -e 's/./X/4' lines1 - rm -f lines4 - mark '8.11' ; $SED -e 's/1/X/w lines4' lines1 - echo s wfile results - cat lines4 - mark '8.12' ; $SED -e 's/[123]/X/g' lines1 - mark '8.13' ; $SED -e 'y/0123456789/9876543210/' lines1 - mark '8.14' ; - if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then - echo BSD/GNU/SUN sed fail this test - else - $SED -e 'y10\123456789198765432\101' lines1 - fi - mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1 - mark '8.16' - echo 'eeefff' | $SED -e ' - p - s/e/X/p - :x - s//Y/p - # Establish limit counter in the hold space - # GNU sed version 3.02 enters into an infinite loop here - x - /.\{10\}/ { - s/.*/ERROR/ - b - } - s/.*/&./ - x - /f/bx - ' -} - -test_error() -{ - exec 0>&3 4>&1 5>&2 - exec 0</dev/null - exec 2>&1 - set -x - $TEST -x && exit 1 - $TEST -f && exit 1 - $TEST -e && exit 1 - $TEST -f /dev/dds && exit 1 - $TEST p /dev/dds && exit 1 - $TEST -f /bin/sh && exit 1 - $TEST '{' && exit 1 - $TEST '{' && exit 1 - $TEST '/hello/' && exit 1 - $TEST '1,/hello/' && exit 1 - $TEST -e '-5p' && exit 1 - $TEST '/jj' && exit 1 - $TEST 'a hello' && exit 1 - $TEST 'a \ hello' && exit 1 - $TEST 'b foo' && exit 1 - $TEST 'd hello' && exit 1 - $TEST 's/aa' && exit 1 - $TEST 's/aa/' && exit 1 - $TEST 's/a/b' && exit 1 - $TEST 's/a/b/c/d' && exit 1 - $TEST 's/a/b/ 1 2' && exit 1 - $TEST 's/a/b/ 1 g' && exit 1 - $TEST 's/a/b/w' && exit 1 - $TEST 'y/aa' && exit 1 - $TEST 'y/aa/b/' && exit 1 - $TEST 'y/aa/' && exit 1 - $TEST 'y/a/b' && exit 1 - $TEST 'y/a/b/c/d' && exit 1 - $TEST '!' && exit 1 - $TEST supercalifrangolisticexprialidociussupercalifrangolisticexcius - set +x - exec 0>&3 1>&4 2>&5 -} - -main |
