[DRE-commits] [ruby-backports] 01/01: Add support for autopkgtest
Jérémy Bobbio
lunar at alioth.debian.org
Fri Sep 20 09:07:06 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/autopkgtest
in repository ruby-backports.
commit feccaf5836252ea33d5bcdfc5c3ce2d349844c90
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Sep 20 11:06:36 2013 +0200
Add support for autopkgtest
---
...est-suite-to-work-against-the-installed-l.patch | 59 ++++++++++++++++++++
debian/patches/series | 1 +
debian/tests/control | 2 +
debian/tests/gem2deb | 55 ++++++++++++++++++
4 files changed, 117 insertions(+)
diff --git a/debian/patches/0001-Allow-the-test-suite-to-work-against-the-installed-l.patch b/debian/patches/0001-Allow-the-test-suite-to-work-against-the-installed-l.patch
new file mode 100644
index 0000000..b77699b
--- /dev/null
+++ b/debian/patches/0001-Allow-the-test-suite-to-work-against-the-installed-l.patch
@@ -0,0 +1,59 @@
+From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lunar at debian.org>
+Date: Fri, 20 Sep 2013 11:02:51 +0200
+Subject: Allow the test suite to work against the installed library
+
+---
+ test/_backport_guards_test.rb | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/test/_backport_guards_test.rb b/test/_backport_guards_test.rb
+index e8575de..ecf3817 100644
+--- a/test/_backport_guards_test.rb
++++ b/test/_backport_guards_test.rb
+@@ -101,19 +101,27 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
+ end
+ end
+
++ def assert_loaded(path, loaded = true)
++ assert_equal loaded, $LOADED_FEATURES.collect { |loaded| loaded.end_with?(path) }.any?
++ end
++
++ def assert_not_loaded(path)
++ assert_loaded(path, false)
++ end
++
+ def test_setlib_load_correctly_after_requiring_backports
+- path = File.expand_path("../../lib/backports/1.9.2/stdlib/matrix.rb", __FILE__)
+- assert_equal false, $LOADED_FEATURES.include?(path)
++ path = 'backports/1.9.2/stdlib/matrix.rb'
++ assert_not_loaded path
+ assert_equal true, require('matrix')
+ assert_equal true, $bogus.include?("matrix")
+- assert_equal true, $LOADED_FEATURES.include?(path)
++ assert_loaded path
+ assert_equal false, require('matrix')
+ end
+
+ def test_setlib_load_correctly_before_requiring_backports_test
+ assert_equal true, $bogus.include?("abbrev")
+- path = File.expand_path("../../lib/backports/2.0.0/stdlib/abbrev.rb", __FILE__)
+- assert_equal true, $LOADED_FEATURES.include?(path)
++ path = 'backports/2.0.0/stdlib/abbrev.rb'
++ assert_loaded path
+ assert_equal false, require('abbrev')
+ end
+
+@@ -123,10 +131,10 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
+ end
+
+ def test_load_correctly_new_libraries_test
+- path = File.expand_path("../../lib/backports/2.0.0/stdlib/fake_stdlib_lib.rb", __FILE__)
+- assert_equal false, $LOADED_FEATURES.include?(path)
++ path = 'backports/2.0.0/stdlib/fake_stdlib_lib.rb'
++ assert_not_loaded path
+ assert_equal true, require('fake_stdlib_lib')
+- assert_equal true, $LOADED_FEATURES.include?(path)
++ assert_loaded path
+ assert_equal false, require('fake_stdlib_lib')
+ end
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..57fbab4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Allow-the-test-suite-to-work-against-the-installed-l.patch
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..c684055
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: gem2deb
+Depends: gem2deb rake
diff --git a/debian/tests/gem2deb b/debian/tests/gem2deb
new file mode 100755
index 0000000..d48b2ed
--- /dev/null
+++ b/debian/tests/gem2deb
@@ -0,0 +1,55 @@
+#!/usr/bin/ruby
+
+require 'gem2deb/metadata'
+require 'gem2deb/dh_ruby'
+require 'tmpdir'
+require 'fileutils'
+
+class Tester < Gem2Deb::DhRuby
+ def run
+ run_tests
+ end
+end
+
+unless ENV['ADTTMP']
+ $stderr.puts 'ADTTMP is not set. Exiting'
+ exit 1
+end
+
+dest = ENV['ADTTMP']
+
+unless Dir.entries(dest) == ['.', '..']
+ $stderr.puts 'ADTTMP is not empty. Exiting'
+ exit 1
+end
+
+# Copy test files
+metadata = Gem2Deb::Metadata.new('.')
+metadata.test_files.each do |path|
+ next if File.directory?(path)
+ FileUtils.mkdir_p File.join(dest, File.dirname(path))
+ FileUtils.install path, File.join(dest, path)
+end
+
+# Copy Rakefile if there's one
+# XXX: not sure if we need that
+FileUtils.cp 'Rakefile', dest if File.exists?('Rakefile')
+
+# Dump gemspecs in static form (because upstream gemspec might use Git or
+# other tools)
+Dir.glob('*.gemspec').each do |path|
+ spec = Gem::Specification.load(path)
+ File.open(File.join(dest, path), 'w') { |f| f.write(spec.to_ruby) }
+end
+
+
+# Copy Debian directory
+FileUtils.cp_r 'debian', dest
+
+# Copy metadata for DhRuby
+FileUtils.cp 'metadata.yml', dest
+
+# Run the tests
+Dir.chdir(dest) do
+ Tester.new.run
+end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-backports.git
More information about the Pkg-ruby-extras-commits
mailing list