chiark / gitweb /
fix intermittent test failure
authorHans-Christoph Steiner <hans@eds.org>
Thu, 3 May 2018 11:30:03 +0000 (13:30 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 3 May 2018 11:46:42 +0000 (13:46 +0200)
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

fdroidserver/common.py
tests/common.TestCase

index 68b7e79ee83e8b7f39f6c1ce692f5fa6d6c861cf..c0e49027c84c10735fad585fb15eb58e8b9039c9 100644 (file)
@@ -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<appid>.*)' versionCode='(?P<vercode>.*)' versionName='(?P<vername>.*)'.*")
+    r = re.compile("^package: name='(?P<appid>.*)' versionCode='(?P<vercode>.*)' versionName='(?P<vername>.*?)'(?: platformBuildVersionName='.*')?")
     p = SdkToolsPopen(['aapt', 'dump', 'badging', apkfile], output=False)
     for line in p.output.splitlines():
         m = r.match(line)
index 55af255866491baabd5f7559a5746978217d9c55..c01369f4b62b0d3ad3ea917506af98f48a146b77 100755 (executable)
@@ -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'),