diff --git a/tests/test_build.py b/tests/test_build.py index 5290552e..e8e6927e 100755 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -2,6 +2,7 @@ import os import shutil +import sys import tempfile import textwrap import unittest @@ -48,6 +49,7 @@ class BuildTest(unittest.TestCase): os.makedirs(os.path.join(d, 'platform-tools'), exist_ok=True) os.makedirs(os.path.join(d, 'tools'), exist_ok=True) + @unittest.skipIf(sys.byteorder == 'big', "androguard is not ported to big-endian") def test_get_apk_metadata(self): config = dict() fdroidserver.common.fill_config_defaults(config) diff --git a/tests/test_common.py b/tests/test_common.py index 51d9a02a..b9953c71 100755 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -211,6 +211,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): fdroidserver.common._add_java_paths_to_config(pathlist, config) self.assertEqual(config['java_paths']['8'], choice[1:]) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_is_debuggable_or_testOnly(self): config = dict() fdroidserver.common.fill_config_defaults(config) @@ -778,6 +779,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): for name in bad: self.assertIsNone(fdroidserver.common.STANDARD_FILE_NAME_REGEX.match(name)) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_apk_signer_fingerprint(self): # fingerprints fetched with: keytool -printcert -file ____.RSA @@ -792,6 +794,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): self.assertEqual(keytoolcertfingerprint, fdroidserver.common.apk_signer_fingerprint(apkfile)) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_apk_signer_fingerprint_short(self): # fingerprints fetched with: keytool -printcert -file ____.RSA @@ -905,6 +908,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): os.path.dirname(os.path.dirname(config.get('apksigner'))), ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_sign_apk(self): _mock_common_module_options_instance() config = fdroidserver.common.read_config() @@ -1032,6 +1036,8 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): config = fdroidserver.common.read_config() if 'apksigner' not in config: self.skipTest('SKIPPING test_resign_apk, apksigner not installed!') + if sys.byteorder == 'big': + self.skipTest('SKIPPING androguard is not ported to big-endian') config['keyalias'] = 'sova' config['keystorepass'] = 'r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' @@ -1064,6 +1070,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): fdroidserver.common.get_first_signer_certificate(resign) ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_apk_id(self): config = dict() fdroidserver.common.fill_config_defaults(config) @@ -1116,6 +1123,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): self.assertEqual(versionCode, vc, 'aapt versionCode parsing failed for ' + apkfilename) self.assertEqual(versionName, vn, 'aapt versionName parsing failed for ' + apkfilename) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_apk_id_bad_apk(self): """get_apk_id should never return None on error, only raise exceptions""" with self.assertRaises(KeyError): @@ -1127,16 +1135,19 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): with self.assertRaises(KeyError): fdroidserver.common.get_apk_id('Norway_bouvet_europe_2.obf.zip') + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_apk_id_bad_path(self): with self.assertRaises(FDroidException): fdroidserver.common.get_apk_id('nope') + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_apk_id_api_call(self): self.assertEqual( ('info.guardianproject.urzip', 100, '0.1'), fdroidserver.common.get_apk_id('urzip.apk'), ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_apk_id_bad_zip(self): os.chdir(self.testdir) badzip = 'badzip.apk' @@ -1189,6 +1200,7 @@ class CommonTest(SetUpTearDownMixin, unittest.TestCase): nc = fdroidserver.common.get_native_code(apkfilename) self.assertEqual(native_code, nc) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_sdkversions_androguard(self): """This is a sanity test that androguard isn't broken""" @@ -3159,6 +3171,7 @@ class SignerExtractionTest(unittest.TestCase): def tearDown(self): self._td.cleanup() + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_first_signer_certificate_with_jars(self): for jar in ( 'signindex/guardianproject-v1.jar', @@ -3205,6 +3218,7 @@ class SignerExtractionTest(unittest.TestCase): apk + " should have matching signer fingerprints", ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_apk_signer_fingerprint_with_v1_apks(self): for apk, fingerprint in APKS_WITH_JAR_SIGNATURES: self.assertEqual( @@ -3213,6 +3227,7 @@ class SignerExtractionTest(unittest.TestCase): f'apk_signer_fingerprint should match stored fingerprint for {apk}', ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_apk_signer_fingerprint_without_v1_apks(self): for apk, fingerprint in APKS_WITHOUT_JAR_SIGNATURES: self.assertEqual( @@ -3221,6 +3236,7 @@ class SignerExtractionTest(unittest.TestCase): f'apk_signer_fingerprint should match stored fingerprint for {apk}', ) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_get_first_signer_certificate_with_unsigned_jar(self): self.assertIsNone( fdroidserver.common.get_first_signer_certificate('signindex/unsigned.jar') diff --git a/tests/test_install.py b/tests/test_install.py index 1015b4be..b4e404d5 100755 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -12,6 +12,7 @@ from fdroidserver import common, install from fdroidserver.exception import BuildException, FDroidException +@unittest.skipIf(os.uname().machine == 's390x', 'adb is not ported to s390x') class InstallTest(unittest.TestCase): '''fdroidserver/install.py''' diff --git a/tests/test_integration.py b/tests/test_integration.py index 1e07c231..c70b121a 100755 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -5,6 +5,7 @@ import re import shlex import shutil import subprocess +import sys import threading import unittest from datetime import datetime, timezone @@ -38,6 +39,7 @@ common.find_apksigner(conf) USE_APKSIGNER = "apksigner" in conf +@unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') class IntegrationTest(unittest.TestCase): @classmethod def setUpClass(cls): diff --git a/tests/test_publish.py b/tests/test_publish.py index 82390547..e405cf5f 100755 --- a/tests/test_publish.py +++ b/tests/test_publish.py @@ -247,6 +247,7 @@ class PublishTest(unittest.TestCase): self.assertEqual(publish.config['jarsigner'], data['jarsigner']) self.assertEqual(publish.config['keytool'], data['keytool']) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_sign_then_implant_signature(self): os.chdir(self.testdir) @@ -308,6 +309,7 @@ class PublishTest(unittest.TestCase): self.assertFalse(os.path.exists(unsigned)) self.assertTrue(os.path.exists(signed)) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') def test_exit_on_error(self): """Exits properly on errors, with and without --error-on-failed. diff --git a/tests/test_scanner.py b/tests/test_scanner.py index 4899a219..e2d4b5a6 100755 --- a/tests/test_scanner.py +++ b/tests/test_scanner.py @@ -387,6 +387,7 @@ class ScannerTest(unittest.TestCase): self.assertFalse(os.path.exists("build.gradle")) self.assertEqual(0, count, 'there should be this many errors') + @unittest.skipIf(os.uname().machine == 's390x', 'dexdump is not ported to s390x') def test_get_embedded_classes(self): config = dict() fdroidserver.common.config = config @@ -447,9 +448,7 @@ class ScannerTest(unittest.TestCase): 'should return not results for ' + f, ) - @unittest.skipIf( - sys.hexversion < 0x03090000, 'Python < 3.9 has a limited zipfile.is_zipfile()' - ) + @unittest.skipIf(os.uname().machine == 's390x', 'dexdump is not ported to s390x') def test_get_embedded_classes_secret_apk(self): """Try to hide an APK+DEX in an APK and see if we can find it""" config = dict() @@ -503,6 +502,7 @@ class Test_scan_binary(unittest.TestCase): } fdroidserver.scanner._SCANNER_TOOL.regexs['warn_code_signatures'] = {} + @unittest.skipIf(os.uname().machine == 's390x', 'dexdump is not ported to s390x') def test_code_signature_match(self): apkfile = os.path.join(basedir, 'no_targetsdk_minsdk1_unsigned.apk') self.assertEqual( @@ -516,12 +516,7 @@ class Test_scan_binary(unittest.TestCase): ), ) - @unittest.skipIf( - sys.version_info < (3, 9), - "Our implementation for traversing zip files will silently fail to work" - "on older python versions, also see: " - "https://gitlab.com/fdroid/fdroidserver/-/merge_requests/1110#note_932026766", - ) + @unittest.skipIf(os.uname().machine == 's390x', 'dexdump is not ported to s390x') def test_bottom_level_embedded_apk_code_signature(self): apkfile = os.path.join(basedir, 'apk.embedded_1.apk') fdroidserver.scanner._SCANNER_TOOL.regexs['err_code_signatures'] = { @@ -542,6 +537,7 @@ class Test_scan_binary(unittest.TestCase): ), ) + @unittest.skipIf(os.uname().machine == 's390x', 'dexdump is not ported to s390x') def test_top_level_signature_embedded_apk_present(self): apkfile = os.path.join(basedir, 'apk.embedded_1.apk') fdroidserver.scanner._SCANNER_TOOL.regexs['err_code_signatures'] = { diff --git a/tests/test_signatures.py b/tests/test_signatures.py index 34722e83..5a9393b2 100755 --- a/tests/test_signatures.py +++ b/tests/test_signatures.py @@ -2,6 +2,7 @@ import hashlib import os +import sys import unittest from tempfile import TemporaryDirectory @@ -19,6 +20,7 @@ class SignaturesTest(unittest.TestCase): config['verbose'] = True common.config = config + @unittest.skipIf(sys.byteorder == 'big', "androguard is not ported to big-endian") def test_main(self): class OptionsFixture: diff --git a/tests/test_update.py b/tests/test_update.py index 6c551694..323dcace 100755 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -11,6 +11,7 @@ import random import shutil import string import subprocess +import sys import unittest import yaml import zipfile @@ -68,6 +69,7 @@ class Options: verbose = False +@unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') class UpdateTest(unittest.TestCase): '''fdroid update''' diff --git a/tests/test_verify.py b/tests/test_verify.py index 30fde2ef..adb24b29 100755 --- a/tests/test_verify.py +++ b/tests/test_verify.py @@ -3,6 +3,7 @@ import json import os import shutil +import sys import tempfile import unittest @@ -91,6 +92,7 @@ class VerifyTest(unittest.TestCase): json.load(fp) self.assertEqual(placeholder, verify.get_verified_json(f)) + @unittest.skipIf(sys.byteorder == 'big', 'androguard is not ported to big-endian') @patch('fdroidserver.common.sha256sum') def test_write_json_report(self, sha256sum): sha256sum.return_value = (