Ryan Hill wrote:
> Rémi Cardona wrote:
>> Ravi Pinjala a écrit :
>>> I, for one, would like to be able to control whether or not to run tests
>>> that take a huge amount of time to run. Some test suites are
>>> ridiculously comprehensive, and if we could have an option to disable
>>> only those, or even run a reduced test suite, that'd be pretty neat.
>> We've already had this discussion before [1] and there is no
>> one-size-fits-all solution for tagging tests.
>>
>> Ryan's plan only proposes to enable/disable tests based on whether they
>> can run inside a sandbox. That much is doable. Trying to quantify the
>> time a test suite will take to complete is impossible : different
>> arches, vastly different CPU clock speeds, same for HDDs sizes and
>> speeds, ... is impossible.
> 
> I usually disable tests on a per-package basis using /etc/portage/env
> entries.
> 
> [EMAIL PROTECTED] ~ $ cat /etc/portage/env/sci-libs/fftw
> NEWFEATURES=
> 
> for f in ${FEATURES}; do
>     if [[ ! $f == "test" ]]; then
>         NEWFEATURES="${NEWFEATURES} $f"
>     fi
> done
> 
> FEATURES="${NEWFEATURES}"

here's a crappy little script to automate it.

-- 
                  fonts / wxWindows / gcc-porting / treecleaners
  EFFD 380E 047A 4B51 D2BD  C64F 8AA8 8346 F9A4 0662 (0xF9A40662)
#!/bin/bash -
#
# defeature - disable a FEATURE on a per-package basis.
#
# <[EMAIL PROTECTED]>

source /usr/lib/portage/bin/isolated-functions.sh

defeature() {
        if [[ ! $# -eq 2 ]]; then
                echo
                eerror "Usage:  $(basename $0) <FEATURE> <pkgname>"
                echo
                exit 1
        fi

        local pkgcat pkgname

        pkgcat=${!#%%/*}
        pkgname=${!###/*}

        if [[ $(equery w =${pkgname} 2>&1 | grep "No masked" ) ]]; then
                echo
                eerror "No package found matching \"${pkgname}\"."
                echo
                exit 1
        fi

        [[ $pkgcat == $pkgname ]] && pkgcat=

        if [[ -z ${pkgcat} ]]; then

                # Need a better way to get category - use udept for now

                # check for ambiguous package names
                if [[ $(dep -1c ${pkgname} | awk 'END { print NR }') -gt 1 ]]; 
then
                        echo
                        eerror "Found multiple categories for \"${pkgname}\"."
                        eerror "Please use a fully qualified package name 
(cat/package)."
                        echo
                        exit 1
                fi

                pkgcat="$(dep -1c ${pkgname})"
            # strip whitespace
                pkgcat="${pkgcat// /}"
        fi

        [[ ! -d /etc/portage/env/${pkgcat} ]] \
                && sudo mkdir -p /etc/portage/env/${pkgcat}

        # note that this overwrites anything already in the file
        cat > /etc/portage/env/${pkgcat}/${pkgname} <<-EOF
                NEWFEATURES=

                for f in \${FEATURES}; do
                    if [[ ! \$f == "${1}" ]]; then
                                NEWFEATURES="\${NEWFEATURES} \$f"
                        fi
                done

                FEATURES="\${NEWFEATURES}"
        EOF

        if [[ $? -eq 0 ]]; then
                echo
                einfo "${1} FEATURE disabled for ${pkgcat}/${pkgname}."
                echo
        fi

        exit 0
}

defeature "$@"

Reply via email to