From: Dodji Seketeli Date: Mon, 23 Jan 2017 23:37:22 +0000 (+0100) Subject: Fix silent failure of tests/runtestfedabipkgdiff.py X-Git-Tag: libabigail-1.0~143 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=838aa6810b8011feebc9ef139bd0442015934fc5;p=libabigail.git Fix silent failure of tests/runtestfedabipkgdiff.py It turns out the test /tests/runtestfedabipkgdiff.py is failing, but "make check TESTS=runtestfedabipkgdiff.py" is not. In other words, runtestfedabipkgdiff.py is failing silently; we don't see it when doing "make check". The reason why runtestfedabipkgdiff.py is failing is that mockfedabipkgdiff is trying to patch the global variable DEFAULT_KOJI_TOPDIR from the fedabipkgdiff file; and that global variable is not present in that file. The right global variable that we want is DEFAULT_KOJI_TOPURL. This patch fixes that issue. The reason why the failing above is silent is because the the main function wasn't returning 0 upon success and 1 otherwise. This patch fixes that issue as well. So with this patch, /tests/runtestfedabipkgdiff does not fail anymore and when it does, the "make check TESTS=runtestfedabipkgdiff.py" fails as well. * tests/mockfedabipkgdiff.in (run_fedabipkgdiff): Patch fedabipkgdiff.DEFAULT_KOJI_TOPURL instead of fedabipkgdiff.DEFAULT_KOJI_TOPDIR. * tests/runtestfedabipkgdiff.py.in (main): Properly return 0 upon success, 1 otherwise. Signed-off-by: Dodji Seketeli --- diff --git a/tests/mockfedabipkgdiff.in b/tests/mockfedabipkgdiff.in index 21419837..68d26faf 100644 --- a/tests/mockfedabipkgdiff.in +++ b/tests/mockfedabipkgdiff.in @@ -359,7 +359,7 @@ class MockClientSession(object): @patch('koji.ClientSession', new=MockClientSession) -@patch('fedabipkgdiff.DEFAULT_KOJI_TOPDIR', new=TEST_TOPDIR) +@patch('fedabipkgdiff.DEFAULT_KOJI_TOPURL', new=TEST_TOPDIR) @patch('fedabipkgdiff.DEFAULT_ABIPKGDIFF', new=ABIPKGDIFF) @patch('fedabipkgdiff.get_download_dir', side_effect=mock_get_download_dir) def run_fedabipkgdiff(get_download_dir): diff --git a/tests/runtestfedabipkgdiff.py.in b/tests/runtestfedabipkgdiff.py.in index 55761c01..9777415f 100755 --- a/tests/runtestfedabipkgdiff.py.in +++ b/tests/runtestfedabipkgdiff.py.in @@ -150,14 +150,13 @@ def main(): This creates the output directory and launches the tests for the fedabipkgdiff program. + :return: 0 upon success, 1 otherwise. """ ensure_output_dir_created() result = 0 result = run_fedabipkgdiff_tests() - if not result: - return result - + return not result if __name__ == '__main__': exit_code = main()