From c17d9f591918db35ea6974335cb0cbd062a81fa1 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 21:47:33 -0500 Subject: change sbo_home back to default since no longer developing against sbo git repo --- t/test.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 97b15cc..72d7d14 100755 --- a/t/test.t +++ b/t/test.t @@ -10,7 +10,7 @@ use Text::Diff; use lib "."; use SBO::Lib; -my $sbo_home = '/home/d4wnr4z0r/sbo.git/slackbuilds'; +my $sbo_home = '/usr/sbo'; # 1, open_read, open_fh tests my $fh = open_read ('./test.t'); -- cgit v1.2.3 From 64fe43f714525ee054e33bc8ff6ac51d539931ab Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 21:51:51 -0500 Subject: zdoom version 2.5.0 -> 2.6.0 --- t/test.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 72d7d14..f2b7463 100755 --- a/t/test.t +++ b/t/test.t @@ -58,7 +58,7 @@ for my $key (keys @$installed) { 'libmodplug'; is ($$installed[$key]{version}, '3.12.4') if $$installed[$key]{name} eq 'mozilla-nss'; - is ($$installed[$key]{version}, '2.5.0') if $$installed[$key]{name} eq + is ($$installed[$key]{version}, '2.6.0') if $$installed[$key]{name} eq 'zdoom'; } print "completed pseudo-random testing of get_installed_sbos \n"; -- cgit v1.2.3 From d1c0abdd300e1006cd9c07704095ac2c05911474 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:02:45 -0500 Subject: comment out no-longer-valid circular requirement test --- t/test.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index f2b7463..14c6503 100755 --- a/t/test.t +++ b/t/test.t @@ -301,8 +301,9 @@ ok ('zdoom' ~~ @$inst_names, 'get_inst_names is good'); # 76-81, get_reqs tests $SBO::Lib::no_reqs = 0; -ok (! (get_requires 'zarafa', "$sbo_home/network/zarafa"), - 'get_requires good for circular requirements'); +# no longer valid - there are no longer any circular requirements. +#ok (! (get_requires 'zarafa', "$sbo_home/network/zarafa"), +# 'get_requires good for circular requirements'); ok (! (get_requires 'smc', "$sbo_home/games/smc"), 'get_requires good for REQUIRES="%README%"'); ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), -- cgit v1.2.3 From ce77b5798ecea670c2bb58aff40a1d709bf33a0d Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:09:19 -0500 Subject: reinstate clean_reqs test for installed reqs, set compat32 = 0 beforehand, use zdoom instead of wine --- t/test.t | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 14c6503..86470cf 100755 --- a/t/test.t +++ b/t/test.t @@ -342,11 +342,10 @@ close $fh; ok (! (get_opts $readme), 'get_opts good where README does not define opts'); # 88-90, clean_reqs tests -#$reqs = get_requires "wine", "$sbo_home/system/wine"; -#$reqs = clean_reqs $reqs; -#print $_,"\n" for @$reqs; -#ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); $SBO::Lib::compat32 = 0; +$reqs = get_requires "zdoom", "$sbo_home/games/zdoom"; +$reqs = clean_reqs $reqs; +ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); $reqs = get_requires 'gmpc', "$sbo_home/audio/gmpc"; $reqs = clean_reqs $reqs; ok ($$reqs[0] eq 'gob2', 'clean_reqs good for un/installed reqs.'); -- cgit v1.2.3 From cb042eb7a7dcca1fa46859af29a6544cf76294fd Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:14:10 -0500 Subject: tests for get_build_queue --- t/test.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 86470cf..8617fe7 100755 --- a/t/test.t +++ b/t/test.t @@ -351,3 +351,11 @@ $reqs = clean_reqs $reqs; ok ($$reqs[0] eq 'gob2', 'clean_reqs good for un/installed reqs.'); ok ($$reqs[1] eq 'libmpd', 'clean_reqs good for un/installed reqs.'); +my %warnings; +my $queue = get_build_queue 'zdoom', \%warnings; +my $count = @$queue; +ok ($count == 5, 'get_build_queue returns correct amount of sbos'); +ok ($$queue[0] eq 'p7zip', 'get_build_queue first entry correct'); +ok ($$queue[1] eq 'fmodapi', 'get_build_queue second entry correct'); +ok ($$queue[4] eq 'zdoom', 'get_build_queue last entry correct'); + -- cgit v1.2.3 From 8f208049f7d28c03ac64a9a0246a75767b03e065 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:56:53 -0500 Subject: extend get_build_queue test for three sbos at once --- t/test.t | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 8617fe7..fcc0171 100755 --- a/t/test.t +++ b/t/test.t @@ -351,11 +351,14 @@ $reqs = clean_reqs $reqs; ok ($$reqs[0] eq 'gob2', 'clean_reqs good for un/installed reqs.'); ok ($$reqs[1] eq 'libmpd', 'clean_reqs good for un/installed reqs.'); -my %warnings; -my $queue = get_build_queue 'zdoom', \%warnings; +my $warnings = {()};; +my $queue = get_build_queue ['zdoom', 'bsnes', 'spring'], $warnings; my $count = @$queue; -ok ($count == 5, 'get_build_queue returns correct amount of sbos'); -ok ($$queue[0] eq 'p7zip', 'get_build_queue first entry correct'); -ok ($$queue[1] eq 'fmodapi', 'get_build_queue second entry correct'); -ok ($$queue[4] eq 'zdoom', 'get_build_queue last entry correct'); +ok ($count == 10, 'get_build_queue returns correct amount of sbos'); +ok ($$queue[0] eq 'jdk', 'get_build_queue first entry correct'); +ok ($$queue[2] eq 'OpenAL', 'get_build_queue third entry correct'); +ok ($$queue[4] eq 'spring', 'get_build_queue fifth entry correct'); +ok ($$queue[6] eq 'fmodapi', 'get_build_queue seventh entry correct'); +ok ($$queue[8] eq 'TiMidity++', 'get_build_queue ninth entry correct'); + -- cgit v1.2.3 From 106895a334244fc0e63c71305410a8d21a4447f3 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 23:17:07 -0500 Subject: more test for get_build_queue --- t/test.t | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index fcc0171..3ddbe06 100755 --- a/t/test.t +++ b/t/test.t @@ -354,11 +354,15 @@ ok ($$reqs[1] eq 'libmpd', 'clean_reqs good for un/installed reqs.'); my $warnings = {()};; my $queue = get_build_queue ['zdoom', 'bsnes', 'spring'], $warnings; my $count = @$queue; -ok ($count == 10, 'get_build_queue returns correct amount of sbos'); -ok ($$queue[0] eq 'jdk', 'get_build_queue first entry correct'); -ok ($$queue[2] eq 'OpenAL', 'get_build_queue third entry correct'); -ok ($$queue[4] eq 'spring', 'get_build_queue fifth entry correct'); -ok ($$queue[6] eq 'fmodapi', 'get_build_queue seventh entry correct'); -ok ($$queue[8] eq 'TiMidity++', 'get_build_queue ninth entry correct'); - - +ok ($count == 10, 'get_build_queue returns correct amount for multiple sbos'); +ok ($$queue[0] eq 'jdk', 'get_build_queue first entry correct for multiple sbos'); +ok ($$queue[2] eq 'OpenAL', 'get_build_queue third entry correct for multiple sbos'); +ok ($$queue[4] eq 'spring', 'get_build_queue fifth entry correct for multiple sbos'); +ok ($$queue[6] eq 'fmodapi', 'get_build_queue seventh entry correct for multiple sbos'); +ok ($$queue[8] eq 'TiMidity++', 'get_build_queue ninth entry correct for multiple sbos'); +$queue = get_build_queue ['zdoom'], $warnings, 1; +$count = @$queue; +ok ($count == 5, 'get_build_queue returns correct amount for single sbo'); +ok ($$queue[0] eq 'p7zip', 'get_build_queue first entry correct for single sbo'); +ok ($$queue[2] eq 'eawpats', 'get_build_queue third entry correct for single sbo'); +ok ($$queue[4] eq 'zdoom', 'get_build_queue fifth entry correct for single sbo'); -- cgit v1.2.3 From 66a19217ed6b778fbfba9d95ae2d5ceab5775f9f Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 23:22:42 -0500 Subject: dont try to empty queue since that no longer applies --- t/test.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 3ddbe06..8ff06f8 100755 --- a/t/test.t +++ b/t/test.t @@ -360,7 +360,7 @@ ok ($$queue[2] eq 'OpenAL', 'get_build_queue third entry correct for multiple sb ok ($$queue[4] eq 'spring', 'get_build_queue fifth entry correct for multiple sbos'); ok ($$queue[6] eq 'fmodapi', 'get_build_queue seventh entry correct for multiple sbos'); ok ($$queue[8] eq 'TiMidity++', 'get_build_queue ninth entry correct for multiple sbos'); -$queue = get_build_queue ['zdoom'], $warnings, 1; +$queue = get_build_queue ['zdoom'], $warnings; $count = @$queue; ok ($count == 5, 'get_build_queue returns correct amount for single sbo'); ok ($$queue[0] eq 'p7zip', 'get_build_queue first entry correct for single sbo'); -- cgit v1.2.3 From 32a918f88842deab5fedaa7671d5c343faacd26c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:23:22 -0600 Subject: fixes for changes to get_sbo_location --- t/test.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 8ff06f8..972602c 100755 --- a/t/test.t +++ b/t/test.t @@ -64,9 +64,9 @@ for my $key (keys @$installed) { print "completed pseudo-random testing of get_installed_sbos \n"; # 19-20, get_sbo_location tests -is (get_sbo_location 'nginx', "$sbo_home/network/nginx", +is (get_sbo_location ('nginx'), "$sbo_home/network/nginx", 'get_sbo_location is good'); -is (get_sbo_location 'omgwtfbbq', undef, +is (get_sbo_location ('omgwtfbbq'), undef, 'get_sbo_location returns false with not-an-sbo input'); # 21-22, get_available_updates tests -- cgit v1.2.3 From c32526202bb0870e1c9fc2402f303f695777eec1 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:30:38 -0600 Subject: fix to support changes in rewrite_slackbuild --- t/test.t | 12 ------------ 1 file changed, 12 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 972602c..f556643 100755 --- a/t/test.t +++ b/t/test.t @@ -226,18 +226,6 @@ $expected_out = "55c55 < LIBDIRSUFFIX=\"64\" --- > LIBDIRSUFFIX=\"\" -67c67 -< tar xvf \$CWD/\$PRGNAM-\$VERSION.tar.bz2 ---- -> tar xvf \$CWD/\$PRGNAM-\$VERSION.tar.bz2 | tee -a $tempfn -87c87 -< make ---- -> make -j 5 -103c103 -< /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-\$ARCH-\$BUILD\$TAG.\${PKGTYPE:-tgz} ---- -> /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-i486-\$BUILD\$TAG.\${PKGTYPE:-tgz} | tee -a $tempfn "; is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), $expected_out, 'all changed lines rewritten correctly'); -- cgit v1.2.3 From a7657a05aa4bd3fa649cbcf557b772fb6cf71e00 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:34:55 -0600 Subject: more fixes for changes in rewrite_slackbuild --- t/test.t | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index f556643..b224e47 100755 --- a/t/test.t +++ b/t/test.t @@ -204,17 +204,6 @@ my %changes = (); is (rewrite_slackbuild (SLACKBUILD => $slackbuild, TEMPFN => $tempfn, CHANGES => \%changes), 1, 'rewrite_slackbuild with no %changes good'); ok (-f "$slackbuild.orig", 'rewrite_slackbuild backing up original is good.'); -my $expected_out = "67c67 -< tar xvf \$CWD/\$PRGNAM-\$VERSION.tar.bz2 ---- -> tar xvf \$CWD/\$PRGNAM-\$VERSION.tar.bz2 | tee -a $tempfn -103c103 -< /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-\$ARCH-\$BUILD\$TAG.\${PKGTYPE:-tgz} ---- -> /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-\$ARCH-\$BUILD\$TAG.\${PKGTYPE:-tgz} | tee -a $tempfn -"; -is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), - $expected_out, 'tar line rewritten correctly'); is (revert_slackbuild $slackbuild, 1, 'revert_slackbuild is good'); $changes{libdirsuffix} = ''; $changes{make} = '-j 5'; @@ -222,10 +211,14 @@ $changes{arch_out} = 'i486'; is (rewrite_slackbuild (SLACKBUILD => $slackbuild, TEMPFN => $tempfn, CHANGES => \%changes), 1, 'rewrite_slackbuild with all %changes good'); ok (-f "$slackbuild.orig", 'rewrite_slackbuild backing up original is good.'); -$expected_out = "55c55 +my $expected_out = "55c55 < LIBDIRSUFFIX=\"64\" --- > LIBDIRSUFFIX=\"\" +103c103 +< /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-\$ARCH-\$BUILD\$TAG.\${PKGTYPE:-tgz} +--- +> /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-i486-\$BUILD\$TAG.\${PKGTYPE:-tgz} "; is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), $expected_out, 'all changed lines rewritten correctly'); -- cgit v1.2.3 From 9731880d4c536ed0d5d4d5df15caf2912ede85cf Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:50:57 -0600 Subject: re-order get_requires tests --- t/test.t | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index b224e47..92dc410 100755 --- a/t/test.t +++ b/t/test.t @@ -285,16 +285,15 @@ $SBO::Lib::no_reqs = 0; # no longer valid - there are no longer any circular requirements. #ok (! (get_requires 'zarafa', "$sbo_home/network/zarafa"), # 'get_requires good for circular requirements'); -ok (! (get_requires 'smc', "$sbo_home/games/smc"), - 'get_requires good for REQUIRES="%README%"'); -ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), - 'get_requires good for REQUIRES=""'); -my $reqs = get_requires 'matchbox-desktop', - "$sbo_home/audio/gmpc"; +my $reqs = get_requires 'gmpc', "$sbo_home/audio/gmpc"; my $say = 'get_requires good for normal req list'; is ($$reqs[0], 'gob2', $say); is ($$reqs[1], 'libmpd', $say); is ($$reqs[2], 'vala', $say); +ok (! (get_requires 'smc', "$sbo_home/games/smc"), + 'get_requires good for REQUIRES="%README%"'); +ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), + 'get_requires good for REQUIRES=""'); # 82-85, get_user_group tests $fh = open_read "$sbo_home/network/nagios/README"; -- cgit v1.2.3 From 9d47b96f516e9418edf2ed2db39c56faff62fd02 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 11:02:10 -0600 Subject: tests added for new get_sbo_location capabilities (all fail) --- t/test.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 92dc410..d3e2017 100755 --- a/t/test.t +++ b/t/test.t @@ -63,11 +63,21 @@ for my $key (keys @$installed) { } print "completed pseudo-random testing of get_installed_sbos \n"; -# 19-20, get_sbo_location tests +# get_sbo_location tests is (get_sbo_location ('nginx'), "$sbo_home/network/nginx", 'get_sbo_location is good'); is (get_sbo_location ('omgwtfbbq'), undef, 'get_sbo_location returns false with not-an-sbo input'); +my @finds = qw(nginx gmpc); +my @locs = get_sbo_location (@finds); +is ($locs[0], "$sbo_home/network/nginx", + 'get_sbo_location passed array #1 good'); +is ($locs[1], "$sbo_home/audio/gmpc", 'get_sbo_location passed array #2 good'); +@locs = get_sbo_location (\@finds); +is ($locs[0], "$sbo_home/network/nginx", + 'get_sbo_location passed array ref #1 good'); +is ($locs[1], "$sbo_home/audio/gmpc", + 'get_sbo_location passed array ref #2 good'); # 21-22, get_available_updates tests my $updates = get_available_updates; -- cgit v1.2.3 From 3e13816918e42d1a2946f2bd2b6f9b93e865eb16 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 11:06:40 -0600 Subject: fix so that new get_sbo_location tests are actually done correctly - fixes two of the four --- t/test.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index d3e2017..c52669d 100755 --- a/t/test.t +++ b/t/test.t @@ -69,14 +69,14 @@ is (get_sbo_location ('nginx'), "$sbo_home/network/nginx", is (get_sbo_location ('omgwtfbbq'), undef, 'get_sbo_location returns false with not-an-sbo input'); my @finds = qw(nginx gmpc); -my @locs = get_sbo_location (@finds); -is ($locs[0], "$sbo_home/network/nginx", +my %locs = get_sbo_location (@finds); +is ($locs{nginx}, "$sbo_home/network/nginx", 'get_sbo_location passed array #1 good'); -is ($locs[1], "$sbo_home/audio/gmpc", 'get_sbo_location passed array #2 good'); -@locs = get_sbo_location (\@finds); -is ($locs[0], "$sbo_home/network/nginx", +is ($locs{gmpc}, "$sbo_home/audio/gmpc", 'get_sbo_location passed array #2 good'); +%locs = get_sbo_location (\@finds); +is ($locs{nginx}, "$sbo_home/network/nginx", 'get_sbo_location passed array ref #1 good'); -is ($locs[1], "$sbo_home/audio/gmpc", +is ($locs{gmpc}, "$sbo_home/audio/gmpc", 'get_sbo_location passed array ref #2 good'); # 21-22, get_available_updates tests -- cgit v1.2.3 From fcfc0827c11403f92657e0f279d17646cef213ed Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 12:54:55 -0600 Subject: remove compare_md5s tests --- t/test.t | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index c52669d..1c73822 100755 --- a/t/test.t +++ b/t/test.t @@ -168,11 +168,11 @@ is (get_src_dir $tempfh, 'laptop-mode-tools_1.60', 'get_src_dir good'); is (get_pkg_name $tempfh, 'skype-2.2.0.35-i486-1_SBo.tgz', 'get_pkg_name good'); close $tempfh; -# 42, check_distfiles test +# check_distfiles test %downloads = get_sbo_downloads (LOCATION => "$sbo_home/system/wine", 32 => 1); is ((check_distfiles %downloads), 1, 'check_distfiles good'); -# 43-45, check_home tests +# check_home tests system ('sudo /usr/sbin/sboconfig -s /home/d4wnr4z0r/opt_sbo') == 0 or die "unable to set sboconfig -s\n"; read_config; @@ -184,19 +184,13 @@ system ("sudo /usr/sbin/sboconfig -s $sbo_home") == 0 or die read_config; rmdir "/home/d4wnr4z0r/opt_sbo"; -# 46-47 get_sbo_from_loc tests +# get_sbo_from_loc tests is (get_sbo_from_loc '/home/d4wnr4z0r/sbo.git/system/ifuse', 'ifuse', 'get_sbo_from_loc returns correctly with valid input'); ok (! get_sbo_from_loc 'omg_wtf_bbq', 'get_sbo_from_loc returns false with invalid input'); -# 48-49, compare_md5s tests -is (compare_md5s ('omgwtf123456789', 'omgwtf123456789'), 1, - 'compare_md5s returns true for matching parameters'); -is (compare_md5s ('omgwtf123456788', 'somethingelsebbq'), undef, - 'compare_md5s returns false for not-matching parameters'); - -# 50, get_distfile tests +# get_distfile tests my $distfile = "$sbo_home/distfiles/Sort-Versions-1.5.tar.gz"; unlink $distfile if -f $distfile; is (get_distfile @@ -204,7 +198,7 @@ is (get_distfile '5434f948fdea6406851c77bebbd0ed19'), 1, 'get_distfile is good'); unlink $distfile; -# 51-58, rewrite_slackbuilds/revert_slackbuild tests +# rewrite_slackbuilds/revert_slackbuild tests my $rewrite_dir = tempdir (CLEANUP => 1); copy ("$sbo_home/system/ifuse/ifuse.SlackBuild", $rewrite_dir); my $slackbuild = "$rewrite_dir/ifuse.SlackBuild"; -- cgit v1.2.3 From 5b00d84752b3d3ad32933afcf6a2a84461fb13af Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 13:44:03 -0600 Subject: stop pretending its feasible to keep track of the number of tests, prefer is to ok wherever possible --- t/test.t | 90 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 47 insertions(+), 43 deletions(-) (limited to 't/test.t') diff --git a/t/test.t b/t/test.t index 1c73822..4170ef0 100755 --- a/t/test.t +++ b/t/test.t @@ -4,7 +4,7 @@ use 5.16.0; use strict; use warnings FATAL => 'all'; use File::Temp qw(tempdir tempfile); -use Test::More tests => 90; +use Test::More; use File::Copy; use Text::Diff; use lib "."; @@ -12,12 +12,12 @@ use SBO::Lib; my $sbo_home = '/usr/sbo'; -# 1, open_read, open_fh tests +# open_read, open_fh tests my $fh = open_read ('./test.t'); is (ref $fh, 'GLOB', 'open_read works'); close $fh; -# 2-7, config settings tests; +# config settings tests; ok (defined $SBO::Lib::tempdir, '$tempdir is defined'); is ($SBO::Lib::config{DISTCLEAN}, 'FALSE', 'config{DISTCLEAN} is good'); is ($SBO::Lib::config{JOBS}, 2, 'config{JOBS} is good'); @@ -25,13 +25,13 @@ is ($SBO::Lib::config{NOCLEAN}, 'FALSE', 'config{NOCLEAN} is good'); is ($SBO::Lib::config{PKG_DIR}, 'FALSE', 'config{PKG_DIR} is good'); is ($SBO::Lib::config{SBO_HOME}, "$sbo_home", 'config{SBO_HOME} is good'); -# 8, show_version test +# show_version test is (show_version, 1, 'show_version is good'); -# 9, get_slack_version test +# get_slack_version test is (get_slack_version, '14.0', 'get_slack_version is good'); -# 10-11, chk_slackbuilds_txt tests +# chk_slackbuilds_txt tests is (chk_slackbuilds_txt, 1, 'chk_slackbuilds_txt is good'); move ("$sbo_home/SLACKBUILDS.TXT", "$sbo_home/SLACKBUILDS.TXT.moved"); is (chk_slackbuilds_txt, undef, @@ -41,10 +41,10 @@ move ("$sbo_home/SLACKBUILDS.TXT.moved", "$sbo_home/SLACKBUILDS.TXT"); #ok (rsync_sbo_tree == 1, 'rsync_sbo_tree is good'); #ok (update_tree == 1, 'update_tree is good'); -# 12, slackbuilds_or_fetch test +# slackbuilds_or_fetch test is (slackbuilds_or_fetch, 1, 'slackbuilds_or_fetch is good'); -# 13-18, get_installed_sbos test +# get_installed_sbos test print "pseudo-random sampling of get_installed_sbos output...\n"; my $installed = get_installed_sbos; for my $key (keys @$installed) { @@ -79,7 +79,7 @@ is ($locs{nginx}, "$sbo_home/network/nginx", is ($locs{gmpc}, "$sbo_home/audio/gmpc", 'get_sbo_location passed array ref #2 good'); -# 21-22, get_available_updates tests +# get_available_updates tests my $updates = get_available_updates; for my $key (keys @$updates) { is ($$updates[$key]{installed}, '1.15', @@ -90,10 +90,10 @@ for my $key (keys @$updates) { 'mutagen'; } -# 23, get_arch test +# get_arch test is (get_arch, 'x86_64', 'get_arch is good'); -# 24-25, get_download_info tests +# get_download_info tests my %dl_info = get_download_info (LOCATION => "$sbo_home/system/wine", X64 => 0); my $link = 'http://downloads.sf.net/wine/source/1.4/wine-1.4.1.tar.bz2'; is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', @@ -102,7 +102,7 @@ $link = 'http://www.unrealize.co.uk/source/dibeng-max-2010-11-12.zip'; is ($dl_info{$link}, '97159d77631da13952fe87e846cf1f3b', 'get_download_info test 02 good.'); -# 26-28, get_sbo_downloads tests +# get_sbo_downloads tests %dl_info = get_sbo_downloads (LOCATION => "$sbo_home/system/wine"); $link = 'http://downloads.sf.net/wine/source/1.4/wine-1.4.1.tar.bz2'; is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', @@ -115,40 +115,40 @@ $link = 'http://www.libimobiledevice.org/downloads/ifuse-1.1.1.tar.bz2'; is ($downloads{$link}, '8d528a79de024b91f12f8ac67965c37c', 'get_sbo_downloads test 03 good.'); -# 29, get_filename_from_link test +# get_filename_from_link test is (get_filename_from_link 'http://www.libimobiledevice.org/downloads/ifuse-1.1.1.tar.bz2', "$sbo_home/distfiles/ifuse-1.1.1.tar.bz2", 'get_file_from_link good'); is (get_filename_from_link 'adf;lkajsdfaksjdfalsdjfalsdkfjdsfj', undef, 'get_filename_from_link good with invalid input'); -# 31, compute_md5sum test +# compute_md5sum test is (compute_md5sum "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", '6685af5dbb34c3d51ca27933b58f484e', 'compute_md5sum good'); -# 32, verify_distfile test +# verify_distfile test is ((verify_distfile "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", '6685af5dbb34c3d51ca27933b58f484e'), 1, 'verify_distfile good'); -# 33, get_sbo_version test +# get_sbo_version test is (get_sbo_version "$sbo_home/system/wine", '1.4.1', 'get_sbo_version good'); -# 34, get_symlink_from_filename test +# get_symlink_from_filename test is ((get_symlink_from_filename "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", "$sbo_home/system/laptop-mode-tools"), "$sbo_home/system/laptop-mode-tools/laptop-mode-tools_1.61.tar.gz", 'get_symlink_from_filename good'); -# 35-36, check_x32 tests +# check_x32 tests ok (check_x32 "$sbo_home/system/wine", 'check_x32 true for 32-bit only wine'); ok (!(check_x32 "$sbo_home/system/ifuse"), 'check_x32 false for not-32-bit-only ifuse'); -# 37, check_multilib tests +# check_multilib tests ok (check_multilib, 'check_multilib good'); -# 38-39, create_symlinks tests +# create_symlinks tests %downloads = get_sbo_downloads (LOCATION => "$sbo_home/system/wine", 32 => 1); my @symlinks = create_symlinks "$sbo_home/system/wine", %downloads; is ($symlinks[0], "$sbo_home/system/wine/wine-1.4.1.tar.bz2", @@ -156,7 +156,7 @@ is ($symlinks[0], "$sbo_home/system/wine/wine-1.4.1.tar.bz2", is ($symlinks[1], "$sbo_home/system/wine/dibeng-max-2010-11-12.zip", '$symlinks[1] good for create_symlinks'); -# 40-41, grok_temp_file, get_src_dir/get_pkg_name tests +# grok_temp_file, get_src_dir/get_pkg_name tests my $tempdir = tempdir (CLEANUP => 1); my $tempfh = tempfile (DIR => $tempdir); my $lmt = 'laptop-mode-tools_1.60'; @@ -228,7 +228,7 @@ is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), $expected_out, 'all changed lines rewritten correctly'); is (revert_slackbuild $slackbuild, 1, 'revert_slackbuild is good again'); -# 59-61, get_from_info tests +# get_from_info tests my $test_loc = "$sbo_home/system/ifuse"; my %params = (LOCATION => $test_loc); my $info = get_from_info (%params, GET => 'VERSION'); @@ -239,7 +239,7 @@ is ($$info[0], 'http://www.libimobiledevice.org', $info = get_from_info (%params, GET => 'DOWNLOAD_x86_64'); is ($$info[0], "", 'get_from_info GET => DOWNLOAD_x86_64 is good'); -# 62-64, get_update_list tests +# get_update_list tests my $listing = get_update_list; s/\s//g for @$listing; for my $item (@$listing) { @@ -251,14 +251,14 @@ for my $item (@$listing) { 'get_update_list output good for atkmm') if $item =~ /^atkmm/; } -# 65, remove_stuff test - can only really test for invalid input +# remove_stuff test - can only really test for invalid input is (remove_stuff '/omg/wtf/bbq', 1, 'remove_stuff good for invalid input'); -# 66, config_write test +# config_write test is (config_write ('OMG', 'WTF'), undef, 'config_write returned undef correctly'); -# 67-74, perform_search tests +# perform_search tests my $findings = perform_search 'desktop'; for my $found (@$findings) { for my $key (keys %$found) { @@ -279,12 +279,12 @@ for my $found (@$findings) { } } -# 75, get_inst_names test +# get_inst_names test $installed = get_installed_sbos; my $inst_names = get_inst_names $installed; ok ('zdoom' ~~ @$inst_names, 'get_inst_names is good'); -# 76-81, get_reqs tests +# get_reqs tests $SBO::Lib::no_reqs = 0; # no longer valid - there are no longer any circular requirements. #ok (! (get_requires 'zarafa', "$sbo_home/network/zarafa"), @@ -299,7 +299,7 @@ ok (! (get_requires 'smc', "$sbo_home/games/smc"), ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), 'get_requires good for REQUIRES=""'); -# 82-85, get_user_group tests +# get_user_group tests $fh = open_read "$sbo_home/network/nagios/README"; my $readme = do {local $/; <$fh>}; close $fh; @@ -315,7 +315,7 @@ is ($$cmds[0], 'groupadd -g 210 clamav', 'get_user_group good for groupadd'); is ($$cmds[1], 'useradd -u 256 -d /dev/null -s /bin/false -g clamav havp', 'get_user_group good for useradd'); -# 86-87, get_opts test +# get_opts test $fh = open_read "$sbo_home/games/vbam/README"; $readme = do {local $/; <$fh>}; close $fh; @@ -325,28 +325,32 @@ $readme = do {local $/; <$fh>}; close $fh; ok (! (get_opts $readme), 'get_opts good where README does not define opts'); -# 88-90, clean_reqs tests +# clean_reqs tests $SBO::Lib::compat32 = 0; $reqs = get_requires "zdoom", "$sbo_home/games/zdoom"; $reqs = clean_reqs $reqs; ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); $reqs = get_requires 'gmpc', "$sbo_home/audio/gmpc"; $reqs = clean_reqs $reqs; -ok ($$reqs[0] eq 'gob2', 'clean_reqs good for un/installed reqs.'); -ok ($$reqs[1] eq 'libmpd', 'clean_reqs good for un/installed reqs.'); +is ($$reqs[0], 'gob2', 'clean_reqs good for un/installed reqs.'); +is ($$reqs[1], 'libmpd', 'clean_reqs good for un/installed reqs.'); my $warnings = {()};; my $queue = get_build_queue ['zdoom', 'bsnes', 'spring'], $warnings; my $count = @$queue; -ok ($count == 10, 'get_build_queue returns correct amount for multiple sbos'); -ok ($$queue[0] eq 'jdk', 'get_build_queue first entry correct for multiple sbos'); -ok ($$queue[2] eq 'OpenAL', 'get_build_queue third entry correct for multiple sbos'); -ok ($$queue[4] eq 'spring', 'get_build_queue fifth entry correct for multiple sbos'); -ok ($$queue[6] eq 'fmodapi', 'get_build_queue seventh entry correct for multiple sbos'); -ok ($$queue[8] eq 'TiMidity++', 'get_build_queue ninth entry correct for multiple sbos'); +is ($count, 10, 'get_build_queue returns correct amount for multiple sbos'); +is ($$queue[0], 'jdk', 'get_build_queue first entry correct for multiple sbos'); +is ($$queue[2], 'OpenAL', 'get_build_queue third entry correct for multiple sbos'); +is ($$queue[4], 'spring', 'get_build_queue fifth entry correct for multiple sbos'); +is ($$queue[6], 'fmodapi', 'get_build_queue seventh entry correct for multiple sbos'); +is ($$queue[8], 'TiMidity++', 'get_build_queue ninth entry correct for multiple sbos'); $queue = get_build_queue ['zdoom'], $warnings; $count = @$queue; -ok ($count == 5, 'get_build_queue returns correct amount for single sbo'); -ok ($$queue[0] eq 'p7zip', 'get_build_queue first entry correct for single sbo'); -ok ($$queue[2] eq 'eawpats', 'get_build_queue third entry correct for single sbo'); -ok ($$queue[4] eq 'zdoom', 'get_build_queue fifth entry correct for single sbo'); +is ($count, 5, 'get_build_queue returns correct amount for single sbo'); +is ($$queue[0], 'p7zip', 'get_build_queue first entry correct for single sbo'); +is ($$queue[2], 'eawpats', 'get_build_queue third entry correct for single sbo'); +is ($$queue[4], 'zdoom', 'get_build_queue fifth entry correct for single sbo'); + + +# end of tests. +done_testing(); -- cgit v1.2.3