Merge branch 'fix-android-10' into 'master'
fix emulator tests on android-10 We have to work harder to get writeable dirs in the android-10 emulator, that seems to be the old issue on android-10. See merge request !390
This commit is contained in:
commit
b5b5dd4ede
@ -46,7 +46,6 @@ connected10:
|
|||||||
# this file changes every time but should not be cached
|
# this file changes every time but should not be cached
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
||||||
- exit $EXITVALUE
|
- exit $EXITVALUE
|
||||||
allow_failure: true # remove once install segfaults are gone
|
|
||||||
|
|
||||||
connected24:
|
connected24:
|
||||||
variables:
|
variables:
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package org.fdroid.fdroid;
|
package org.fdroid.fdroid;
|
||||||
|
|
||||||
|
import android.app.Instrumentation;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.fdroid.fdroid.compat.FileCompatTest;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@ -19,7 +22,8 @@ public class CleanCacheServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClearOldFiles() throws IOException, InterruptedException {
|
public void testClearOldFiles() throws IOException, InterruptedException {
|
||||||
File tempDir = new File(System.getProperty("java.io.tmpdir"));
|
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||||
|
File tempDir = FileCompatTest.getWriteableDir(instrumentation);
|
||||||
assertTrue(tempDir.isDirectory());
|
assertTrue(tempDir.isDirectory());
|
||||||
assertTrue(tempDir.canWrite());
|
assertTrue(tempDir.canWrite());
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class FileCompatTest {
|
|||||||
* Prefer internal over external storage, because external tends to be FAT filesystems,
|
* Prefer internal over external storage, because external tends to be FAT filesystems,
|
||||||
* which don't support symlinks (which we test using this method).
|
* which don't support symlinks (which we test using this method).
|
||||||
*/
|
*/
|
||||||
private static File getWriteableDir(Instrumentation instrumentation) {
|
public static File getWriteableDir(Instrumentation instrumentation) {
|
||||||
Context context = instrumentation.getContext();
|
Context context = instrumentation.getContext();
|
||||||
Context targetContext = instrumentation.getTargetContext();
|
Context targetContext = instrumentation.getTargetContext();
|
||||||
|
|
||||||
|
@ -25,15 +25,13 @@ import android.support.test.InstrumentationRegistry;
|
|||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.fdroid.fdroid.AssetUtils;
|
import org.fdroid.fdroid.AssetUtils;
|
||||||
|
import org.fdroid.fdroid.compat.FileCompatTest;
|
||||||
import org.fdroid.fdroid.data.Apk;
|
import org.fdroid.fdroid.data.Apk;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TemporaryFolder;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
@ -59,18 +57,12 @@ public class ApkVerifierTest {
|
|||||||
File sdk14Apk;
|
File sdk14Apk;
|
||||||
File minMaxApk;
|
File minMaxApk;
|
||||||
|
|
||||||
@Rule
|
|
||||||
public TemporaryFolder tempFolder = new TemporaryFolder();
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
instrumentation = InstrumentationRegistry.getInstrumentation();
|
instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||||
File dir = null;
|
File dir = FileCompatTest.getWriteableDir(instrumentation);
|
||||||
try {
|
assertTrue(dir.isDirectory());
|
||||||
dir = tempFolder.newFolder("apks");
|
assertTrue(dir.canWrite());
|
||||||
} catch (IOException e) {
|
|
||||||
fail(e.getMessage());
|
|
||||||
}
|
|
||||||
sdk14Apk = AssetUtils.copyAssetToDir(instrumentation.getContext(),
|
sdk14Apk = AssetUtils.copyAssetToDir(instrumentation.getContext(),
|
||||||
"org.fdroid.permissions.sdk14.apk",
|
"org.fdroid.permissions.sdk14.apk",
|
||||||
dir
|
dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user