mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-21 01:07:34 +01:00
clear /apktool/framework/1.apk in between tests
This commit is contained in:
parent
d05dc3296a
commit
8689991626
@ -677,7 +677,7 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getFrameworkDir() throws AndrolibException {
|
public File getFrameworkDir() throws AndrolibException {
|
||||||
if (mFrameworkDirectory != null) {
|
if (mFrameworkDirectory != null) {
|
||||||
return mFrameworkDirectory;
|
return mFrameworkDirectory;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ public class AndResGuardTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception, BrutException {
|
public static void beforeClass() throws Exception, BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue1170/", sTmpDir);
|
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue1170/", sTmpDir);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ public class BuildAndDecodeJarTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception, BrutException {
|
public static void beforeClass() throws Exception, BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
sTestOrigDir = new ExtFile(sTmpDir, "testjar-orig");
|
sTestOrigDir = new ExtFile(sTmpDir, "testjar-orig");
|
||||||
sTestNewDir = new ExtFile(sTmpDir, "testjar-new");
|
sTestNewDir = new ExtFile(sTmpDir, "testjar-new");
|
||||||
|
@ -41,6 +41,8 @@ public class BuildAndDecodeTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception, BrutException {
|
public static void beforeClass() throws Exception, BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
|
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
sTestOrigDir = new ExtFile(sTmpDir, "testapp-orig");
|
sTestOrigDir = new ExtFile(sTmpDir, "testapp-orig");
|
||||||
sTestNewDir = new ExtFile(sTmpDir, "testapp-new");
|
sTestNewDir = new ExtFile(sTmpDir, "testapp-new");
|
||||||
|
@ -36,6 +36,7 @@ public class LargeIntsInManifestTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception, BrutException {
|
public static void beforeClass() throws Exception, BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue767/", sTmpDir);
|
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue767/", sTmpDir);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ public class ProviderAttributeTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws BrutException {
|
public static void beforeClass() throws BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
TestUtils.copyResourceDir(ProviderAttributeTest.class, "brut/apktool/issue636/", sTmpDir);
|
TestUtils.copyResourceDir(ProviderAttributeTest.class, "brut/apktool/issue636/", sTmpDir);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public class SharedLibraryTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws BrutException {
|
public static void beforeClass() throws BrutException {
|
||||||
|
TestUtils.cleanFrameworkFile();
|
||||||
sTmpDir = new ExtFile(OS.createTempDirectory());
|
sTmpDir = new ExtFile(OS.createTempDirectory());
|
||||||
TestUtils.copyResourceDir(SharedLibraryTest.class, "brut/apktool/shared_libraries/", sTmpDir);
|
TestUtils.copyResourceDir(SharedLibraryTest.class, "brut/apktool/shared_libraries/", sTmpDir);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ import java.net.URLDecoder;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import brut.util.OS;
|
||||||
import org.custommonkey.xmlunit.ElementQualifier;
|
import org.custommonkey.xmlunit.ElementQualifier;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.xmlpull.v1.*;
|
import org.xmlpull.v1.*;
|
||||||
@ -116,6 +118,30 @@ public abstract class TestUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws AndrolibException
|
||||||
|
* @throws BrutException
|
||||||
|
*/
|
||||||
|
public static void cleanFrameworkFile() throws AndrolibException, BrutException {
|
||||||
|
File framework = new File(getFrameworkDir(), "1.apk");
|
||||||
|
|
||||||
|
if (Files.exists(framework.toPath())) {
|
||||||
|
OS.rmfile(framework.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return File
|
||||||
|
* @throws AndrolibException
|
||||||
|
*/
|
||||||
|
public static File getFrameworkDir() throws AndrolibException {
|
||||||
|
AndrolibResources androlibResources = new AndrolibResources();
|
||||||
|
androlibResources.apkOptions = new ApkOptions();
|
||||||
|
return androlibResources.getFrameworkDir();
|
||||||
|
}
|
||||||
|
|
||||||
public static class ResValueElementQualifier implements ElementQualifier {
|
public static class ResValueElementQualifier implements ElementQualifier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user