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
This commit is contained in:
Hans-Christoph Steiner 2017-09-13 16:00:51 +02:00
parent cb10f0df09
commit e4ca82d80c

View file

@ -8,11 +8,13 @@ import logging
import optparse import optparse
import os import os
import shutil import shutil
import subprocess
import sys import sys
import tempfile import tempfile
import unittest import unittest
import yaml import yaml
from binascii import unhexlify from binascii import unhexlify
from distutils.version import LooseVersion
localmodule = os.path.realpath( localmodule = os.path.realpath(
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..')) 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.assertFalse(os.path.exists(os.path.join('archive', apkName)))
self.assertTrue(os.path.exists(os.path.join('repo', 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 # this test only works on systems with fully updated Java/jarsigner
# that has MD5 listed in jdk.jar.disabledAlgorithms in java.security # 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', skip, apk, cachechanged = fdroidserver.update.process_apk({}, apkName, 'repo',
knownapks, knownapks,
allow_disabled_algorithms=False, allow_disabled_algorithms=False,