From: Hans-Christoph Steiner Date: Wed, 13 Sep 2017 14:00:51 +0000 (+0200) Subject: tests: support running on platforms with old java X-Git-Tag: 0.9~80^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e4ca82d80ca4cd7d73776042028c12af7f38ab24;p=fdroidserver.git tests: support running on platforms with old java In order to test on travis-ci's OSX setup, its easiest to support the old version of Java that is installed there by default. It is pretty old, so it does not include the April 2017 update that disables MD5: https://blogs.oracle.com/java-platform-group/oracle-jre-will-no-longer-trust-md5-signed-code-by-default https://www.bleepingcomputer.com/news/security/oracle-to-block-jar-files-signed-with-md5-starting-with-april-2017 https://support.ca.com/us/knowledge-base-articles.TEC1691042.html #292 #323 --- diff --git a/tests/update.TestCase b/tests/update.TestCase index 5d292f4b..76a93802 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -8,11 +8,13 @@ import logging import optparse import os import shutil +import subprocess import sys import tempfile import unittest import yaml from binascii import unhexlify +from distutils.version import LooseVersion localmodule = os.path.realpath( os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..')) @@ -397,8 +399,15 @@ class UpdateTest(unittest.TestCase): self.assertFalse(os.path.exists(os.path.join('archive', apkName))) self.assertTrue(os.path.exists(os.path.join('repo', apkName))) + javac = config['jarsigner'].replace('jarsigner', 'javac') + v = subprocess.check_output([javac, '-version'], stderr=subprocess.STDOUT)[6:-1].decode('utf-8') + if LooseVersion(v) < LooseVersion('1.8.0_132'): + print('SKIPPING: running tests with old Java (' + v + ')') + return + # this test only works on systems with fully updated Java/jarsigner # that has MD5 listed in jdk.jar.disabledAlgorithms in java.security + # https://blogs.oracle.com/java-platform-group/oracle-jre-will-no-longer-trust-md5-signed-code-by-default skip, apk, cachechanged = fdroidserver.update.process_apk({}, apkName, 'repo', knownapks, allow_disabled_algorithms=False,