From 623ebe7962412958787e5cb1982b72289bdae649 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Wed, 13 Jul 2016 17:20:22 +0200 Subject: 14-jobs.t: add test for sboupgrade -j 2 --- t/14-jobs.t | 10 ++++++++-- t/LO-jobs2/nonexistentslackbuild/Makefile | 8 ++++++++ t/LO-jobs2/nonexistentslackbuild/README | 1 + .../nonexistentslackbuild.SlackBuild | 20 ++++++++++++++++++++ .../nonexistentslackbuild/nonexistentslackbuild.info | 10 ++++++++++ t/LO-jobs2/nonexistentslackbuild/timer1.touch | 0 t/LO-jobs2/nonexistentslackbuild/timer2.touch | 0 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 t/LO-jobs2/nonexistentslackbuild/Makefile create mode 100644 t/LO-jobs2/nonexistentslackbuild/README create mode 100644 t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild create mode 100644 t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.info create mode 100644 t/LO-jobs2/nonexistentslackbuild/timer1.touch create mode 100644 t/LO-jobs2/nonexistentslackbuild/timer2.touch diff --git a/t/14-jobs.t b/t/14-jobs.t index 1b82c53..2a9f03c 100755 --- a/t/14-jobs.t +++ b/t/14-jobs.t @@ -10,7 +10,7 @@ use lib $RealBin; use Test::Sbotools qw/ set_lo set_jobs sboinstall sboremove sboconfig restore_perf_dummy make_slackbuilds_txt sboupgrade /; if ($ENV{TEST_INSTALL}) { - plan tests => 7; + plan tests => 8; } else { plan skip_all => "Only run these tests if TEST_INSTALL=1"; } @@ -73,9 +73,15 @@ sboinstall(qw/ -j invalid nonexistentslackbuild /, { exit => 1, expected => "You #7: sboupgrade -j invalid sboinstall qw/ -r nonexistentslackbuild /, { test => 0 }; -set_lo "$RealBin/LO2"; +set_lo "$RealBin/LO-jobs2"; sboupgrade qw/ -j invalid nonexistentslackbuild /, { exit => 1, expected => "You have provided an invalid value for -j|--jobs\n" }; +#8: sboupgrade -j 2 +{ + my ($time) = sboupgrade qw/ -j 2 nonexistentslackbuild /, { input => "y\ny", expected => qr/^real\s+\d+m([\d.]+)s$/m, test => 0 }; + ok ($time < 5, "sboupgrade -j 2 took less time than otherwise"); +} + # Cleanup END { diff --git a/t/LO-jobs2/nonexistentslackbuild/Makefile b/t/LO-jobs2/nonexistentslackbuild/Makefile new file mode 100644 index 0000000..ab04c6c --- /dev/null +++ b/t/LO-jobs2/nonexistentslackbuild/Makefile @@ -0,0 +1,8 @@ +timers: timer1 timer2 + rm timer1 timer2 + +timer1: timer1.touch + sleep 3 && touch timer1 + +timer2: timer2.touch + sleep 3 && touch timer2 diff --git a/t/LO-jobs2/nonexistentslackbuild/README b/t/LO-jobs2/nonexistentslackbuild/README new file mode 100644 index 0000000..6d388bb --- /dev/null +++ b/t/LO-jobs2/nonexistentslackbuild/README @@ -0,0 +1 @@ +This doesn't exist! diff --git a/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild b/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild new file mode 100644 index 0000000..d1bf76c --- /dev/null +++ b/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild @@ -0,0 +1,20 @@ +#!/bin/bash +PRGNAM="nonexistentslackbuild" +VERSION=${VERSION:-1.1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +TMP=${TMP:-/tmp/SBo} +OUTPUT=${OUTPUT:-/tmp} + +mkdir -p $TMP/$PRGNAM-$VERSION +cp README Makefile timer1.touch timer2.touch $TMP/$PRGNAM-$VERSION +cd $TMP/$PRGNAM-$VERSION + +time \ +make + +mkdir -p $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION +cp README $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION +cd $OUTPUT/package-$PRGNAM + +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.tgz diff --git a/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.info b/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.info new file mode 100644 index 0000000..4b04e13 --- /dev/null +++ b/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.info @@ -0,0 +1,10 @@ +PRGNAM="nonexistentslackbuild" +VERSION="1.1" +HOMEPAGE="http://www.example.com" +DOWNLOAD="http://pink-mist.github.io/sbotools/testing/perf.dummy" +MD5SUM="9cba6c70fb57a22a155073d54748b614" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Andreas Guldstrand" +EMAIL="doesnt@matter.org" diff --git a/t/LO-jobs2/nonexistentslackbuild/timer1.touch b/t/LO-jobs2/nonexistentslackbuild/timer1.touch new file mode 100644 index 0000000..e69de29 diff --git a/t/LO-jobs2/nonexistentslackbuild/timer2.touch b/t/LO-jobs2/nonexistentslackbuild/timer2.touch new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3