From: Hans-Christoph Steiner Date: Thu, 3 May 2018 11:30:03 +0000 (+0200) Subject: fix intermittent test failure X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=fdroidserver.git;a=commitdiff_plain;h=98a2f70e38605450446857fd7064e702f9f55b73 fix intermittent test failure For some reason, the parser stopped working intermittently, even though the format has been the same since aapt 23 or earlier. Then also, some of the test cases pointed to symlinks that were no longer generated, and one test app now has a blank versionName. Strange that this wasn't caught in the gitlab-ci runs. !484 FAIL: test_get_api_id_aapt (__main__.CommonTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "./common.TestCase", line 578, in testA_get_api_id_aapt self.assertEqual(versionName, vn) AssertionError: '0.1' != "0.1' platformBuildVersionName='4.3.1-1425645" - 0.1 + 0.1' platformBuildVersionName='4.3.1-1425645 --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 68b7e79e..c0e49027 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1995,12 +1995,12 @@ def is_apk_and_debuggable(apkfile): def get_apk_id_aapt(apkfile): - """Extrat identification information from APK using aapt. + """Extract identification information from APK using aapt. :param apkfile: path to an APK file. :returns: triplet (appid, version code, version name) """ - r = re.compile("^package: name='(?P.*)' versionCode='(?P.*)' versionName='(?P.*)'.*") + r = re.compile("^package: name='(?P.*)' versionCode='(?P.*)' versionName='(?P.*?)'(?: platformBuildVersionName='.*')?") p = SdkToolsPopen(['aapt', 'dump', 'badging', apkfile], output=False) for line in p.output.splitlines(): m = r.match(line) diff --git a/tests/common.TestCase b/tests/common.TestCase index 55af2558..c01369f4 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -543,8 +543,6 @@ class CommonTest(unittest.TestCase): testcases = [ ('repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', '1101613', '0.1'), - ('OBBMainPatchCurrent.apk', 'obb.mainpatch.current', '1619', '0.1'), - ('OBBMainTwoVersions.apk', 'obb.main.twoversions', '1101613', '0.1'), ('org.bitbucket.tickytacky.mirrormirror_1.apk', 'org.bitbucket.tickytacky.mirrormirror', '1', '1.0'), ('org.bitbucket.tickytacky.mirrormirror_2.apk', 'org.bitbucket.tickytacky.mirrormirror', '2', '1.0.1'), ('org.bitbucket.tickytacky.mirrormirror_3.apk', 'org.bitbucket.tickytacky.mirrormirror', '3', '1.0.2'), @@ -555,12 +553,11 @@ class CommonTest(unittest.TestCase): ('urzip-badsig.apk', 'info.guardianproject.urzip', '100', '0.1'), ('urzip-release.apk', 'info.guardianproject.urzip', '100', '0.1'), ('urzip-release-unsigned.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk', 'info.guardianproject.urzip', '100', '0.1'), ('repo/com.politedroid_3.apk', 'com.politedroid', '3', '1.2'), ('repo/com.politedroid_4.apk', 'com.politedroid', '4', '1.3'), ('repo/com.politedroid_5.apk', 'com.politedroid', '5', '1.4'), ('repo/com.politedroid_6.apk', 'com.politedroid', '6', '1.5'), - ('repo/duplicate.permisssions_9999999.apk', 'duplicate.permisssions', '9999999', '0.3-7-gb817ac8'), + ('repo/duplicate.permisssions_9999999.apk', 'duplicate.permisssions', '9999999', ''), ('repo/info.zwanenburg.caffeinetile_4.apk', 'info.zwanenburg.caffeinetile', '4', '1.3'), ('repo/obb.main.oldversion_1444412523.apk', 'obb.main.oldversion', '1444412523', '0.1'), ('repo/obb.mainpatch.current_1619_another-release-key.apk', 'obb.mainpatch.current', '1619', '0.1'),