diff --git a/Makefile b/Makefile index df050505f..4b2cec29c 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ update-project: $(SDK_PATH)/android update project --path . --target $(ANDROID_MOST_RECENT_TARGET) liblinphone_tester: prepare-sources prepare-cunit prepare-liblinphone_tester - $(NDK_PATH)/ndk-build -C liblinphone_tester NDK_DEBUG=1 $(LIBLINPHONE_OPTIONS) -j$(NUMCPUS) + $(NDK_PATH)/ndk-build -C liblinphone_tester $(LIBLINPHONE_OPTIONS) NDK_DEBUG=1 -j$(NUMCPUS) generate-apk: ant partial-clean diff --git a/liblinphone_tester/.classpath b/liblinphone_tester/.classpath index b1cedc69e..ecf4445b1 100644 --- a/liblinphone_tester/.classpath +++ b/liblinphone_tester/.classpath @@ -3,7 +3,7 @@ - + diff --git a/liblinphone_tester/.project b/liblinphone_tester/.project index 15cf6a0c3..3b3e60d9e 100644 --- a/liblinphone_tester/.project +++ b/liblinphone_tester/.project @@ -34,7 +34,7 @@ mediastreamer2 2 - /Users/ydiorcet/Desktop/linphone-android/submodules/linphone/mediastreamer2/java/src + PARENT-1-PROJECT_LOCATION/submodules/linphone/mediastreamer2/java/src diff --git a/liblinphone_tester/AndroidManifest.xml b/liblinphone_tester/AndroidManifest.xml index 91848ce78..298566cbe 100644 --- a/liblinphone_tester/AndroidManifest.xml +++ b/liblinphone_tester/AndroidManifest.xml @@ -7,8 +7,13 @@ + + + @@ -41,6 +46,8 @@ android:screenOrientation="nosensor" android:launchMode="singleTask"> + + + - \ No newline at end of file diff --git a/liblinphone_tester/build.xml b/liblinphone_tester/build.xml new file mode 100644 index 000000000..4eb05f07c --- /dev/null +++ b/liblinphone_tester/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/liblinphone_tester/custom_rules.xml b/liblinphone_tester/custom_rules.xml new file mode 100644 index 000000000..82a79275d --- /dev/null +++ b/liblinphone_tester/custom_rules.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/liblinphone_tester/src/org/linphone/tester/LogsActivity.java b/liblinphone_tester/src/org/linphone/tester/LogsActivity.java index 0a8e6120d..af5c75427 100644 --- a/liblinphone_tester/src/org/linphone/tester/LogsActivity.java +++ b/liblinphone_tester/src/org/linphone/tester/LogsActivity.java @@ -37,6 +37,17 @@ public class LogsActivity extends Activity { } } + private static String join(String [] array, String separator) { + String ret = ""; + for(int i = 0; i < array.length; ++i) { + if(i != 0) { + ret += separator; + } + ret += array[i]; + } + return ret; + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -47,6 +58,7 @@ public class LogsActivity extends Activity { String[] values = extras.getStringArray("args"); if(values != null) { if(mLogsThread == null || !mLogsThread.isAlive()) { + this.setTitle("Test Logs (" + join(values, " ") + ")"); mLogs = ""; ((TextView)findViewById(R.id.textView1)).setText(mLogs); mLogsThread = new LogsThread(this, values); diff --git a/liblinphone_tester/src/org/linphone/tester/MainActivity.java b/liblinphone_tester/src/org/linphone/tester/MainActivity.java index baa576783..da1aa5bc8 100644 --- a/liblinphone_tester/src/org/linphone/tester/MainActivity.java +++ b/liblinphone_tester/src/org/linphone/tester/MainActivity.java @@ -13,7 +13,6 @@ import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; public class MainActivity extends Activity { diff --git a/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java b/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java index 975d85813..ffaa91bd7 100644 --- a/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java +++ b/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java @@ -19,6 +19,7 @@ public class SuitesActivity extends Activity { if (extras != null) { mSuite = extras.getString("suite"); if(mSuite != null) { + this.setTitle(this.getResources().getString(R.string.app_name) + " | " + mSuite); TesterList suitesTest = new TesterList(); suitesTest.run(new String[]{"tester", "--list-tests", mSuite}); LinearLayout layout = ((LinearLayout)findViewById(R.id.tests_list)); diff --git a/liblinphone_tester/src/org/linphone/tester/TestRunner.java b/liblinphone_tester/src/org/linphone/tester/TestRunner.java new file mode 100644 index 000000000..ab928c6b1 --- /dev/null +++ b/liblinphone_tester/src/org/linphone/tester/TestRunner.java @@ -0,0 +1,47 @@ +package org.linphone.tester; + +import junit.framework.TestSuite; +import android.os.Bundle; +import android.test.InstrumentationTestRunner; + + +public class TestRunner extends InstrumentationTestRunner { + String mSuite = null; + String mTest = null; + + @Override + public void onCreate(Bundle arguments) { + mSuite = arguments.getString("suite"); + mTest = arguments.getString("test"); + super.onCreate(arguments); + } + + @Override + public TestSuite getAllTests () { + TestSuite suite = new TestSuite("Tests"); + addSuites(suite, mSuite, mTest); + return suite; + } + + + public static void addSuites(TestSuite suite, String suiteCheck, String testCheck) { + TesterList testerList = new TesterList(); + testerList.run(new String[]{"tester", "--list-suites"}); + for(String str: testerList.getList()) { + str = str.trim(); + if(suiteCheck == null || suiteCheck.equals(str)) { + addSuite(suite, str, testCheck); + } + } + } + public static void addSuite(TestSuite suite, String suiteStr, String testCheck) { + TesterList testerList = new TesterList(); + testerList.run(new String[]{"tester", "--list-tests", suiteStr}); + for(String str: testerList.getList()) { + str = str.trim(); + if(testCheck == null || testCheck.equals(str)) { + suite.addTest(new TestUnit(suiteStr, str)); + } + } + } +} diff --git a/liblinphone_tester/src/org/linphone/tester/TestUnit.java b/liblinphone_tester/src/org/linphone/tester/TestUnit.java new file mode 100644 index 000000000..46e959c89 --- /dev/null +++ b/liblinphone_tester/src/org/linphone/tester/TestUnit.java @@ -0,0 +1,38 @@ +package org.linphone.tester; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import junit.framework.Assert; +import android.test.AndroidTestCase; + +public class TestUnit extends AndroidTestCase { + private String mSuite; + private String mTest; + + public TestUnit(String suite, String test) { + mSuite = suite; + mTest = test; + setName(suite + "/" + test); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + @Override + protected void runTest() { + String path = getContext().getFilesDir().getAbsolutePath(); + Tester tester = new Tester(); + List list = new LinkedList(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest})); + String[] array = list.toArray(new String[list.size()]); + Assert.assertTrue(tester.run(array) == 0); + } +} \ No newline at end of file diff --git a/liblinphone_tester/src/org/linphone/tester/Tester.java b/liblinphone_tester/src/org/linphone/tester/Tester.java index a8e317419..5a2941e6a 100644 --- a/liblinphone_tester/src/org/linphone/tester/Tester.java +++ b/liblinphone_tester/src/org/linphone/tester/Tester.java @@ -28,7 +28,7 @@ public class Tester { return System.getProperty("os.arch").contains("armv7"); } - static { + static { // FFMPEG (audio/video) loadOptionalLibrary("avutil"); loadOptionalLibrary("swscale"); diff --git a/submodules/linphone b/submodules/linphone index 8d9cb2fd7..10a18463d 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 8d9cb2fd7d171fcea0b537af44d4e8449b66aa23 +Subproject commit 10a18463d51c68e436267fe6154f1216b0351918