Skip to content

Re-enable previously disabled Android tests

Last month some Android tests were disabled due to an android-platform-tools bugs.

That bug is now closed, and I tried to re-enable the tests but I got:

test errors:
=================================== FAILURES ===================================
_______________________________ test_differences _______________________________
differences = []
    @skip_unless_tools_exist("aapt2")
    def test_differences(differences):
        expected_diff = get_data("arsc_expected_diff")
>       check_arsc_differences(differences, expected_diff)
differences = []
expected_diff = ('@@ -8,8 +8,8 @@\n'
 '   type layout id=02 entryCount=1\n'
 '     resource 0x7f020000 layout/main\n'
 '       () (file) res/layout/main.xml type=XML\n'
 '   type string id=03 entryCount=2\n'
 '     resource 0x7f030000 string/app_name\n'
 '       () "Sokoban(g)"\n'
 '     resource 0x7f030001 string/private_version\n'
 '-      () "a519b310bcfab08227888424a412e4b2e781e1da"\n'
 '+      () "3bd5987b1d0faebbdd76745afdbe992dcb331c73"\n')
tests/comparators/test_arsc.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
differences = []
expected_diff = '@@ -8,8 +8,8 @@\n   type layout id=02 entryCount=1\n     resource 0x7f020000 layout/main\n       () (file) res/layout..._version\n-      () "a519b310bcfab08227888424a412e4b2e781e1da"\n+      () "3bd5987b1d0faebbdd76745afdbe992dcb331c73"\n'
    def check_arsc_differences(differences, expected_diff):
>       assert differences[0].source1 == "aapt2 dump resources {}"
E       IndexError: list index out of range
differences = []
expected_diff = ('@@ -8,8 +8,8 @@\n'
 '   type layout id=02 entryCount=1\n'
 '     resource 0x7f020000 layout/main\n'
 '       () (file) res/layout/main.xml type=XML\n'
 '   type string id=03 entryCount=2\n'
 '     resource 0x7f030000 string/app_name\n'
 '       () "Sokoban(g)"\n'
 '     resource 0x7f030001 string/private_version\n'
 '-      () "a519b310bcfab08227888424a412e4b2e781e1da"\n'
 '+      () "3bd5987b1d0faebbdd76745afdbe992dcb331c73"\n')
tests/comparators/test_arsc.py:49: IndexError
__________________________ test_javap_14_differences ___________________________
differences = []
    @skip_unless_tools_exist("enjarify", "zipinfo", "javap", "dexdump", "procyon")
    @skip_unless_tool_is_at_least("javap", javap_version, "14.0")
    @skip_unless_tool_is_at_least("enjarify", enjarify_version, "1.0.3")
    def test_javap_14_differences(differences):
        expected_diff = get_data("dex_javap_14_expected_diffs")
>       check_dex_differences(differences, expected_diff)
differences = []
expected_diff = ('@@ -1,12 +1,12 @@\n'
 " DEX version '035'\n"
 ' DEX file header:\n'
 " magic               : 'dex\\n035\\0'\n"
 '-checksum            : f9ec2d16\n'
 '-signature           : dd2a...febb\n'
 '+checksum            : 15e82cf9\n'
 '+signature           : 4c3c...b46d\n'
 ' file_size           : 2116\n'
 ' header_size         : 112\n'
 ' link_size           : 0\n'
 ' link_off            : 0 (0x000000)\n'
 ' string_ids_size     : 40\n'
 ' string_ids_off      : 112 (0x000070)\n'
 ' type_ids_size       : 17\n'
 '@@ -112,15 +112,15 @@\n'
 '       ins           : 2\n'
 '       outs          : 2\n'
 '       insns size    : 11 16-bit code units\n'
 ' 000340:                                        |[000340] '
 'com.example.MainActivity.onCreate:(Landroid/os/Bundle;)V\n'
 ' 000350: 6f20 0100 3200                         |0000: invoke-super {v2, '
 'v3}, Landroid/app/Activity;.onCreate:(Landroid/os/Bundle;)V // method@0001\n'
 ' 000356: 1501 037f                              |0003: const/high16 v1, #int '
 '2130903040 // #7f03\n'
 ' 00035a: 6e20 0500 1200                         |0005: invoke-virtual {v2, '
 'v1}, Lcom/example/MainActivity;.setContentView:(I)V // method@0005\n'
 '-000360: 1a00 1400                              |0008: const-string v0, "Sat '
 'Nov 21 14:20:33 CET 2015" // string@0014\n'
 '+000360: 1a00 1400                              |0008: const-string v0, "Thu '
 'Mar 17 11:54:42 CET 2016" // string@0014\n'
 ' 000364: 0e00                                   |000a: return-void\n'
 '       catches       : (none)\n'
 '       positions     : \n'
 '         0x0000 line=12\n'
 '         0x0003 line=13\n'
 '         0x0008 line=14\n'
 '         0x000a line=15\n'
 '@@ -54,15 +54,15 @@\n'
 '   version of encoding software:                   2.0\n'
 '   minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT\n'
 '   minimum software version required to extract:   2.0\n'
 '   compression method:                             none (stored)\n'
 '   file security status:                           not encrypted\n'
 '   extended local header:                          no\n'
 '   file last modified on (DOS date/time):          1980 Jan 1 00:00:00\n'
 '-  32-bit CRC value (hex):                         bc28236e\n'
 '+  32-bit CRC value (hex):                         59c3af78\n'
 '   compressed size:                                305 bytes\n'
 '   uncompressed size:                              305 bytes\n'
 '   length of filename:                             30 characters\n'
 '   length of extra field:                          0 bytes\n'
 '   length of file comment:                         0 characters\n'
 '   disk number on which file begins:               disk 1\n'
 '   apparent file type:                             binary\n'
 '@@ -1,8 +1,8 @@\n'
 '-  SHA-256 checksum '
 'ca6bb78f123647bf5fe7d869a959a63d0ef869fb1044e4271bb61b61fe30a69e\n'
 '+  SHA-256 checksum '
 'eeb197e12d3a700cdaad1ba86cd87b18c1e83106749ce96facc5adefbf501a44\n'
 ' public class com.example.MainActivity extends android.app.Activity\n'
 '   minor version: 0\n'
 '   major version: 49\n'
 '   flags: (0x0021) ACC_PUBLIC, ACC_SUPER\n'
 '   this_class: #2                          // com/example/MainActivity\n'
 '   super_class: #4                         // android/app/Activity\n'
 '   interfaces: 0, fields: 0, methods: 2, attributes: 0\n'
 '@@ -21,16 +21,16 @@\n'
 '   #12 = Methodref          #4.#11         // '
 'android/app/Activity.onCreate:(Landroid/os/Bundle;)V\n'
 '   #13 = Integer            2130903040\n'
 '   #14 = Float              1.7412887E38f\n'
 '   #15 = Utf8               setContentView\n'
 '   #16 = Utf8               (I)V\n'
 '   #17 = NameAndType        #15:#16        // setContentView:(I)V\n'
 '   #18 = Methodref          #2.#17         // '
 'com/example/MainActivity.setContentView:(I)V\n'
 '-  #19 = Utf8               Sat Nov 21 14:20:33 CET 2015\n'
 '-  #20 = String             #19            // Sat Nov 21 14:20:33 CET 2015\n'
 '+  #19 = Utf8               Thu Mar 17 11:54:42 CET 2016\n'
 '+  #20 = String             #19            // Thu Mar 17 11:54:42 CET 2016\n'
 '   #21 = Utf8               Code\n'
 ' {\n'
 '   public com.example.MainActivity();\n'
 '     descriptor: ()V\n'
 '     flags: (0x0001) ACC_PUBLIC\n'
 '     Code:\n'
 '       stack=300, locals=1, args_size=1\n')
tests/comparators/test_dex.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
differences = []
expected_diff = "@@ -1,12 +1,12 @@\n DEX version '035'\n DEX file header:\n magic               : 'dex\\n035\\0'\n-checksum           ...ivity();\n     descriptor: ()V\n     flags: (0x0001) ACC_PUBLIC\n     Code:\n       stack=300, locals=1, args_size=1\n"
    def check_dex_differences(differences, expected_diff):
>       assert differences[0].source1 == "dexdump -a -d -f -h {}"
E       IndexError: list index out of range
differences = []
expected_diff = ('@@ -1,12 +1,12 @@\n'
 " DEX version '035'\n"
 ' DEX file header:\n'
 " magic               : 'dex\\n035\\0'\n"
 '-checksum            : f9ec2d16\n'
 '-signature           : dd2a...febb\n'
 '+checksum            : 15e82cf9\n'
 '+signature           : 4c3c...b46d\n'
 ' file_size           : 2116\n'
 ' header_size         : 112\n'
 ' link_size           : 0\n'
 ' link_off            : 0 (0x000000)\n'
 ' string_ids_size     : 40\n'
 ' string_ids_off      : 112 (0x000070)\n'
 ' type_ids_size       : 17\n'
 '@@ -112,15 +112,15 @@\n'
 '       ins           : 2\n'
 '       outs          : 2\n'
 '       insns size    : 11 16-bit code units\n'
 ' 000340:                                        |[000340] '
 'com.example.MainActivity.onCreate:(Landroid/os/Bundle;)V\n'
 ' 000350: 6f20 0100 3200                         |0000: invoke-super {v2, '
 'v3}, Landroid/app/Activity;.onCreate:(Landroid/os/Bundle;)V // method@0001\n'
 ' 000356: 1501 037f                              |0003: const/high16 v1, #int '
 '2130903040 // #7f03\n'
 ' 00035a: 6e20 0500 1200                         |0005: invoke-virtual {v2, '
 'v1}, Lcom/example/MainActivity;.setContentView:(I)V // method@0005\n'
 '-000360: 1a00 1400                              |0008: const-string v0, "Sat '
 'Nov 21 14:20:33 CET 2015" // string@0014\n'
 '+000360: 1a00 1400                              |0008: const-string v0, "Thu '
 'Mar 17 11:54:42 CET 2016" // string@0014\n'
 ' 000364: 0e00                                   |000a: return-void\n'
 '       catches       : (none)\n'
 '       positions     : \n'
 '         0x0000 line=12\n'
 '         0x0003 line=13\n'
 '         0x0008 line=14\n'
 '         0x000a line=15\n'
 '@@ -54,15 +54,15 @@\n'
 '   version of encoding software:                   2.0\n'
 '   minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT\n'
 '   minimum software version required to extract:   2.0\n'
 '   compression method:                             none (stored)\n'
 '   file security status:                           not encrypted\n'
 '   extended local header:                          no\n'
 '   file last modified on (DOS date/time):          1980 Jan 1 00:00:00\n'
 '-  32-bit CRC value (hex):                         bc28236e\n'
 '+  32-bit CRC value (hex):                         59c3af78\n'
 '   compressed size:                                305 bytes\n'
 '   uncompressed size:                              305 bytes\n'
 '   length of filename:                             30 characters\n'
 '   length of extra field:                          0 bytes\n'
 '   length of file comment:                         0 characters\n'
 '   disk number on which file begins:               disk 1\n'
 '   apparent file type:                             binary\n'
 '@@ -1,8 +1,8 @@\n'
 '-  SHA-256 checksum '
 'ca6bb78f123647bf5fe7d869a959a63d0ef869fb1044e4271bb61b61fe30a69e\n'
 '+  SHA-256 checksum '
 'eeb197e12d3a700cdaad1ba86cd87b18c1e83106749ce96facc5adefbf501a44\n'
 ' public class com.example.MainActivity extends android.app.Activity\n'
 '   minor version: 0\n'
 '   major version: 49\n'
 '   flags: (0x0021) ACC_PUBLIC, ACC_SUPER\n'
 '   this_class: #2                          // com/example/MainActivity\n'
 '   super_class: #4                         // android/app/Activity\n'
 '   interfaces: 0, fields: 0, methods: 2, attributes: 0\n'
 '@@ -21,16 +21,16 @@\n'
 '   #12 = Methodref          #4.#11         // '
 'android/app/Activity.onCreate:(Landroid/os/Bundle;)V\n'
 '   #13 = Integer            2130903040\n'
 '   #14 = Float              1.7412887E38f\n'
 '   #15 = Utf8               setContentView\n'
 '   #16 = Utf8               (I)V\n'
 '   #17 = NameAndType        #15:#16        // setContentView:(I)V\n'
 '   #18 = Methodref          #2.#17         // '
 'com/example/MainActivity.setContentView:(I)V\n'
 '-  #19 = Utf8               Sat Nov 21 14:20:33 CET 2015\n'
 '-  #20 = String             #19            // Sat Nov 21 14:20:33 CET 2015\n'
 '+  #19 = Utf8               Thu Mar 17 11:54:42 CET 2016\n'
 '+  #20 = String             #19            // Thu Mar 17 11:54:42 CET 2016\n'
 '   #21 = Utf8               Code\n'
 ' {\n'
 '   public com.example.MainActivity();\n'
 '     descriptor: ()V\n'
 '     flags: (0x0001) ACC_PUBLIC\n'
 '     Code:\n'
 '       stack=300, locals=1, args_size=1\n')
tests/comparators/test_dex.py:71: IndexError
__________________________ test_compare_non_existing ___________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f613ff3d110>
dex1 = <<class 'abc.DexFile'> /builds/mattia/diffoscope/tests/data/test1.dex>
    @skip_unless_tools_exist("enjarify", "zipinfo", "javap")
    def test_compare_non_existing(monkeypatch, dex1):
        monkeypatch.setattr(Config(), "new_file", True)
        difference = dex1.compare(MissingFile("/nonexisting", dex1))
        assert difference.source2 == "/nonexisting"
>       assert difference.details[-1].source2 == "/dev/null"
E       IndexError: list index out of range
dex1       = <<class 'abc.DexFile'> /builds/mattia/diffoscope/tests/data/test1.dex>
difference = <Difference /builds/mattia/diffoscope/tests/data/test1.dex -- /nonexisting []>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f613ff3d110>
tests/comparators/test_dex.py:110: IndexError

This should be investigated and the tests re-anabled.

Related: #237.

Edited by FC (Fay) Stegerman
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information