From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 5e6a5363 for ; Tue, 3 Mar 2020 09:24:10 +0000 (UTC) Received: (qmail 12340 invoked by alias); 3 Mar 2020 09:24:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45509 Received: (qmail 21152 invoked by uid 1010); 3 Mar 2020 09:24:01 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25738. spamassassin: 3.4.2. Clear:RC:0(133.208.98.4):SA:0(-2.6/5.0):. Processed in 1.285075 secs); 03 Mar 2020 09:24:01 -0000 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf01.biglobe.ne.jp designates 133.208.98.4 as permitted sender) X-Biglobe-Sender: From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] find RLIM_NLIMITS correctly on Cygwin Date: Tue, 3 Mar 2020 18:23:24 +0900 References: <82F8CDE0-C95C-4D31-ABFC-EBB3C97799F3@kba.biglobe.ne.jp> <1B509B1C-A670-482F-9D88-2145E15D03A1@kba.biglobe.ne.jp> <20200109131553.hqetnd45sc43z6xb@tarpaulin.shahaf.local2> <087AE8B9-35B0-4258-9626-AACA85471A07@kba.biglobe.ne.jp> <20200111201549.GA1264@tarpaulin.shahaf.local2> <3340070A-53DD-40F0-8363-A8C7D84702D3@kba.biglobe.ne.jp> <374cecf6-45d5-4688-861f-cc52017dbcea@www.fastmail.com> <321F9465-ABF9-465D-9242-7EF9A0EDDBED@kba.biglobe.ne.jp> <20200227132229.3e290918@tarpaulin.shahaf.local2> <84E062E9-E44F-4123-AC41-12E12071924E@kba.biglobe.ne.jp> <20200228141935.0b2d9748@tarpaulin.shahaf.local2> To: zsh-workers@zsh.org In-Reply-To: <20200228141935.0b2d9748@tarpaulin.shahaf.local2> Message-Id: <939538FA-A90B-44DA-AF85-C50D0F516BA0@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3445.104.11) X-Biglobe-Spnum: 44061 > 2020/02/28 23:19, Daniel Shahaf wrote: >=20 > Jun T wrote on Fri, 28 Feb 2020 17:42 +0900: >>=20 >> Currently each test chunk can have flags 'd' 'D' 'q' and 'f'. >> We can add a new flag, say 'n', to make the failure not fatal. >=20 > If we add a new letter flag, we won't be able to make the = non-fatalness > specific to only one platform, though. We a new parameter, we'd be > able to do =C2=AB[[ $OSTYPE =3D=3D cygwin* ]] && = ZTST_failure_is_fatal=3Dfalse=C2=BB. I feel just letting the test fail may be enough, but if we are going to add a new parameter/flag to ztst.zsh then it would be something like the patch below. BTW, in B01cd.ztst, line 73: # . d Don't diff stdout against the expected stdout. What does this '.' mean? Is it just a typo? Test/B01cd.ztst | 7 +++++-- Test/B12limit.ztst | 10 ++++++++++ Test/ztst.zsh | 32 ++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst index d903b7462..a91fdd95d 100644 --- a/Test/B01cd.ztst +++ b/Test/B01cd.ztst @@ -96,8 +96,9 @@ # itself. (The example below isn't particularly useful as errors with # `cd' are unusual.) # -# A couple of features aren't used in this file, but are usefuil in = cases -# where features may not be available so should not be tested. They = boh +# A couple of features aren't used in this file, but are useful in = cases +# where features may not be available so should not be tested, or a +# failure of a test need not be considered as a fatal error. They all # take the form of variables. Note that to keep the test framework = simple # there is no magic in setting the variables: the chunk of code being # executed needs to avoid executing any test code by appropriate = structure @@ -107,6 +108,8 @@ # is to be skipped. # ZTST_skip: Set this in any test case if that single test case is to = be # skipped. Testing resumes at the next test case in the same file. +# ZTST_not_fatal: Set this in any test case if its failure is not = fatal. +# The failure is reported but the test case is considered as passed. # # Syntax highlighting for Vim is available, see Util/ztst-*.vim. cd cdtst.tmp/sub/fake && diff --git a/Test/B12limit.ztst b/Test/B12limit.ztst new file mode 100644 index 000000000..2a072da08 --- /dev/null +++ b/Test/B12limit.ztst @@ -0,0 +1,10 @@ +# check if there is unknown resouce(s) + +%test + + ZTST_not_fatal=3D1 + limit | grep UNKNOWN || print OK +0:Check if there is unknown resouce(s) in the system +>OK +F:A failure here just indicates there is a resource in your system that = is +F:unknown to zsh developers. Please report this to zsh-workers mailing = list. diff --git a/Test/ztst.zsh b/Test/ztst.zsh index 375efd16c..496a5c1bd 100755 --- a/Test/ztst.zsh +++ b/Test/ztst.zsh @@ -133,17 +133,22 @@ rm -rf dummy.tmp *.tmp =20 # Report failure. Note that all output regarding the tests goes to = stdout. # That saves an unpleasant mixture of stdout and stderr to sort out. +# If $2 is given and equal to 1, this faiure is not fatal. ZTST_testfailed() { print -r "Test $ZTST_testname failed: $1" if [[ -n $ZTST_message ]]; then print -r "Was testing: $ZTST_message" fi - print -r "$ZTST_testname: test failed." + if (( $2 =3D=3D 1 )); then + print -r "$ZTST_testname: Non-fatal failure." + else + print -r "$ZTST_testname: test failed." + ZTST_testfailed=3D1 + fi if [[ -n $ZTST_failmsg ]]; then print -r "The following may (or may not) help identifying the = cause: $ZTST_failmsg" fi - ZTST_testfailed=3D1 return 1 } =20 @@ -365,8 +370,8 @@ ZTST_diff() { ZTST_test() { local last match mbegin mend found substlines local diff_out diff_err - local ZTST_skip - integer expected_to_fail + local ZTST_skip ZTST_not_fatal + integer expected_to_fail not_fatal =20 while true; do rm -f $ZTST_in $ZTST_out $ZTST_err @@ -461,6 +466,13 @@ $ZTST_curline" fi fi =20 + if [[ -n $ZTST_not_fatal ]]; then + not_fatal=3D1 + ZTST_not_fatal=3D + else + not_fatal=3D0 + fi + if [[ $ZTST_flags =3D *f* ]]; then expected_to_fail=3D1 ZTST_xfail_diff() { ZTST_diff "$@" > /dev/null } @@ -479,7 +491,7 @@ $ZTST_curline" ZTST_testfailed "bad status $ZTST_status, expected $ZTST_xstatus = from: $ZTST_code${$(<$ZTST_terr):+ Error output: -$(<$ZTST_terr)}" +$(<$ZTST_terr)}" $not_fatal return 1 fi =20 @@ -502,8 +514,8 @@ $(<$ZTST_terr)" ZTST_testfailed "output differs from expected as shown above = for: $ZTST_code${$(<$ZTST_terr):+ Error output: -$(<$ZTST_terr)}" - return 1 +$(<$ZTST_terr)}" $not_fatal + (( not_fatal )) && continue || return 1 fi if [[ $ZTST_flags =3D *q* && -s $ZTST_err ]]; then substlines=3D"$(<$ZTST_err)" @@ -516,12 +528,12 @@ $(<$ZTST_terr)}" continue fi ZTST_testfailed "error output differs from expected as shown = above for: -$ZTST_code" - return 1 +$ZTST_code" $not_fatal + (( not_fatal )) && continue || return 1 fi if (( expected_to_fail )); then ZTST_testfailed "test was expected to fail, but passed." - return 1 + (( not_fatal )) && continue || return 1 fi fi ZTST_verbose 1 "Test successful."