From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13357 invoked from network); 29 May 2007 14:44:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 29 May 2007 14:44:17 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 35925 invoked from network); 29 May 2007 14:44:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 May 2007 14:44:11 -0000 Received: (qmail 27973 invoked by alias); 29 May 2007 14:44:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23486 Received: (qmail 27964 invoked from network); 29 May 2007 14:44:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 29 May 2007 14:44:08 -0000 Received: (qmail 35613 invoked from network); 29 May 2007 14:44:08 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 29 May 2007 14:44:02 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly03d.srv.mailcontrol.com (MailControl) with ESMTP id l4TEhfXQ017355 for ; Tue, 29 May 2007 15:43:45 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Tue, 29 May 2007 15:43:40 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.8/8.13.4) with ESMTP id l4TEheto027214 for ; Tue, 29 May 2007 15:43:40 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.8/8.13.8/Submit) with ESMTP id l4TEhemW027211 for ; Tue, 29 May 2007 15:43:40 +0100 Message-Id: <200705291443.l4TEhemW027211@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: test output to terminal dehackery Date: Tue, 29 May 2007 15:43:40 +0100 From: Peter Stephenson X-OriginalArrivalTime: 29 May 2007 14:43:40.0842 (UTC) FILETIME=[BFB570A0:01C7A1FF] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-07-05 (www.mailcontrol.com) on 10.68.0.113 We now have the technology to open a file descriptor for test input and terminal output without using up one of the standard shell ones. The {fd} syntax opens up an unused fd from 10 on. Index: Test/A01grammar.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A01grammar.ztst,v retrieving revision 1.14 diff -u -r1.14 A01grammar.ztst --- Test/A01grammar.ztst 8 May 2007 10:02:59 -0000 1.14 +++ Test/A01grammar.ztst 29 May 2007 14:42:22 -0000 @@ -452,7 +452,7 @@ >chrysanthemum contains an e >Zanzibar either begins with a or an upper case letter - print 'This test hangs the shell when it fails...' >&8 + print -u $ZTST_fd 'This test hangs the shell when it fails...' name=0 # The number 4375 here is chosen to produce more than 16384 bytes of output while (( name < 4375 )); do Index: Test/C03traps.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/C03traps.ztst,v retrieving revision 1.10 diff -u -r1.10 C03traps.ztst --- Test/C03traps.ztst 12 Jan 2007 23:10:20 -0000 1.10 +++ Test/C03traps.ztst 29 May 2007 14:42:22 -0000 @@ -122,7 +122,7 @@ # least the full two seconds to make sure we have got the output from the # execution of the trap. - print 'This test takes at least three seconds...' >&8 + print -u $ZTST_fd 'This test takes at least three seconds...' fn1() { trap 'print TERM1' TERM fn2() { trap 'print TERM2; return 1' TERM; sleep 2; } @@ -135,7 +135,7 @@ 0: Nested `trap ... TERM', triggered on inner loop >TERM2 - print 'This test, too, takes at least three seconds...' >&8 + print -u $ZTST_fd 'This test, too, takes at least three seconds...' fn1() { trap 'print TERM1; return 1' TERM fn2() { trap 'print TERM2; return 1' TERM; } @@ -253,7 +253,7 @@ >Exiting, attempt 2 >Running exit trap - print Another test that takes three seconds >&8 + print -u $ZTST_fd Another test that takes three seconds gotsig=0 signal_handler() { echo "parent received signal" Index: Test/D07multibyte.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D07multibyte.ztst,v retrieving revision 1.16 diff -u -r1.16 D07multibyte.ztst --- Test/D07multibyte.ztst 15 Apr 2007 21:42:43 -0000 1.16 +++ Test/D07multibyte.ztst 29 May 2007 14:42:23 -0000 @@ -16,7 +16,7 @@ if [[ -z $mb_ok ]]; then ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented" else - print Testing multibyte with locale $LANG >&8 + print -u $ZTST_fd Testing multibyte with locale $LANG fi %test Index: Test/E01options.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/E01options.ztst,v retrieving revision 1.19 diff -u -r1.19 E01options.ztst --- Test/E01options.ztst 23 May 2007 11:44:49 -0000 1.19 +++ Test/E01options.ztst 29 May 2007 14:42:24 -0000 @@ -668,7 +668,7 @@ >hello # This tests for another race in multios. - print 'This test hangs the shell when it fails...' >&8 + print -u $ZTST_fd 'This test hangs the shell when it fails...' setopt multios echo These are the contents of the file >multio_race.out multio_race_fn() { cat; } Index: Test/ztst.zsh =================================================================== RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v retrieving revision 1.26 diff -u -r1.26 ztst.zsh --- Test/ztst.zsh 28 Nov 2006 22:09:00 -0000 1.26 +++ Test/ztst.zsh 29 May 2007 14:42:24 -0000 @@ -147,10 +147,14 @@ ZTST_verbose() { local lev=$1 shift - [[ -n $ZTST_verbose && $ZTST_verbose -ge $lev ]] && print -r -- $* >&8 + if [[ -n $ZTST_verbose && $ZTST_verbose -ge $lev ]]; then + print -r pu $ZTST_fd -- $* + fi } ZTST_hashmark() { - [[ ZTST_verbose -le 0 && -t 8 ]] && print -nu8 ${(pl:SECONDS::\#::\#\r:)} + if [[ ZTST_verbose -le 0 && -t $ZTST_fd ]]; then + print -n -u$ZTST_fd -- ${(pl:SECONDS::\#::\#\r:)} + fi (( SECONDS > COLUMNS+1 && (SECONDS -= COLUMNS) )) } @@ -159,8 +163,8 @@ exit 1 fi -exec 8>&1 -exec 9<$ZTST_testname +exec {ZTST_fd}>&1 +exec {ZTST_input}<$ZTST_testname # The current line read from the test file. ZTST_curline='' @@ -172,7 +176,7 @@ ZTST_getline() { local IFS= while true; do - read -r ZTST_curline <&9 || return 1 + read -u $ZTST_input -r ZTST_curline || return 1 [[ $ZTST_curline == \#* ]] || return 0 done } -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview