aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-31 00:26:15 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-31 00:26:15 +0200
commit1487aaecb1db46315bd267854f71de985caafda7 (patch)
treeaab6662c04257b353031135fec59c7f57ffb4a60
parente58c649c2a37dd24399a01b5469ad17b30853081 (diff)
downloadsbotools2-1487aaecb1db46315bd267854f71de985caafda7.tar.xz
02.2-unit-repo.t: add test for get_sbo_downloads for 32bit
-rwxr-xr-xt/02.2-unit-repo.t15
-rw-r--r--t/02.2-unit-repo/test/test2/README1
-rw-r--r--t/02.2-unit-repo/test/test2/test2.SlackBuild15
-rw-r--r--t/02.2-unit-repo/test/test2/test2.info10
4 files changed, 39 insertions, 2 deletions
diff --git a/t/02.2-unit-repo.t b/t/02.2-unit-repo.t
index 5f28f32..e06fc82 100755
--- a/t/02.2-unit-repo.t
+++ b/t/02.2-unit-repo.t
@@ -6,12 +6,12 @@ use Test::More;
use Test::Exit;
use FindBin '$RealBin';
use lib "$RealBin/../SBO-Lib/lib";
-use SBO::Lib qw/ do_slackbuild rsync_sbo_tree /;
+use SBO::Lib qw/ do_slackbuild rsync_sbo_tree get_sbo_downloads /;
use Capture::Tiny qw/ capture_merged /;
use File::Path qw/ remove_tree /;
if (defined $ENV{TRAVIS} and $ENV{TRAVIS} eq 'true') {
- plan tests => 12;
+ plan tests => 13;
} else {
plan skip_all => 'Only run these tests under Travis CI (TRAVIS=true)';
}
@@ -99,5 +99,16 @@ SKIP: {
is_deeply (\@ret, ["sentinel", undef, undef, -1], "do_slackbuild() returned the correct things when it's on 32bit.");
}
+# 13: test get_sbo_downloads() which thinks it's on 32bit
+{
+ no warnings 'redefine';
+ local *SBO::Lib::Download::get_arch = sub { return 'i586' };
+
+ my $ret = get_sbo_downloads(LOCATION => "/usr/sbo/repo/test/test2");
+
+ ok (exists $ret->{'http://pink-mist.github.io/sbotools/testing/32/perf.dummy'}, "get_sbo_downloads() returned the correct link for 32bit.")
+ or diag explain $ret;
+}
+
remove_tree($repo);
rename "$repo.orig", $repo if $moved;
diff --git a/t/02.2-unit-repo/test/test2/README b/t/02.2-unit-repo/test/test2/README
new file mode 100644
index 0000000..6d388bb
--- /dev/null
+++ b/t/02.2-unit-repo/test/test2/README
@@ -0,0 +1 @@
+This doesn't exist!
diff --git a/t/02.2-unit-repo/test/test2/test2.SlackBuild b/t/02.2-unit-repo/test/test2/test2.SlackBuild
new file mode 100644
index 0000000..f601f6a
--- /dev/null
+++ b/t/02.2-unit-repo/test/test2/test2.SlackBuild
@@ -0,0 +1,15 @@
+#!/bin/bash
+PRGNAM="test2"
+VERSION=${VERSION:-1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+TMP=${TMP:-/tmp/SBo}
+OUTPUT=${OUTPUT:-/tmp}
+
+mkdir -p $TMP/$PRGNAM-$VERSION
+cp README $TMP/$PRGNAM-$VERSION
+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/02.2-unit-repo/test/test2/test2.info b/t/02.2-unit-repo/test/test2/test2.info
new file mode 100644
index 0000000..5065a73
--- /dev/null
+++ b/t/02.2-unit-repo/test/test2/test2.info
@@ -0,0 +1,10 @@
+PRGNAM="test2"
+VERSION="1.0"
+HOMEPAGE="http://www.example.com"
+DOWNLOAD="http://pink-mist.github.io/sbotools/testing/32/perf.dummy"
+MD5SUM="9cba6c70fb57a22a155073d54748b614"
+DOWNLOAD_x86_64="http://pink-mist.github.io/sbotools/testing/64/perf.dummy"
+MD5SUM_x86_64="9cba6c70fb57a22a155073d54748b614"
+REQUIRES=""
+MAINTAINER="Andreas Guldstrand"
+EMAIL="doesnt@matter.org"