diff options
author | Sam James <sam@gentoo.org> | 2023-03-27 13:43:13 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-03-27 14:23:58 +0100 |
commit | 1b48d59f69f5ac0d162437b13601f7b666d3eed2 (patch) | |
tree | 28d7c144accbf3f1ce0389e13584206a4c3aa9ab /dev-ruby/pcaprub | |
parent | dev-ruby/pcaprub: add github upstream metadata (diff) | |
download | gentoo-1b48d59f69f5ac0d162437b13601f7b666d3eed2.tar.gz gentoo-1b48d59f69f5ac0d162437b13601f7b666d3eed2.tar.bz2 gentoo-1b48d59f69f5ac0d162437b13601f7b666d3eed2.zip |
dev-ruby/pcaprub: wire up tests
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-ruby/pcaprub')
-rw-r--r-- | dev-ruby/pcaprub/pcaprub-0.13.1.ebuild | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/dev-ruby/pcaprub/pcaprub-0.13.1.ebuild b/dev-ruby/pcaprub/pcaprub-0.13.1.ebuild index a2557b0dd274..b977b4d6165b 100644 --- a/dev-ruby/pcaprub/pcaprub-0.13.1.ebuild +++ b/dev-ruby/pcaprub/pcaprub-0.13.1.ebuild @@ -1,14 +1,13 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -USE_RUBY="ruby26 ruby27 ruby30" +USE_RUBY="ruby27 ruby30" RUBY_FAKEGEM_EXTRADOC="FAQ.rdoc README.rdoc USAGE.rdoc" - RUBY_FAKEGEM_EXTENSIONS=(ext/pcaprub_c/extconf.rb) - +RUBY_FAKEGEM_TASK_TEST="test" inherit ruby-fakegem DESCRIPTION="Libpcap bindings for ruby compat" @@ -21,5 +20,45 @@ KEYWORDS="~amd64 ~arm ~x86" DEPEND+="net-libs/libpcap" RDEPEND+="net-libs/libpcap" -# Tests require live access to a network device as root. -RESTRICT="test" +ruby_add_bdepend " + test? ( + >=dev-ruby/rake-compiler-0.6.0 + ) +" + +all_ruby_prepare() { + sed -i \ + -e '/\(minitest\|shoulda-context\)/s:~>:>=:' \ + -e '/coveralls/d' \ + -e '/rubygems-tasks/d' \ + -e '/gem.*git/d' \ + Gemfile || die + + sed -i \ + -e '/rubygems\/tasks/d' \ + -e '/Gem::Tasks/d' \ + -e "/^require 'git'/,/end/ s/^/#/" \ + Rakefile || die + + sed -i -e '/coveralls/Id' test/test_helper.rb || die + + # Tests which need escalated privileges + local privileged_tests=( + test_set_datalink + test_create_from_primitives + test_filter + test_pcap_stats + test_pcap_datalink + test_pcap_inject + test_pcap_next + test_pcap_setfilter + test_pcap_snapshot + ) + + local privileged_tests_expr=$(printf "%s\|" "${privileged_tests[@]}") + privileged_tests_expr="${privileged_tests_expr::-2}" + + sed -i \ + -e "/def \(${privileged_tests_expr}\)/,/^ end/s/^/#/" \ + test/test_pcaprub_unit.rb || die +} |