Xref: utzoo comp.os.minix:14782 alt.sources:3288 Path: utzoo!utgpu!news-server.csri.toronto.edu!csri.toronto.edu!wayne Newsgroups: comp.os.minix,alt.sources From: wayne@csri.toronto.edu (Wayne Hayes) Subject: Useful script for Beta testers: on-the-fly compare output of 2 progs Message-ID: <1991Feb23.010328.18506@jarvis.csri.toronto.edu> Organization: CSRI, University of Toronto Date: 23 Feb 91 06:03:28 GMT Lines: 66 (I cancelled the first article of this title about 30 seconds after posting it. I hope it didn't get very far. This version is better.) I wrote this little shell script to Beta test some POSIX programs that are going to be included in Minix 1.6. It's purpose is to compare the output of two versions of a program to ensure they are identical. It uses a crude algorithm to find if it should read a file or the standard input. (Basically if there are any arguments not beginning with "-" or "+" they are assumed to be filenames. Otherwise stdin is read.) ----- #!/bin/sh # a shell script to ensure the output of two versions of a program are identical prog=`basename $0` files='' for i do case "$i" in -*) ;; +*) ;; *) files=1 ;; esac done if test -f "$files" /tmp/$prog.$$ # this one is being tested; sneak it into the path before the above /e/wayne/bin/prog.new "$@" >/tmp/$prog.new.$$ else # read the standard input # we use a named pipe rather than creating a temp file tee /e/wayne/bin/named_pipe | /usr/ucb/$prog "$@" >/tmp/$prog.$$ & /e/wayne/bin/$prog.new "$@" /tmp/$prog.new.$$ fi # test that they're the same if cmp /tmp/$prog.$$ /tmp/$prog.new.$$; then cat /tmp/$prog.$$ rm /tmp/$prog.$$ /tmp/$prog.new.$$ else echo -n "ERROR with the new version of $prog. Arguments were $@ Press return to continue" >/dev/tty line