aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/14-jobs.t10
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/Makefile8
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/README1
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.SlackBuild20
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/nonexistentslackbuild.info10
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/timer1.touch0
-rw-r--r--t/LO-jobs2/nonexistentslackbuild/timer2.touch0
7 files changed, 47 insertions, 2 deletions
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
--- /dev/null
+++ b/t/LO-jobs2/nonexistentslackbuild/timer1.touch
diff --git a/t/LO-jobs2/nonexistentslackbuild/timer2.touch b/t/LO-jobs2/nonexistentslackbuild/timer2.touch
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/t/LO-jobs2/nonexistentslackbuild/timer2.touch