Re: [PATCHv6 16/16] Introduce portable_unset and use it to ensure proper && chaining

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 3, 2010 at 20:00, Elijah Newren <newren@xxxxxxxxx> wrote:
> Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
> Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
> ---
> Ât/README Â Â Â Â Â| Â 13 +++++--------
> Ât/t0001-init.sh  |  28 ++++++++++++++--------------
> Ât/t7006-pager.sh Â| Â 10 +++++-----
> Ât/t7502-commit.sh | Â Â4 ++--
> Ât/test-lib.sh   |  11 +++++++++++
> Â5 files changed, 37 insertions(+), 29 deletions(-)
>
> diff --git a/t/README b/t/README
> index ee4c0cf..e10c0ce 100644
> --- a/t/README
> +++ b/t/README
> @@ -259,14 +259,11 @@ Do:
> Â Â Â Âtest ...
>
> Â ÂThat way all of the commands in your tests will succeed or fail. If
> - Â you must ignore the return value of something (e.g., the return
> - Â after unsetting a variable that was already unset is unportable) it's
> - Â best to indicate so explicitly with a semicolon:
> -
> - Â Â Â unset HLAGH;
> - Â Â Â git merge hla &&
> - Â Â Â git push gh &&
> - Â Â Â test ...
> + Â you must ignore the return value of something, consider using a
> + Â helper function (e.g. use portable_unset instead of unset, in order
> + Â to avoid unportable return value for unsetting a variable that was
> + Â already unset), or prepending the command with test_might_fail or
> + Â test_must_fail.

This should be:

    diff --git a/t/README b/t/README
    index a1eb7c8..dc4b9d1 100644
    --- a/t/README
    +++ b/t/README
    @@ -259,11 +259,10 @@ Do:
            test ...

        That way all of the commands in your tests will succeed or fail. If
    -   you must ignore the return value of something (e.g., the return
    -   after unsetting a variable that was already unset is unportable) it's
    -   best to indicate so explicitly with a semicolon:
    +   you must ignore the return value of something it's best to indicate
    +   so explicitly with a test_might_fail:

    -       unset HLAGH;
    +       test_might_fail some-command &&
            git merge hla &&
            git push gh &&
            test ...
    @@ -522,6 +521,10 @@ library for your script to use.
                    ...
            '

    + - portable_unset <variable>
    +
    +   .....
    +
     Prerequisites
     -------------

Or something like that. I don't know if we came to an agreement on
using test_might_fail for non-builtins, but the docs on do's & dont's
should mention how to do that, and portable_unset should be documented
in a new section in "Test harness library".
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]