commit 623ebe7962412958787e5cb1982b72289bdae649
parent 966d17fe70d85be62edb331e7f40bf9b896b3fc8
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date: Wed, 13 Jul 2016 17:20:22 +0200
14-jobs.t: add test for sboupgrade -j 2
Diffstat:
7 files changed, 47 insertions(+), 2 deletions(-)
diff --git 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
@@ -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
@@ -0,0 +1 @@
+This doesn't exist!
diff --git a/t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild 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
@@ -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
diff --git a/t/LO-jobs2/nonexistentslackbuild/timer2.touch b/t/LO-jobs2/nonexistentslackbuild/timer2.touch