Skip to content

Commit b85f412

Browse files
Merge branch 'feature/optimize-travis' into develop
2 parents 4ac98f3 + 9758fa7 commit b85f412

File tree

20 files changed

+190
-44
lines changed

20 files changed

+190
-44
lines changed

.travis.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ android:
1111
- android-16
1212

1313
- sys-img-x86-android-16
14-
before_install:
15-
- echo no | android create avd -c 50M --force -n testx86 -t android-16 --abi x86
16-
- emulator -avd testx86 -no-skin -no-audio -no-window -gpu on &
17-
18-
before_script:
19-
# Make sure the emulator has started before running tests
20-
- android-wait-for-emulator
21-
- adb shell input keyevent 82 &
14+
- sys-img-armeabi-v7a-android-16
2215

2316
script:
24-
- ./gradlew --info build connectedAndroidTest
17+
- ./runTests.sh || exit 1
-28.1 KB
Binary file not shown.
-28.1 KB
Binary file not shown.

FFmpegAndroid/assets/x86/ffmpeg

-252 KB
Binary file not shown.

FFmpegAndroid/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.github.hiteshsondhi88.libffmpeg"
99
minSdkVersion 16
1010
targetSdkVersion 16
11-
versionCode 22
12-
versionName "0.2.2"
11+
versionCode 23
12+
versionName "0.2.3"
1313
}
1414

1515
sourceSets.main {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
import android.test.InstrumentationTestCase;
4+
5+
public class CommonInstrumentationTestCase extends InstrumentationTestCase {
6+
7+
@Override
8+
protected void setUp() throws Exception {
9+
super.setUp();
10+
Log.setDEBUG(true);
11+
}
12+
13+
}

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ public void testGetCpuArch() throws Exception {
2020
}
2121
}
2222

23-
2423
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
import android.content.res.AssetManager;
4+
import android.text.TextUtils;
5+
6+
import com.github.hiteshsondhi88.libffmpeg.utils.AssertionHelper;
7+
8+
import java.io.IOException;
9+
import java.io.InputStream;
10+
11+
import static org.assertj.core.api.Assertions.assertThat;
12+
13+
public class CpuArchTest extends CommonInstrumentationTestCase {
14+
15+
public void testFFmpegAssetsWithSha1Sum() {
16+
testFFmpegAsset(CpuArch.ARMv7, "armeabi-v7a/ffmpeg");
17+
testFFmpegAsset(CpuArch.ARMv7_NEON, "armeabi-v7a-neon/ffmpeg");
18+
testFFmpegAsset(CpuArch.x86, "x86/ffmpeg");
19+
}
20+
21+
private void testFFmpegAsset(CpuArch cpuArch, String assetsPath) {
22+
AssetManager assetMgr = getInstrumentation().getContext().getResources().getAssets();
23+
InputStream is = null;
24+
try {
25+
is = assetMgr.open(assetsPath);
26+
String assetSha1Sum = FileUtils.SHA1(is);
27+
assertThat(!TextUtils.isEmpty(cpuArch.getSha1())
28+
&& !TextUtils.isEmpty(assetSha1Sum)
29+
&& cpuArch.getSha1().equals(assetSha1Sum)).isTrue();
30+
} catch (IOException e) {
31+
Log.e(e);
32+
AssertionHelper.assertError("error validating ffmpeg asset "+assetsPath);
33+
} finally {
34+
Util.close(is);
35+
}
36+
37+
}
38+
39+
}

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/ShellCommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void run() {
4444

4545
public void testRunWaitFor() throws Exception {
4646
ShellCommand shellCommand = new ShellCommand();
47-
CommandResult commandResult = shellCommand.runWaitFor("ls /sdcard/");
47+
CommandResult commandResult = shellCommand.runWaitFor("ls");
4848
assertNotNull(commandResult);
4949
assertEquals(true, commandResult.success);
5050
assertThat(commandResult.output).isNotEmpty();
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
package com.github.hiteshsondhi88.libffmpeg;
22

3+
import android.text.TextUtils;
4+
35
enum CpuArch {
4-
x86, ARMv7, ARMv7_NEON, NONE
6+
x86("a0f523f4fce7e4a4b0ad1e86dfa5c3d54ac93b91"),
7+
ARMv7("6b9b3d574740d69fd50fd6d75e04c71ae3a95c72"),
8+
ARMv7_NEON("ac0418277061dc8b7547fee51e3e84457069806e"),
9+
NONE(null);
10+
11+
private String sha1;
12+
13+
CpuArch(String sha1) {
14+
this.sha1 = sha1;
15+
}
16+
17+
String getSha1(){
18+
return sha1;
19+
}
20+
21+
static CpuArch fromString(String sha1) {
22+
if (!TextUtils.isEmpty(sha1)) {
23+
for (CpuArch cpuArch : CpuArch.values()) {
24+
if (sha1.equalsIgnoreCase(cpuArch.sha1)) {
25+
return cpuArch;
26+
}
27+
}
28+
}
29+
return NONE;
30+
}
531
}

0 commit comments

Comments
 (0)