From 4fc0819d325310d28df5b07d0be7b02e5cbc3444 Mon Sep 17 00:00:00 2001 From: Jan Kurik Date: Jan 14 2021 17:54:33 +0000 Subject: Rework of js-d3-flame-graph gating test to use rpm-build --- diff --git a/tests/Sanity/upstream-testsuite/Makefile b/tests/Sanity/upstream-testsuite/Makefile index 9576b27..693d0d4 100644 --- a/tests/Sanity/upstream-testsuite/Makefile +++ b/tests/Sanity/upstream-testsuite/Makefile @@ -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) diff --git a/tests/Sanity/upstream-testsuite/main.fmf b/tests/Sanity/upstream-testsuite/main.fmf index 564b1f0..85d51d9 100644 --- a/tests/Sanity/upstream-testsuite/main.fmf +++ b/tests/Sanity/upstream-testsuite/main.fmf @@ -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 diff --git a/tests/Sanity/upstream-testsuite/runtest.sh b/tests/Sanity/upstream-testsuite/runtest.sh index c1b5d16..43b132d 100755 --- a/tests/Sanity/upstream-testsuite/runtest.sh +++ b/tests/Sanity/upstream-testsuite/runtest.sh @@ -38,27 +38,30 @@ 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" rlFileRestore