diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2018-06-22 21:36:18 +0200 |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2018-06-22 21:56:15 +0200 |
commit | c7868053376bbce1336a0d6e6a9afce93084ebd0 (patch) | |
tree | 76a5350c9671504f2b94d6cb15dc55dde1838d5a /templates | |
parent | run tests first before build testing the packages (diff) | |
download | tatt-c7868053376bbce1336a0d6e6a9afce93084ebd0.tar.gz tatt-c7868053376bbce1336a0d6e6a9afce93084ebd0.tar.bz2 tatt-c7868053376bbce1336a0d6e6a9afce93084ebd0.zip |
refactor and improve the test script
When doing rdep tests merge the test dependencies first without FEATURES=test,
as we do not want to test them. This avoids build failures because of failing
tests or cycling dependencies, and usually reduces the build time a lot.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/revdep-header | 39 | ||||
-rw-r--r-- | templates/revdep-snippet | 7 | ||||
-rw-r--r-- | templates/tatt_functions.sh | 57 | ||||
-rw-r--r-- | templates/use-header | 39 |
4 files changed, 69 insertions, 73 deletions
diff --git a/templates/revdep-header b/templates/revdep-header index 5d01821..5731d5d 100644 --- a/templates/revdep-header +++ b/templates/revdep-header @@ -3,40 +3,13 @@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM -function tatt_pkg_error -{ - local eout=${2} +export TATT_TEST_TYPE="rdep" +export TATT_REPORTFILE="@@REPORTFILE@@" +export TATT_BUILDLOGDIR="@@BUILDLOGDIR@@" +export TATT_EMERGEOPTS="@@EMERGEOPTS@@" - echo "${eout}" +source "@@TEMPLATEDIR@@tatt_functions.sh" - if [ -n "${USE}" ]; then - echo -n "USE='${USE}'" >> @@REPORTFILE@@ - fi - if [ -n "${FEATURES}" ]; then - echo -n " FEATURES='${FEATURES}'" >> @@REPORTFILE@@ - fi - - if [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ USE\ changes ]] ; then - echo " : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ keyword\ changes ]]; then - echo " : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then - echo " : circular dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Blocked\ Packages ]]; then - echo " : blocked packages (probably) for ${1:?}" >> @@REPORTFILE@@ - else - echo " failed for ${1:?}" >> @@REPORTFILE@@ - fi - - CP=${1#=} - BUILDLOG=/var/tmp/portage/${CP}/temp/build.log - if [[ -n "@@BUILDLOGDIR@@" && -s "${BUILDLOG}" ]]; then - LOGNAME=$(mktemp -p "@@BUILDLOGDIR@@" "${CP/\//_}_rdep_XXXXX") - mv "${BUILDLOG}" "${LOGNAME}" - echo " log has been saved as ${LOGNAME}" >> @@REPORTFILE@@ - fi -} +export USE echo -e "revdep tests started on $(date)\n" >> @@REPORTFILE@@ diff --git a/templates/revdep-snippet b/templates/revdep-snippet index 03fa511..72d7dd2 100644 --- a/templates/revdep-snippet +++ b/templates/revdep-snippet @@ -1,6 +1 @@ -eout=$( @@FEATURES@@ @@USE@@ emerge -1 @@EMERGEOPTS@@ @@CPV@@ 2>&1 1>/dev/tty ) -if [[ $? == 0 ]] ; then - echo "@@FEATURES@@ @@USE@@ succeeded for @@CPV@@" >> @@REPORTFILE@@ -else - @@USE@@ @@FEATURES@@ tatt_pkg_error "@@CPV@@" "${eout}" -fi +@@USE@@ T@@FEATURES@@ tatt_test_pkg "@@CPV@@" diff --git a/templates/tatt_functions.sh b/templates/tatt_functions.sh new file mode 100644 index 0000000..9aeed69 --- /dev/null +++ b/templates/tatt_functions.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +function tatt_pkg_error +{ + local eout=${2} + + echo "${eout}" + + if [ -n "${USE}" ]; then + echo -n "USE='${USE}'" >> "${TATT_REPORTFILE}" + fi + if [ -n "${FEATURES}" ]; then + echo -n " FEATURES='${FEATURES}'" >> "${TATT_REPORTFILE}" + fi + + if [[ "${eout}" =~ REQUIRED_USE ]] ; then + echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ USE\ changes ]] ; then + echo " : USE dependencies not satisfied (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ keyword\ changes ]]; then + echo " : unkeyworded dependencies (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then + echo " : circular dependencies (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ Blocked\ Packages ]]; then + echo " : blocked packages (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + else + echo " failed for ${1:?}" >> "${TATT_REPORTFILE}" + fi + + CP=${1#=} + BUILDLOG=/var/tmp/portage/${CP}/temp/build.log + if [[ -n "${TATT_BUILDLOGDIR}" && -s "${BUILDLOG}" ]]; then + LOGNAME=$(mktemp -p "${TATT_BUILDLOGDIR}" "${CP/\//_}_${TATT_TEST_TYPE}_XXXXX") + mv "${BUILDLOG}" "${LOGNAME}" + echo " log has been saved as ${LOGNAME}" >> "${TATT_REPORTFILE}" + fi +} + +function tatt_test_pkg +{ + if [ -n "${TFEATURES}" ]; then + if ! emerge --onlydeps -1 --with-test-deps ${TATT_EMERGEOPTS} "${1:?}"; then + echo "merging test dependencies of ${1} failed" >> "${TATT_REPORTFILE}" + return 0 + fi + fi + + eout=$( FEATURES="${TFEATURES}" emerge -1 ${TATT_EMERGEOPTS} "${1:?}" 2>&1 1>/dev/tty ) + if [[ $? == 0 ]] ; then + if [ -n "${TFEATURES}" ]; then + echo -n "FEATURES='${TFEATURES}' " >> "${TATT_REPORTFILE}" + fi + echo "USE='${USE}' succeeded for ${1:?}" >> "${TATT_REPORTFILE}" + else + FEATURES="${TFEATURES}" tatt_pkg_error "${1:?}" "${eout}" + fi +} diff --git a/templates/use-header b/templates/use-header index 4000a68..d18e080 100644 --- a/templates/use-header +++ b/templates/use-header @@ -3,40 +3,11 @@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM -function tatt_pkg_error -{ - local eout=${2} +export TATT_TEST_TYPE="use" +export TATT_REPORTFILE="@@REPORTFILE@@" +export TATT_BUILDLOGDIR="@@BUILDLOGDIR@@" +export TATT_EMERGEOPTS="@@EMERGEOPTS@@" - echo "${eout}" - - if [ -n "${USE}" ]; then - echo -n "USE='${USE}'" >> @@REPORTFILE@@ - fi - if [ -n "${FEATURES}" ]; then - echo -n " FEATURES='${FEATURES}'" >> @@REPORTFILE@@ - fi - - if [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ USE\ changes ]] ; then - echo " : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ keyword\ changes ]]; then - echo " : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then - echo " : circular dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Blocked\ Packages ]]; then - echo " : blocked packages (probably) for ${1:?}" >> @@REPORTFILE@@ - else - echo " failed for ${1:?}" >> @@REPORTFILE@@ - fi - - CP=${1#=} - BUILDLOG=/var/tmp/portage/${CP}/temp/build.log - if [[ -n "@@BUILDLOGDIR@@" && -s "${BUILDLOG}" ]]; then - LOGNAME=$(mktemp -p "@@BUILDLOGDIR@@" "${CP/\//_}_use_XXXXX") - mv "${BUILDLOG}" "${LOGNAME}" - echo " log has been saved as ${LOGNAME}" >> @@REPORTFILE@@ - fi -} +source "@@TEMPLATEDIR@@tatt_functions.sh" echo -e "USE tests started on $(date)\n" >> @@REPORTFILE@@ |