diff options
author | Kent Fredric <kentnl@gentoo.org> | 2017-10-13 09:13:58 +1300 |
---|---|---|
committer | Kent Fredric <kentnl@gentoo.org> | 2017-10-13 10:14:01 +1300 |
commit | 1ff2833374b810c7ed5c50e17208c1033136f243 (patch) | |
tree | 9fafdf867cd0b0f482919672888c20104246a374 | |
parent | toolchain-binutils.eclass: Add my public_html as patch source (diff) | |
download | gentoo-1ff2833374b810c7ed5c50e17208c1033136f243.tar.gz gentoo-1ff2833374b810c7ed5c50e17208c1033136f243.tar.bz2 gentoo-1ff2833374b810c7ed5c50e17208c1033136f243.zip |
dev-perl/Audio-Mixer: Fixup testing and cruft files
- EAPI6
- Don't install volume.pl to @INC
- Add USE=examples
- Add some basic tests without needing the soundcard
- Properly fence and advertise tests
- Replace upstreams tests with better ones that fail when things break.
- Apply clang patch
Package-Manager: Portage-2.3.8, Repoman-2.3.3
4 files changed, 234 insertions, 0 deletions
diff --git a/dev-perl/Audio-Mixer/Audio-Mixer-0.700.0-r2.ebuild b/dev-perl/Audio-Mixer/Audio-Mixer-0.700.0-r2.ebuild new file mode 100644 index 000000000000..9325b9aecf0f --- /dev/null +++ b/dev-perl/Audio-Mixer/Audio-Mixer-0.700.0-r2.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +DIST_AUTHOR=SERGEY +DIST_VERSION=0.7 +DIST_EXAMPLES=("eg/*") +inherit perl-module + +DESCRIPTION="Perl extension for Sound Mixer control" + +SLOT="0" +KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86" +IUSE="" + +PATCHES=( + "${FILESDIR}/${P}-volumepl.patch" + "${FILESDIR}/${P}-clang.patch" + "${FILESDIR}/${P}-testsuite.patch" +) + +src_test() { + local MODULES=( + "Audio::Mixer ${DIST_VERSION}" + ) + local failed=() + for dep in "${MODULES[@]}"; do + ebegin "Compile testing ${dep}" + perl -Mblib="${S}" -M"${dep} ()" -e1 + eend $? || failed+=( "$dep" ) + done + if [[ ${failed[@]} ]]; then + echo + eerror "One or more modules failed compile:"; + for dep in "${failed[@]}"; do + eerror " ${dep}" + done + die "Failing due to module compilation errors"; + fi + if [[ "${AUDIO_MIXER_HW_TEST:-0}" == 0 ]]; then + ewarn "Comprehensive testing of this module needs hardware access to mixing" + ewarn "devices. Set AUDIO_MIXER_HW_TEST=1 in your environment if you want full" + ewarn "coverage" + ewarn "For details, see:" + ewarn "https://wiki.gentoo.org/wiki/Project:Perl/maint-notes/dev-perl/Audio-Mixer" + else + perl-module_src_test + fi +} diff --git a/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-clang.patch b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-clang.patch new file mode 100644 index 000000000000..b7beac56f9a8 --- /dev/null +++ b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-clang.patch @@ -0,0 +1,27 @@ +From 6390829e5e60019b464d1fe83fb448ea54604170 Mon Sep 17 00:00:00 2001 +From: gregor herrmann <gregoa@debian.org> +Date: Wed, 26 Mar 2014 05:44:25 +1300 +Subject: Fix building with clang + +Bug: https://rt.cpan.org/Ticket/Display.html?id=94186 +Bug: https://bugs.debian.org/742537 +--- + Mix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Mix.c b/Mix.c +index 108153e..8b4284b 100644 +--- a/Mix.c ++++ b/Mix.c +@@ -78,7 +78,7 @@ close_mixer() { + #ifdef DEBUG + fprintf(stderr, "close_mixer()\n"); + #endif +- if (mixer_fd < 0) return; ++ if (mixer_fd < 0) return(0); + close(mixer_fd); + init_flag = 0; + mixer_fd = -1; +-- +2.14.2 + diff --git a/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-testsuite.patch b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-testsuite.patch new file mode 100644 index 000000000000..c984c7190fca --- /dev/null +++ b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-testsuite.patch @@ -0,0 +1,124 @@ +From a3117d0b6a9e79f11e69362c42205bc548f6c754 Mon Sep 17 00:00:00 2001 +From: Kent Fredric <kentnl@gentoo.org> +Date: Fri, 13 Oct 2017 09:43:01 +1300 +Subject: Rework test suite to be useful + +Bug: https://rt.cpan.org/Ticket/Display.html?id=31547 +--- + MANIFEST | 2 +- + t/basic.t | 23 +++++++++++++++++++++++ + test.pl | 60 ------------------------------------------------------------ + 3 files changed, 24 insertions(+), 61 deletions(-) + create mode 100644 t/basic.t + delete mode 100644 test.pl + +diff --git a/MANIFEST b/MANIFEST +index d15c4ab..b713e9a 100644 +--- a/MANIFEST ++++ b/MANIFEST +@@ -5,6 +5,6 @@ Mix.c + Mix.h + Mixer.pm + Mixer.xs +-test.pl ++t/basic.t + eg/volume.pl + README +diff --git a/t/basic.t b/t/basic.t +new file mode 100644 +index 0000000..53448d2 +--- /dev/null ++++ b/t/basic.t +@@ -0,0 +1,23 @@ ++use strict; ++use warnings; ++ ++use Test::More tests => 7; ++ ++require_ok("Audio::Mixer"); ++ ++is( Audio::Mixer::init_mixer(), 0, "Initialize Mixer" ); ++ ++my ( @old ) = Audio::Mixer::get_cval('vol'); ++cmp_ok( scalar @old, ">", 0 , "Got existing volume levels"); ++ ++Audio::Mixer::set_cval('vol', 50); ++my ( @new ) = Audio::Mixer::get_cval('vol'); ++is( $new[0], 50, "Set left channel to 50"); ++is( $new[1], 50, "Set right channel to 50"); ++ ++Audio::Mixer::set_cval('vol', $old[0], $old[1]); ++my ( @final ) = Audio::Mixer::get_cval('vol'); ++is( $final[0], $old[0], "Restored left channel"); ++is( $final[1], $old[1], "Restored right channel"); ++ ++done_testing; +diff --git a/test.pl b/test.pl +deleted file mode 100644 +index af1f214..0000000 +--- a/test.pl ++++ /dev/null +@@ -1,60 +0,0 @@ +-# Before `make install' is performed this script should be runnable with +-# `make test'. After `make install' it should work as `perl test.pl' +- +-######################### We start with some black magic to print on failure. +- +-# Change 1..1 below to 1..last_test_to_print . +-# (It may become useful if the test is moved to ./t subdirectory.) +- +-BEGIN { $| = 1; print "1..1\n"; } +-END {print "not ok 1\n" unless $loaded;} +-use Audio::Mixer; +-$loaded = 1; +-print "ok 1\n"; +- +-######################### End of black magic. +- +-# Insert your test code below (better if it prints "ok 13" +-# (correspondingly "not ok 13") depending on the success of chunk 13 +-# of the test code): +- +-print STDERR "Opening mixer... "; +-$ret = Audio::Mixer::init_mixer(); +-print STDERR $ret ? "FAILED.\n" : "Ok.\n"; +- +-print STDERR "Getting the volume... "; +-my @old = Audio::Mixer::get_cval('vol'); +-print STDERR join(', ', @old)." Ok.\nSetting to 50... "; +-Audio::Mixer::set_cval('vol', 50); +-my @ret = Audio::Mixer::get_cval('vol'); +-print STDERR ($ret[0] == 50 && $ret[1] == 50) ? "Ok.\nResetting back... " : +- "FAILED.\nTrying to reset back... "; +-Audio::Mixer::set_cval('vol', $old[0], $old[1]); +-@ret = Audio::Mixer::get_cval('vol'); +-print STDERR ($ret[0] == $old[0] && $ret[1] == $old[1]) ? +- "Ok.\n" : "FAILED.\n"; +- +-#my $ret = Mixer::get_cval('vol'); +-#printf "get_cval() vol=0x%x\n", $ret; +- +-#$ret = Mixer::set_cval('vol', 50); +-#print "set_cval returns $ret\n"; +- +-#@ret = Mixer::get_cval('vol'); +-#print "get_cval() vol=".join(', ', @ret)."\n"; +-#$ret = Mixer::get_cval('vol'); +-#printf "get_cval() vol=0x%x\n", $ret; +- +- +-#$ret = Mixer::get_param_val('vol'); +-#printf "get_param_val() vol=0x%x\n", $ret; +- +-#$ret = Mixer::set_param_val('vol', 20, 50); +-#print "set_param_val returns $ret\n"; +- +-#$ret = Mixer::get_param_val('vol'); +-#printf "get_param_val() vol=0x%x\n", $ret; +- +-#@ret = Mixer::get_mixer_params(); +-#print "== ".join(',', @ret)." ==\n"; +- +-- +2.14.2 + diff --git a/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-volumepl.patch b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-volumepl.patch new file mode 100644 index 000000000000..577c64c8cc36 --- /dev/null +++ b/dev-perl/Audio-Mixer/files/Audio-Mixer-0.700.0-volumepl.patch @@ -0,0 +1,33 @@ +From 695556cfe22cdcec13f2dc206abcc425f7168519 Mon Sep 17 00:00:00 2001 +From: Kent Fredric <kentnl@gentoo.org> +Date: Fri, 13 Oct 2017 08:41:59 +1300 +Subject: Prevent volume.pl being installed to @INC + +$DISTROOT/*.pl get installed as Audio/*.pl, due to the historical use +use of ".pl" to indicate "perl library" in Perl 4 and older. + +Bug: https://rt.cpan.org/Ticket/Display.html?id=123258 +--- + MANIFEST | 2 +- + volume.pl => eg/volume.pl | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename volume.pl => eg/volume.pl (100%) + +diff --git a/MANIFEST b/MANIFEST +index 627c3fe..d15c4ab 100644 +--- a/MANIFEST ++++ b/MANIFEST +@@ -6,5 +6,5 @@ Mix.h + Mixer.pm + Mixer.xs + test.pl +-volume.pl ++eg/volume.pl + README +diff --git a/volume.pl b/eg/volume.pl +similarity index 100% +rename from volume.pl +rename to eg/volume.pl +-- +2.14.2 + |