Re: [PATCH v3 1/2] t1300: extract and use test_cmp_config()

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

 



On Tue, Oct 2, 2018 at 12:07 PM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> In many config-related tests it's common to check if a config variable
> has expected value and we want to print the differences when the test
> fails. Doing it the normal way is three lines of shell code. Let's add
> a function do to all this (and a little more).
> [...]
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> @@ -747,6 +747,29 @@ test_cmp() {
> +test_cmp_config() {
> +       local GD

If you re-roll, maybe make this part of the &&-chain to protect
against someone coming along and inserting code above this line
without realizing that the &&-chain is broken.

> +       if test "$1" = "-C"
> +       then
> +               shift &&
> +               GD="-C $1" &&
> +               shift
> +       fi &&
> +       printf "%s\n" "$1" >expect.config &&
> +       shift &&
> +       git $GD config "$@" >actual.config &&
> +       test_cmp expect.config actual.config
> +}



[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]

  Powered by Linux