rangetest.1 (2144B)
1 .Dd $Mdocdate$ 2 .Dt RANGETEST 1 3 .Os 4 .Sh NAME 5 .Nm rangetest 6 .Nd tests the output status of a child program with a range of input values 7 .Sh SYNOPSIS 8 .Nm 9 .Ar cmd 10 .Ar min_val 11 .Ar max_val 12 .Sh DESCRIPTION 13 .Nm 14 performs a binary search to test the exit status from a child program 15 invoked with 16 .Ar cmd , 17 where the first occurence of a string @VAL@ is substituted for 18 floating-point values in the search range from 19 .Ar min_val 20 to 21 .Ar max_val . 22 The search range is iteratively narrowed down to find a close 23 approximation of the threshold value where the 24 .Ar cmd 25 transitions between success to failure, as judged by the child program 26 exit status. 27 .Pp 28 The behavior of 29 .Ar cmd 30 should transition once between success and failure in the range of 31 .Ar min_val 32 and 33 .Ar max_val . 34 If 35 .Ar min_val 36 and 37 .Ar max_val 38 both fail or both succeed, 39 .Nm 40 fails. 41 .Sh OUTPUT 42 The parameter values of successful runs are printed to stdout, while 43 values of failed runs are printed to stderr. 44 The output of 45 .Ar cmd 46 is also shown, unless it is suppressed by redirecting its output 47 with ">/dev/null 2>&1". 48 .Sh EXAMPLES 49 Given an example program "condfail", which always fails when its first 50 argument is equal or greater than 1.5, 51 .Nm 52 shows all parameter values which result in a successful invocation: 53 .Dl $ rangetest './condfail @VAL@' 0.0 10.0 2>/dev/null 54 .Dl 0 55 .Dl 1.25 56 .Dl 1.40625 57 .Dl 1.484375 58 .Dl 1.494140625 59 .Pp 60 The values associated with failed invocations are printed in standard error: 61 .Dl $ rangetest './condfail @VAL@' 0.0 10.0 >/dev/null 62 .Dl 10 63 .Dl 5 64 .Dl 2.5 65 .Dl 1.875 66 .Dl 1.5625 67 .Dl 1.5234375 68 .Dl 1.50390625 69 .Pp 70 While the above values all result in a successful invocation of 71 .Ar cmd , 72 .Nm 73 progressively steps closer to the failure threshold. 74 .Pp 75 Find the minimum acceptable length 76 .Op Fl L 77 for the program 78 .Xr cngf-pf 1 , 79 while suppressing its output: 80 .Dl $ ./rangetest 'cngf-pf -L @VAL@ -d 0.1 >/dev/null 2>&1' -2e-1 2e-1 2>/dev/null 81 .Dl 0.2 82 .Dl 0.15 83 .Dl 0.125 84 .Dl 0.1125 85 .Dl 0.10625 86 .Dl 0.103125 87 .Dl 0.101562 88 .Dl 0.100781 89 .Dl 0.100391 90 .Sh SEE ALSO 91 .Xr max 1 , 92 .Xr mean 1 , 93 .Xr min 1 , 94 .Xr range 1 , 95 .Xr sum 1 96 .Sh AUTHORS 97 .An Anders Damsgaard Aq Mt anders@adamsgaard.dk