<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch release-2.4
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/1f63790f2535049f03d0732156c7efc5fe1f568c">https://github.com/macports/macports-base/commit/1f63790f2535049f03d0732156c7efc5fe1f568c</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/release-2.4 by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 1f63790 tests: Avoid bogus error message during test runs
</span>1f63790 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 1f63790f2535049f03d0732156c7efc5fe1f568c
</span>Author: Clemens Lang <cal@macports.org>
AuthorDate: Mon Mar 12 16:21:46 2018 +0100
<span style='display:block; white-space:pre;color:#404040;'> tests: Avoid bogus error message during test runs
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> The distcheck unit test caused remote network traffic, which is bad from
</span><span style='display:block; white-space:pre;color:#404040;'> a testing perspective. Additionally, it printed error messages to
</span><span style='display:block; white-space:pre;color:#404040;'> stderr.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Avoid both of these problems by replacing the curl command with a mock
</span><span style='display:block; white-space:pre;color:#404040;'> for the time of the test. This will also speed up the test.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Drop the unit test for the filesize distcheck.type, since there is no
</span><span style='display:block; white-space:pre;color:#404040;'> good way to actually test whether it succeeds.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> (cherry picked from commit 4c11f3bea113e305776751e98d5236e34175a972)
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/52218
</span>---
src/port1.0/tests/portdistcheck.test | 46 +++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 14 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/tests/portdistcheck.test b/src/port1.0/tests/portdistcheck.test
</span><span style='display:block; white-space:pre;color:#808080;'>index 6e99d83..18bdaa2 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/tests/portdistcheck.test
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/tests/portdistcheck.test
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -18,9 +18,7 @@ source ./library.tcl
</span> macports_worker_init
<span style='display:block; white-space:pre;background:#ffe0e0;'>-test distcheck_main {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- Distcheck main unit test.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -setup {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set distcheck_fixture_setup {
</span> set portpath $pwd
set filespath $pwd/files
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -34,20 +32,40 @@ test distcheck_main {
</span> set porturl "http://distfiles.macports.org/gcc_select/"
set master_sites $porturl
set extract.suffix .tar.gz
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -body {
</span> set fetch.type standard
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set distcheck.type moddate
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[portdistcheck::distcheck_main] != ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return "FAIL: unable to download or check file, type moddate"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set distcheck.type filesize
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[portdistcheck::distcheck_main] != ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return "FAIL: unable to download or check file, type filesize"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # replace curl with a mock
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename curl _save_curl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc curl {operation args} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global _test_isnewer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ switch $operation {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ isnewer {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ${_test_isnewer}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set distcheck_fixture_cleanup {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # restore original curl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename curl ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename _save_curl curl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return "Distcheck main successful."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -result "Distcheck main successful."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+test distcheck_moddate_newer {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Check that files on servers that are newer than the Portfile cause a warning.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -setup $distcheck_fixture_setup -cleanup $distcheck_fixture_cleanup -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set distcheck.type moddate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set _test_isnewer 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [portdistcheck::distcheck_main]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -errorOutput "Warning: port gcc_select: .* is newer than Portfile" -match regexp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+test distcheck_moddate_not_newer {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Check that files on server that are not newer than the Portfile do not cause a warning
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -setup $distcheck_fixture_setup -cleanup $distcheck_fixture_cleanup -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set distcheck.type moddate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set _test_isnewer 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [portdistcheck::distcheck_main]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -errorOutput ""
</span>
cleanupTests
</pre><pre style='margin:0'>
</pre>