Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 22 / 889a321d00d174ab2baf5ad8d1764ec55b804d
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id F3DE9431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 21 Sep 2014 11:06:51 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id n0cDvN-HYJ84 for <notmuch@notmuchmail.org>;\r
16         Sun, 21 Sep 2014 11:06:45 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id A1A26431FAE\r
19         for <notmuch@notmuchmail.org>; Sun, 21 Sep 2014 11:06:45 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 9B5FD1000C0; Sun, 21 Sep 2014 21:06:25 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH] test: prepare test-lib.sh for possible test system debug\r
25         session\r
26 Date: Sun, 21 Sep 2014 21:06:20 +0300\r
27 Message-Id: <1411322780-11374-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 2.0.0\r
29 Cc: tomi.ollila@iki.fi\r
30 X-BeenThere: notmuch@notmuchmail.org\r
31 X-Mailman-Version: 2.1.13\r
32 Precedence: list\r
33 List-Id: "Use and development of the notmuch mail system."\r
34         <notmuch.notmuchmail.org>\r
35 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
36         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
37 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
38 List-Post: <mailto:notmuch@notmuchmail.org>\r
39 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
40 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
42 X-List-Received-Date: Sun, 21 Sep 2014 18:06:52 -0000\r
43 \r
44 When something in tests fails one possibility to test is to run\r
45 the test script as `bash -x TXXX-testname.sh`. As stderr (fd 2) was\r
46 redirected to separate file during test execution also this set -x\r
47 (xtrace) output would also go there.\r
48 test-lib.sh saves the stderr to fd 7 from where it can be restored,\r
49 and bash has BASH_XTRACEFD variable, which is now given the same value\r
50 7, making bash to output all xtrade information (consistently) there.\r
51 \r
52 This lib file used to save fd's 1 & 2 to 6 & 7 (respectively) in\r
53 test_begin_subtest(), but as those needs to be set *before* XTRACEFD\r
54 variable is set those are now saved at the beginning of the lib (once).\r
55 This is safe and simple thing to do.\r
56 To make xtrace output more verbose PS4 variable was set to contain the\r
57 source file, line number and if execution is in function, that function\r
58 name. Setting this variable has no effect when not xtracing.\r
59 \r
60 As it is known that fd 6 is redirected stdout, printing status can now\r
61 use that fd, instead of saving stdout to fd 5 and use it.\r
62 ---\r
63  test/test-lib-common.sh |  2 +-\r
64  test/test-lib.sh        | 21 ++++++++++++---------\r
65  2 files changed, 13 insertions(+), 10 deletions(-)\r
66 \r
67 diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh\r
68 index 4903038dd9ce..f99ed11162ad 100644\r
69 --- a/test/test-lib-common.sh\r
70 +++ b/test/test-lib-common.sh\r
71 @@ -122,7 +122,7 @@ esac\r
72  test ! -z "$debug" || remove_tmp=$TMP_DIRECTORY\r
73  rm -fr "$test" || {\r
74         GIT_EXIT_OK=t\r
75 -       echo >&5 "FATAL: Cannot prepare test area"\r
76 +       echo >&6 "FATAL: Cannot prepare test area"\r
77         exit 1\r
78  }\r
79  \r
80 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
81 index b9b8fe8ca6ad..4c76fbb52c24 100644\r
82 --- a/test/test-lib.sh\r
83 +++ b/test/test-lib.sh\r
84 @@ -45,6 +45,12 @@ done,*)\r
85         ;;\r
86  esac\r
87  \r
88 +# Save STDOUT to fd 6 and STDERR to fd 7.\r
89 +exec 6>&1 7>&2\r
90 +# Make xtrace debugging (when used) use redirected STDERR, with verbose lead:\r
91 +BASH_XTRACEFD=7\r
92 +export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'\r
93 +\r
94  # Keep the original TERM for say_color and test_emacs\r
95  ORIGINAL_TERM=$TERM\r
96  \r
97 @@ -204,8 +210,6 @@ then\r
98         print_test_description\r
99  fi\r
100  \r
101 -exec 5>&1\r
102 -\r
103  test_failure=0\r
104  test_count=0\r
105  test_fixed=0\r
106 @@ -225,7 +229,7 @@ die () {\r
107         then\r
108                 exit $code\r
109         else\r
110 -               exec >&5\r
111 +               exec >&6\r
112                 say_color error '%-6s' FATAL\r
113                 echo " $test_subtest_name"\r
114                 echo\r
115 @@ -236,7 +240,7 @@ die () {\r
116  \r
117  die_signal () {\r
118         _die_common\r
119 -       echo >&5 "FATAL: $0: interrupted by signal" $((code - 128))\r
120 +       echo >&6 "FATAL: $0: interrupted by signal" $((code - 128))\r
121         exit $code\r
122  }\r
123  \r
124 @@ -544,11 +548,10 @@ test_begin_subtest ()\r
125      fi\r
126      test_subtest_name="$1"\r
127      test_reset_state_\r
128 -    # Remember stdout and stderr file descriptors and redirect test\r
129 -    # output to the previously prepared file descriptors 3 and 4 (see\r
130 -    # below)\r
131 +    # Redirect test output to the previously prepared file descriptors\r
132 +    # 3 and 4 (see below)\r
133      if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi\r
134 -    exec 6>&1 7>&2 >&3 2>&4\r
135 +    exec >&3 2>&4\r
136      inside_subtest=t\r
137  }\r
138  \r
139 @@ -938,7 +941,7 @@ test_expect_code () {\r
140  test_external () {\r
141         test "$#" = 4 && { prereq=$1; shift; } || prereq=\r
142         test "$#" = 3 ||\r
143 -       error >&5 "bug in the test script: not 3 or 4 parameters to test_external"\r
144 +       error >&6 "bug in the test script: not 3 or 4 parameters to test_external"\r
145         test_subtest_name="$1"\r
146         shift\r
147         test_reset_state_\r
148 -- \r
149 2.0.0\r
150 \r