Rework of js-d3-flame-graph gating test to use rpm-build

This commit is contained in:
Jan Kurik 2021-01-14 18:54:33 +01:00
parent 985c71854f
commit 4fc0819d32
3 changed files with 21 additions and 15 deletions

View File

@ -54,6 +54,7 @@ $(METADATA): Makefile
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: js-d3-flame-graph" >> $(METADATA)
@echo "Requires: js-d3-flame-graph nodejs" >> $(METADATA)
@echo "Requires: make rpm-build" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)

View File

@ -9,6 +9,8 @@ framework: beakerlib
recommend:
- js-d3-flame-graph
- nodejs
- make
- rpm-build
duration: 15m
extra-summary: /tools/js-d3-flame-graph/Sanity/upstream-testsuite
extra-task: /tools/js-d3-flame-graph/Sanity/upstream-testsuite

View File

@ -38,26 +38,29 @@ rlJournalStart
rlRun "rm -rf /root/.npm"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd ${TmpDir}"
RPM="$(rpm -q --qf '%{name}-%{version}-%{release}' ${PACKAGE})"
VERSION="$(rpm -q --qf '%{version}' ${PACKAGE})"
rlRpmDownload --source "${RPM}"
rlAssertExists "${RPM}.src.rpm" ||\
rlDie "Can not recover from the previous error"
rlRun "rpm -i --root ${TmpDir} ${RPM}.src.rpm"
rlRun "pushd root/rpmbuild/SOURCES/"
rlLog "ls -l"
rlRun "tar zxf d3-flame-graph-${VERSION}.tar.gz"
rlRun "pushd d3-flame-graph-${VERSION}"
rlRun "tar Jxf ../d3-flame-graph-deps-${VERSION}.tar.xz"
rlPhaseEnd
rlPhaseStartTest
rlRun "npm run test"
rlPhaseStartTest "Prepare ${PACKAGE} for testing"
rlFetchSrcForInstalled "${PACKAGE}" \
|| rlDie "Can not download SRPM of ${PACKAGE} - giving up"
rlRun "rpm -D \"_topdir ${TmpDir}\" -U \
$(rpm -q --qf '%{name}-%{version}-%{release}.src.rpm' ${PACKAGE}.noarch)"
rlRun "rpmbuild --nodeps -D \"_topdir ${TmpDir}\" \
-bp ${TmpDir}/SPECS/${PACKAGE}.spec"
rlPhaseEnd
rlPhaseStartTest "Run the upstream testsuite"
BDIR=$(rpm -q --qf '%{name}-%{version}' ${PACKAGE}.noarch)
P=$(sed 's/^js-//' <<< "${BDIR}")
if rlRun "pushd ${TmpDir}/BUILD/${P}/test"; then
rlRun "npm run test"
rlRun "popd"
else
rlFail "Can not find the working directory of the upstream testsuite"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "popd"
rlRun "popd"
rlRun "rm -rf ${TmpDir}" 0 "Removing tmp directory"
rlRun "rm -rf /root/.npm"