[DRE-commits] [ruby-curb] 06/06: add use-test-files-for-tests.patch debian/patches/series
Cédric Boutillier
boutil at moszumanska.debian.org
Mon Jun 6 21:26:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
boutil pushed a commit to branch master
in repository ruby-curb.
commit 247840dcf606bbec6a8251c1f5a1f600d204b7a3
Author: Cédric Boutillier <boutil at debian.org>
Date: Mon Jun 6 22:45:17 2016 +0200
add use-test-files-for-tests.patch debian/patches/series
---
debian/changelog | 2 +
debian/patches/series | 1 +
debian/patches/use-test-files-for-tests.patch | 106 ++++++++++++++++++++++++++
3 files changed, 109 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 0c72a7a..a3ae847 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ ruby-curb (0.9.3-1) unstable; urgency=medium
* Run wrap-and-sort on packaging files
* Refresh disable_test_requiring_network.patch
* Set testsuite field in control file
+ * Add use-test-files-for-tests.patch to run tests with files that are
+ still around in autopkgtest environment
-- Cédric Boutillier <boutil at debian.org> Mon, 06 Jun 2016 07:03:51 +0200
diff --git a/debian/patches/series b/debian/patches/series
index 5f8264c..4143434 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
disable_test_requiring_network.patch
remove-local-extension-dir-from-tests-loadpath.patch
+use-test-files-for-tests.patch
diff --git a/debian/patches/use-test-files-for-tests.patch b/debian/patches/use-test-files-for-tests.patch
new file mode 100644
index 0000000..cf1fdd1
--- /dev/null
+++ b/debian/patches/use-test-files-for-tests.patch
@@ -0,0 +1,106 @@
+Description: use files from tests/ instead of C files from ext/ for tests
+ because they are around when doing autopkgtest
+Author: Cédric Boutillier <boutil at debian.org>
+Forwarded: no
+Last-Update: 2016-06-06
+
+--- a/tests/helper.rb
++++ b/tests/helper.rb
+@@ -149,7 +149,7 @@
+ server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => File.expand_path(File.dirname(__FILE__))
+
+ server.mount(servlet.path, servlet)
+- server.mount("/ext", WEBrick::HTTPServlet::FileHandler, File.join(File.dirname(__FILE__),'..','ext'))
++ server.mount("/tests", WEBrick::HTTPServlet::FileHandler, File.join(File.dirname(__FILE__),'..','tests'))
+
+ trap("INT") { server.shutdown }
+ GC.start
+@@ -165,7 +165,7 @@
+ @server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => File.expand_path(File.dirname(__FILE__))
+
+ @server.mount(servlet.path, servlet)
+- @server.mount("/ext", WEBrick::HTTPServlet::FileHandler, File.join(File.dirname(__FILE__),'..','ext'))
++ @server.mount("/tests", WEBrick::HTTPServlet::FileHandler, File.join(File.dirname(__FILE__),'..','tests'))
+ queue = Queue.new # synchronize the thread startup to the main thread
+
+ @test_thread = Thread.new { queue << 1; @server.start }
+--- a/tests/tc_curl_download.rb
++++ b/tests/tc_curl_download.rb
+@@ -8,31 +8,31 @@
+ end
+
+ def test_download_url_to_file_via_string
+- dl_url = "http://127.0.0.1:9129/ext/curb_easy.c"
++ dl_url = "http://127.0.0.1:9129/tests/unittests.rb"
+ dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
+
+ curb = Curl::Easy.download(dl_url, dl_path)
+ assert File.exist?(dl_path)
+- assert_equal File.read(File.join(File.dirname(__FILE__), '..','ext','curb_easy.c')), File.read(dl_path)
++ assert_equal File.read(File.join(File.dirname(__FILE__), '..','tests','unittests.rb')), File.read(dl_path)
+ ensure
+ File.unlink(dl_path) if File.exist?(dl_path)
+ end
+
+ def test_download_url_to_file_via_file_io
+- dl_url = "http://127.0.0.1:9129/ext/curb_easy.c"
++ dl_url = "http://127.0.0.1:9129/tests/unittests.rb"
+ dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
+ io = File.open(dl_path, 'wb')
+
+ curb = Curl::Easy.download(dl_url, io)
+ assert io.closed?
+ assert File.exist?(dl_path)
+- assert_equal File.read(File.join(File.dirname(__FILE__), '..','ext','curb_easy.c')), File.read(dl_path)
++ assert_equal File.read(File.join(File.dirname(__FILE__), '..','tests','unittests.rb')), File.read(dl_path)
+ ensure
+ File.unlink(dl_path) if File.exist?(dl_path)
+ end
+
+ def test_download_url_to_file_via_io
+- dl_url = "http://127.0.0.1:9129/ext/curb_easy.c"
++ dl_url = "http://127.0.0.1:9129/tests/unittests.rb"
+ dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
+ reader, writer = IO.pipe
+
+@@ -56,7 +56,7 @@
+ end
+
+ assert File.exist?(dl_path)
+- assert_equal File.read(File.join(File.dirname(__FILE__), '..','ext','curb_easy.c')), File.read(dl_path)
++ assert_equal File.read(File.join(File.dirname(__FILE__), '..','tests','unittests.rb')), File.read(dl_path)
+ ensure
+ File.unlink(dl_path) if File.exist?(dl_path)
+ end
+--- a/tests/tc_curl_multi.rb
++++ b/tests/tc_curl_multi.rb
+@@ -301,9 +301,9 @@
+
+ def test_multi_easy_get_01
+ urls = []
+- root_uri = 'http://127.0.0.1:9129/ext/'
+- # send a request to fetch all c files in the ext dir
+- Dir[File.dirname(__FILE__) + "/../ext/*.c"].each do|path|
++ root_uri = 'http://127.0.0.1:9129/tests/'
++ # send a request to fetch all rb files in the tests dir
++ Dir[File.dirname(__FILE__) + "/../tests/*.rb"].each do|path|
+ urls << root_uri + File.basename(path)
+ end
+ urls = urls[0..(urls.size/2)] # keep it fast, webrick...
+@@ -314,14 +314,14 @@
+
+ def test_multi_easy_download_01
+ # test collecting response buffers to file e.g. on_body
+- root_uri = 'http://127.0.0.1:9129/ext/'
++ root_uri = 'http://127.0.0.1:9129/tests/'
+ urls = []
+ downloads = []
+ file_info = {}
+ FileUtils.mkdir("tmp/")
+
+ # for each file store the size by file name
+- Dir[File.dirname(__FILE__) + "/../ext/*.c"].each do|path|
++ Dir[File.dirname(__FILE__) + "/../tests/*.rb"].each do|path|
+ urls << (root_uri + File.basename(path))
+ downloads << "tmp/" + File.basename(path)
+ file_info[File.basename(path)] = {:size => File.size(path), :path => path}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-curb.git
More information about the Pkg-ruby-extras-commits
mailing list