public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: Gentoo Dev <gentoo-dev@lists.gentoo.org>
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH 1/2] eclass/tests: add basic tests for multilib_env() expansion
Date: Sat, 28 Mar 2020 11:17:42 -0400	[thread overview]
Message-ID: <CAJ0EP411FucfHBdTDkdO+GBBxvPT14+0mepD7P=uwOv_=Raw0Q@mail.gmail.com> (raw)
In-Reply-To: <20200328094043.648161-1-slyfox@gentoo.org>

On Sat, Mar 28, 2020 at 5:40 AM Sergei Trofimovich <slyfox@gentoo.org> wrote:
>
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
>  eclass/tests/multilib.sh | 61 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
>  create mode 100755 eclass/tests/multilib.sh
>
> diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh
> new file mode 100755
> index 00000000000..308c456b98d
> --- /dev/null
> +++ b/eclass/tests/multilib.sh
> @@ -0,0 +1,61 @@
> +#!/bin/bash
> +# Copyright 1999-2020 Gentoo Foundation

This should say "Copyright 2020 Gentoo Authors".

> +# Distributed under the terms of the GNU General Public License v2
> +
> +source tests-common.sh
> +
> +inherit multilib
> +
> +# Run 'multilib_env' and check what variables it expands to
> +test-multilib_env() {
> +       local target=$1 exp_abi=$2 exp_vars=" $3"
> +       tbegin "expand-target $1"
> +
> +       # Reset default
> +       unset MULTILIB_ABIS
> +       unset DEFAULT_ABI
> +       CFLAGS_default=
> +       LDFLAGS_default=
> +       LIBDIR_default=lib
> +       CHOST_default=${target}
> +       CTARGET_default=${CHOST_default}
> +       LIBDIR_default=lib
> +
> +       multilib_env ${target}
> +
> +       local actual_abi="${DEFAULT_ABI}:${MULTILIB_ABIS}"
> +
> +       local actual_vars=""
> +       local abi var v
> +       for abi in ${MULTILIB_ABIS}; do
> +               actual_vars+=" ${abi}? ("
> +               for var in CHOST LIBDIR CFLAGS LDFLAGS; do
> +                       v=${var}_${abi}
> +                       actual_vars+=" ${var}=${!v}"
> +               done
> +               actual_vars+=" )"
> +       done
> +
> +       [[ "${exp_abi}" == "${actual_abi}" && "${exp_vars}" == "${actual_vars}" ]]
> +
> +       if ! tend $? ; then
> +               printf '### EXPECTED ABI: %s\n' "${exp_abi}"
> +               printf '### ACTUAL   ABI: %s\n' "${actual_abi}"
> +               printf '### EXPECTED VARS: %s\n' "${exp_vars}"
> +               printf '### ACTUAL   VARS: %s\n' "${actual_vars}"
> +       fi
> +}
> +
> +# Pick a few interesting gargets from:

Probably a typo: s/gargets/targets/

> +# $ grep -h -o -R 'CHOST=.*' ../../profiles/ | sort -u
> +
> +test-multilib_env \
> +       "x86_64-pc-linux-gnu" \
> +       "amd64:amd64 x86" \
> +       "amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )"
> +test-multilib_env \
> +       "x86_64-pc-linux-gnux32" \
> +       "x32:x32 amd64 x86" \
> +       "x32? ( CHOST=x86_64-pc-linux-gnux32 LIBDIR=libx32 CFLAGS=-mx32 LDFLAGS= ) amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )"
> +
> +texit
> --
> 2.26.0
>
>


  parent reply	other threads:[~2020-03-28 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-28  9:40 [gentoo-dev] [PATCH 1/2] eclass/tests: add basic tests for multilib_env() expansion Sergei Trofimovich
2020-03-28  9:40 ` [gentoo-dev] [PATCH 2/2] multilib.eclass: multilib_env(): set LIBDIR=lib for *-musl* Sergei Trofimovich
2020-03-28 15:19   ` Mike Gilbert
2020-03-28 19:56     ` Sergei Trofimovich
2020-03-28 15:17 ` Mike Gilbert [this message]
2020-03-28 19:56   ` [gentoo-dev] [PATCH 1/2] eclass/tests: add basic tests for multilib_env() expansion Sergei Trofimovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ0EP411FucfHBdTDkdO+GBBxvPT14+0mepD7P=uwOv_=Raw0Q@mail.gmail.com' \
    --to=floppym@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=slyfox@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox