diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-11-24 04:04:20 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-11-24 04:04:20 +0000 |
commit | ec13b56f5101cb9445e547a57a8ebd603e6a62f8 (patch) | |
tree | 3ee7caad68d2d428bf1ce59c178e31312f2cf627 /regress | |
parent | a404be7a2d226b4fb829bb86335aa6281d6d14d4 (diff) |
add some more tail tests, from Martijn van Duren
Diffstat (limited to 'regress')
25 files changed, 2122 insertions, 1 deletions
diff --git a/regress/usr.bin/tail/Makefile b/regress/usr.bin/tail/Makefile index 5adb880a532..f0da0dd4753 100644 --- a/regress/usr.bin/tail/Makefile +++ b/regress/usr.bin/tail/Makefile @@ -1,6 +1,9 @@ -# $OpenBSD: Makefile,v 1.1 2012/11/01 10:49:11 landry Exp $ +# $OpenBSD: Makefile,v 1.2 2015/11/24 04:04:19 tedu Exp $ REGRESS_TARGETS = follow-renames follow-overwrite-by-file follow-overwrite-data follow-removed-recreated follow-newsyslog +REGRESS_TARGETS+= forward-blocks forward-chars forward-lines reverse-blocks reverse-chars reverse-lines +REGRESS_TARGETS+= forward-blocks-rprint forward-chars-rprint forward-lines-rprint +REGRESS_TARGETS+= reverse-blocks-rprint reverse-chars-rprint reverse-lines-rprint REGRESS_ROOT_TARGETS = follow-newsyslog .for t in ${REGRESS_ROOT_TARGETS} diff --git a/regress/usr.bin/tail/forward-blocks-rprint.out b/regress/usr.bin/tail/forward-blocks-rprint.out new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/regress/usr.bin/tail/forward-blocks-rprint.out diff --git a/regress/usr.bin/tail/forward-blocks-rprint.sh b/regress/usr.bin/tail/forward-blocks-rprint.sh new file mode 100644 index 00000000000..63a87ac2432 --- /dev/null +++ b/regress/usr.bin/tail/forward-blocks-rprint.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $OpenBSD: forward-blocks-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -r -b +1 ${DIR}/bar > ${OUT} + +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/forward-blocks.out b/regress/usr.bin/tail/forward-blocks.out new file mode 100644 index 00000000000..84fb9221523 --- /dev/null +++ b/regress/usr.bin/tail/forward-blocks.out @@ -0,0 +1,512 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/forward-blocks.sh b/regress/usr.bin/tail/forward-blocks.sh new file mode 100644 index 00000000000..727f95461c7 --- /dev/null +++ b/regress/usr.bin/tail/forward-blocks.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $OpenBSD: forward-blocks.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -b +1 ${DIR}/bar > ${OUT} + +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/forward-chars-rprint.out b/regress/usr.bin/tail/forward-chars-rprint.out new file mode 100644 index 00000000000..cf004cad0f8 --- /dev/null +++ b/regress/usr.bin/tail/forward-chars-rprint.out @@ -0,0 +1,13 @@ +511 +510 +509 +508 +507 +506 +505 +504 +503 +502 +501 +500 + diff --git a/regress/usr.bin/tail/forward-chars-rprint.sh b/regress/usr.bin/tail/forward-chars-rprint.sh new file mode 100644 index 00000000000..e832158aa36 --- /dev/null +++ b/regress/usr.bin/tail/forward-chars-rprint.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $OpenBSD: forward-chars-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -r -c +50 ${DIR}/bar > ${OUT} + +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/forward-chars.out b/regress/usr.bin/tail/forward-chars.out new file mode 100644 index 00000000000..e9d867f7cd1 --- /dev/null +++ b/regress/usr.bin/tail/forward-chars.out @@ -0,0 +1,493 @@ + +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/forward-chars.sh b/regress/usr.bin/tail/forward-chars.sh new file mode 100644 index 00000000000..a82ddbf94ac --- /dev/null +++ b/regress/usr.bin/tail/forward-chars.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $OpenBSD: forward-chars.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -c +50 ${DIR}/bar > ${OUT} + +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/forward-lines-rprint.out b/regress/usr.bin/tail/forward-lines-rprint.out new file mode 100644 index 00000000000..32a79c6557a --- /dev/null +++ b/regress/usr.bin/tail/forward-lines-rprint.out @@ -0,0 +1,4 @@ +511 +510 +509 +508 diff --git a/regress/usr.bin/tail/forward-lines-rprint.sh b/regress/usr.bin/tail/forward-lines-rprint.sh new file mode 100644 index 00000000000..fe65d9b2682 --- /dev/null +++ b/regress/usr.bin/tail/forward-lines-rprint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: forward-lines-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -r -n +5 ${DIR}/bar > ${OUT} +tail -r +5 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/forward-lines.out b/regress/usr.bin/tail/forward-lines.out new file mode 100644 index 00000000000..bda61c7c2fb --- /dev/null +++ b/regress/usr.bin/tail/forward-lines.out @@ -0,0 +1,508 @@ +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/forward-lines.sh b/regress/usr.bin/tail/forward-lines.sh new file mode 100644 index 00000000000..2ed03b23436 --- /dev/null +++ b/regress/usr.bin/tail/forward-lines.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: forward-lines.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -n +5 ${DIR}/bar > ${OUT} +tail +5 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-blocks-rprint.out b/regress/usr.bin/tail/reverse-blocks-rprint.out new file mode 100644 index 00000000000..5d8a88e8d04 --- /dev/null +++ b/regress/usr.bin/tail/reverse-blocks-rprint.out @@ -0,0 +1,128 @@ +511 +510 +509 +508 +507 +506 +505 +504 +503 +502 +501 +500 +499 +498 +497 +496 +495 +494 +493 +492 +491 +490 +489 +488 +487 +486 +485 +484 +483 +482 +481 +480 +479 +478 +477 +476 +475 +474 +473 +472 +471 +470 +469 +468 +467 +466 +465 +464 +463 +462 +461 +460 +459 +458 +457 +456 +455 +454 +453 +452 +451 +450 +449 +448 +447 +446 +445 +444 +443 +442 +441 +440 +439 +438 +437 +436 +435 +434 +433 +432 +431 +430 +429 +428 +427 +426 +425 +424 +423 +422 +421 +420 +419 +418 +417 +416 +415 +414 +413 +412 +411 +410 +409 +408 +407 +406 +405 +404 +403 +402 +401 +400 +399 +398 +397 +396 +395 +394 +393 +392 +391 +390 +389 +388 +387 +386 +385 +384 diff --git a/regress/usr.bin/tail/reverse-blocks-rprint.sh b/regress/usr.bin/tail/reverse-blocks-rprint.sh new file mode 100644 index 00000000000..1e68d8b352b --- /dev/null +++ b/regress/usr.bin/tail/reverse-blocks-rprint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: reverse-blocks-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -rb 1 ${DIR}/bar > ${OUT} +tail -r -b -1 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-blocks.out b/regress/usr.bin/tail/reverse-blocks.out new file mode 100644 index 00000000000..7859051cf77 --- /dev/null +++ b/regress/usr.bin/tail/reverse-blocks.out @@ -0,0 +1,128 @@ +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/reverse-blocks.sh b/regress/usr.bin/tail/reverse-blocks.sh new file mode 100644 index 00000000000..9ed1ac77066 --- /dev/null +++ b/regress/usr.bin/tail/reverse-blocks.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: reverse-blocks.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -b 1 ${DIR}/bar > ${OUT} +tail -b -1 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-chars-rprint.out b/regress/usr.bin/tail/reverse-chars-rprint.out new file mode 100644 index 00000000000..6b32a461a5c --- /dev/null +++ b/regress/usr.bin/tail/reverse-chars-rprint.out @@ -0,0 +1,13 @@ +511 +510 +509 +508 +507 +506 +505 +504 +503 +502 +501 +500 +9 diff --git a/regress/usr.bin/tail/reverse-chars-rprint.sh b/regress/usr.bin/tail/reverse-chars-rprint.sh new file mode 100644 index 00000000000..7e8854fc711 --- /dev/null +++ b/regress/usr.bin/tail/reverse-chars-rprint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: reverse-chars-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -rc 50 ${DIR}/bar > ${OUT} +tail -r -c -50 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-chars.out b/regress/usr.bin/tail/reverse-chars.out new file mode 100644 index 00000000000..7fb217140b5 --- /dev/null +++ b/regress/usr.bin/tail/reverse-chars.out @@ -0,0 +1,13 @@ +9 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/reverse-chars.sh b/regress/usr.bin/tail/reverse-chars.sh new file mode 100644 index 00000000000..e4e2c98f933 --- /dev/null +++ b/regress/usr.bin/tail/reverse-chars.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $OpenBSD: reverse-chars.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -c 50 ${DIR}/bar > ${OUT} +tail -c -50 ${DIR}/bar > ${OUT}1 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-lines-rprint.out b/regress/usr.bin/tail/reverse-lines-rprint.out new file mode 100644 index 00000000000..db9421aa2a5 --- /dev/null +++ b/regress/usr.bin/tail/reverse-lines-rprint.out @@ -0,0 +1,5 @@ +511 +510 +509 +508 +507 diff --git a/regress/usr.bin/tail/reverse-lines-rprint.sh b/regress/usr.bin/tail/reverse-lines-rprint.sh new file mode 100644 index 00000000000..a71e4ad9cdf --- /dev/null +++ b/regress/usr.bin/tail/reverse-lines-rprint.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $OpenBSD: reverse-lines-rprint.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -rn 5 ${DIR}/bar > ${OUT} +tail -r -n -5 ${DIR}/bar > ${OUT}1 +tail -r -5 ${DIR}/bar > ${OUT}2 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${OUT}2 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} diff --git a/regress/usr.bin/tail/reverse-lines.out b/regress/usr.bin/tail/reverse-lines.out new file mode 100644 index 00000000000..01b08c13a81 --- /dev/null +++ b/regress/usr.bin/tail/reverse-lines.out @@ -0,0 +1,5 @@ +507 +508 +509 +510 +511 diff --git a/regress/usr.bin/tail/reverse-lines.sh b/regress/usr.bin/tail/reverse-lines.sh new file mode 100644 index 00000000000..c999465996c --- /dev/null +++ b/regress/usr.bin/tail/reverse-lines.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $OpenBSD: reverse-lines.sh,v 1.1 2015/11/24 04:04:19 tedu Exp $ + +# test if tail grep the correct number of blocks from a file. + +DIR=$(mktemp -d) +echo DIR=${DIR} + +NAME=${0##*/} +OUT=${DIR}/${NAME%%.sh}.out +i=0 +while [ ${i} -lt 512 ]; do + echo ${i} >> ${DIR}/bar + i=$((i+1)) +done + +tail -n 5 ${DIR}/bar > ${OUT} +tail -n -5 ${DIR}/bar > ${OUT}1 +tail -5 ${DIR}/bar > ${OUT}2 + +diff -u ${OUT} ${OUT}1 || exit 1 +diff -u ${OUT} ${OUT}2 || exit 1 +diff -u ${OUT} ${0%%.sh}.out || exit 1 + +# cleanup if okay +rm -Rf ${DIR} |