clear /apktool/framework/1.apk in between tests

This commit is contained in:
Connor Tumbleson 2016-04-27 07:37:14 -04:00
parent d05dc3296a
commit 8689991626
8 changed files with 34 additions and 1 deletions

View File

@ -677,7 +677,7 @@ final public class AndrolibResources {
}
}
private File getFrameworkDir() throws AndrolibException {
public File getFrameworkDir() throws AndrolibException {
if (mFrameworkDirectory != null) {
return mFrameworkDirectory;
}

View File

@ -30,6 +30,7 @@ public class AndResGuardTest {
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue1170/", sTmpDir);
}

View File

@ -34,6 +34,7 @@ public class BuildAndDecodeJarTest {
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
sTestOrigDir = new ExtFile(sTmpDir, "testjar-orig");
sTestNewDir = new ExtFile(sTmpDir, "testjar-new");

View File

@ -41,6 +41,8 @@ public class BuildAndDecodeTest {
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
sTestOrigDir = new ExtFile(sTmpDir, "testapp-orig");
sTestNewDir = new ExtFile(sTmpDir, "testapp-new");

View File

@ -36,6 +36,7 @@ public class LargeIntsInManifestTest {
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue767/", sTmpDir);
}

View File

@ -36,6 +36,7 @@ public class ProviderAttributeTest {
@BeforeClass
public static void beforeClass() throws BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(ProviderAttributeTest.class, "brut/apktool/issue636/", sTmpDir);
}

View File

@ -35,6 +35,7 @@ public class SharedLibraryTest {
@BeforeClass
public static void beforeClass() throws BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(SharedLibraryTest.class, "brut/apktool/shared_libraries/", sTmpDir);
}

View File

@ -25,6 +25,8 @@ import java.net.URLDecoder;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
import brut.util.OS;
import org.custommonkey.xmlunit.ElementQualifier;
import org.w3c.dom.Element;
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 {
@Override