legacy_test.sh (247274) | legacy_test.sh (251208) |
---|---|
1#!/bin/sh 2 3#- 4# Copyright (c) June 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 14 unchanged lines hidden (view full) --- 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27 28# 29# TEST.sh - check if test(1) or builtin test works 30# | 1#!/bin/sh 2 3#- 4# Copyright (c) June 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions --- 14 unchanged lines hidden (view full) --- 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27 28# 29# TEST.sh - check if test(1) or builtin test works 30# |
31# $FreeBSD: head/tools/regression/bin/test/regress.sh 247274 2013-02-25 19:05:40Z peterj $ | 31# $FreeBSD: head/tools/regression/bin/test/regress.sh 251208 2013-05-31 22:54:20Z jilles $ |
32 33# force a specified test program, e.g. `env test=/bin/test sh regress.sh' 34: ${test=test} 35 36t () 37{ 38 # $1 -> exit code 39 # $2 -> $test expression --- 7 unchanged lines hidden (view full) --- 47 elif [ "$ret" != "$1" ]; then 48 printf "not ok %s - (got $ret, expected $1)\n" "$count $2" 49 else 50 printf "ok %s\n" "$count $2" 51 fi 52} 53 54count=0 | 32 33# force a specified test program, e.g. `env test=/bin/test sh regress.sh' 34: ${test=test} 35 36t () 37{ 38 # $1 -> exit code 39 # $2 -> $test expression --- 7 unchanged lines hidden (view full) --- 47 elif [ "$ret" != "$1" ]; then 48 printf "not ok %s - (got $ret, expected $1)\n" "$count $2" 49 else 50 printf "ok %s\n" "$count $2" 51 fi 52} 53 54count=0 |
55echo "1..266" | 55echo "1..130" |
56 57t 0 'b = b' 58t 0 'b == b' 59t 1 'b != b' 60t 0 '\( b = b \)' 61t 0 '\( b == b \)' 62t 1 '! \( b = b \)' 63t 1 '! \( b == b \)' --- 125 unchanged lines hidden (view full) --- 189t 1 '\( -z -eq \)' 190t 1 '\( ! -eq \)' 191t 0 '\( -n -a \)' 192t 1 '\( -z -a \)' 193t 1 '\( ! -a \)' 194t 0 '\( -n -o \)' 195t 1 '\( -z -o \)' 196t 1 '\( ! -o \)' | 56 57t 0 'b = b' 58t 0 'b == b' 59t 1 'b != b' 60t 0 '\( b = b \)' 61t 0 '\( b == b \)' 62t 1 '! \( b = b \)' 63t 1 '! \( b == b \)' --- 125 unchanged lines hidden (view full) --- 189t 1 '\( -z -eq \)' 190t 1 '\( ! -eq \)' 191t 0 '\( -n -a \)' 192t 1 '\( -z -a \)' 193t 1 '\( ! -a \)' 194t 0 '\( -n -o \)' 195t 1 '\( -z -o \)' 196t 1 '\( ! -o \)' |
197 198# Test all file timestamp comparison operators 199s() { 200 t ${1} "${35} -nt ${36}" 201 t ${2} "${35} -ntaa ${36}" 202 t ${3} "${35} -ntab ${36}" 203 t ${4} "${35} -ntac ${36}" 204 t ${5} "${35} -ntam ${36}" 205 t ${6} "${35} -ntba ${36}" 206 t ${7} "${35} -ntbb ${36}" 207 t ${8} "${35} -ntbc ${36}" 208 t ${9} "${35} -ntbm ${36}" 209 t ${10} "${35} -ntca ${36}" 210 t ${11} "${35} -ntcb ${36}" 211 t ${12} "${35} -ntcc ${36}" 212 t ${13} "${35} -ntcm ${36}" 213 t ${14} "${35} -ntma ${36}" 214 t ${15} "${35} -ntmb ${36}" 215 t ${16} "${35} -ntmc ${36}" 216 t ${17} "${35} -ntmm ${36}" 217 t ${18} "${35} -ot ${36}" 218 t ${19} "${35} -otaa ${36}" 219 t ${20} "${35} -otab ${36}" 220 t ${21} "${35} -otac ${36}" 221 t ${22} "${35} -otam ${36}" 222 t ${23} "${35} -otba ${36}" 223 t ${24} "${35} -otbb ${36}" 224 t ${25} "${35} -otbc ${36}" 225 t ${26} "${35} -otbm ${36}" 226 t ${27} "${35} -otca ${36}" 227 t ${28} "${35} -otcb ${36}" 228 t ${29} "${35} -otcc ${36}" 229 t ${30} "${35} -otcm ${36}" 230 t ${31} "${35} -otma ${36}" 231 t ${32} "${35} -otmb ${36}" 232 t ${33} "${35} -otmc ${36}" 233 t ${34} "${35} -otmm ${36}" 234} 235 236a=/tmp/test$$.1 237b=/tmp/test$$.2 238trap "rm -f $a $b" EXIT 239 240# Tests 131-164 241s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b 242 243touch $a 244# Tests 165-198 245s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b 246 247sleep 2 # Ensure $b is newer than $a 248touch $b 249# Tests 199-232 250s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 $a $b 251 252sleep 2 253echo >$b # Updates mtime & ctime 254sleep 2 255touch -A 01 -a $b 256 257# $b now has ctime > mtime > atime > btime 258# Tests 233-266 259s 1 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 $b $b | |