From cb3ada02f3f2f3d4f920144c3f640e5eaf38408e Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Mon, 22 May 2023 07:00:53 -0400 Subject: [PATCH] test: add assertions for unknown files / assets --- .../test/java/brut/androlib/aapt2/BuildAndDecodeTest.java | 5 +++++ .../apktool-lib/src/test/resources/aapt1/testapp/apktool.yml | 4 +++- .../resources/aapt1/testapp/unknown/AssetBundle/assets/a.txt | 1 + .../test/resources/aapt1/testapp/unknown/AssetBundle/b.txt | 1 + .../apktool-lib/src/test/resources/aapt2/testapp/apktool.yml | 5 ++++- .../resources/aapt2/testapp/unknown/AssetBundle/assets/a.txt | 1 + .../test/resources/aapt2/testapp/unknown/AssetBundle/b.txt | 1 + 7 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/assets/a.txt create mode 100644 brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/b.txt create mode 100644 brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/assets/a.txt create mode 100644 brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/b.txt diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java index 97c98290ca..248452fc8e 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java @@ -141,4 +141,9 @@ public void singleDexTest() throws BrutException, IOException { File classesDex = new File(sTestOrigDir, "build/apk/classes.dex"); assertTrue(classesDex.isFile()); } + + @Test + public void unknownFolderTest() throws BrutException { + compareUnknownFiles(); + } } diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/apktool.yml b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/apktool.yml index 48ec1795bf..8362ef054a 100644 --- a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/apktool.yml +++ b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/apktool.yml @@ -16,8 +16,10 @@ doNotCompress: - png - mp3 unknownFiles: + AssetBundle/assets/a.txt: '8' + AssetBundle/b.txt: '8' hidden.file: '8' non\u007Fprintable.file: '8' stored.file: '0' unk_folder/unknown_file: '8' - lib_bug603/bug603: '8' \ No newline at end of file + lib_bug603/bug603: '8' diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/assets/a.txt b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/assets/a.txt new file mode 100644 index 0000000000..2572152407 --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/assets/a.txt @@ -0,0 +1 @@ +issue-3038 diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/b.txt b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/b.txt new file mode 100644 index 0000000000..2572152407 --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/unknown/AssetBundle/b.txt @@ -0,0 +1 @@ +issue-3038 diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/apktool.yml b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/apktool.yml index 969b21327b..e83d2e54c2 100644 --- a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/apktool.yml +++ b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/apktool.yml @@ -12,4 +12,7 @@ versionInfo: compressionType: false doNotCompress: - assets/0byte_file.jpg -sparseResources: false \ No newline at end of file +sparseResources: false +unknownFiles: + AssetBundle/assets/a.txt: '8' + AssetBundle/b.txt: '8' diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/assets/a.txt b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/assets/a.txt new file mode 100644 index 0000000000..2572152407 --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/assets/a.txt @@ -0,0 +1 @@ +issue-3038 diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/b.txt b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/b.txt new file mode 100644 index 0000000000..2572152407 --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/unknown/AssetBundle/b.txt @@ -0,0 +1 @@ +issue-3038