Merge commit '269d62c'

This commit is contained in:
Jehan Monnier 2013-12-02 17:09:40 +01:00
commit 74c4e6f4ba
8 changed files with 42 additions and 15 deletions

View file

@ -270,11 +270,14 @@ prepare-cunit: $(TOPDIR)/submodules/externals/cunit/CUnit/Headers/*.h
$(TOPDIR)/res/raw/rootca.pem: $(TOPDIR)/res/raw/rootca.pem:
HTTPS_CA_DIR=$(HTTPS_CA_DIR) $(TOPDIR)/submodules/linphone/scripts/mk-ca-bundle.pl $@ HTTPS_CA_DIR=$(HTTPS_CA_DIR) $(TOPDIR)/submodules/linphone/scripts/mk-ca-bundle.pl $@
prepare-liblinphone_tester: $(TOPDIR)/submodules/linphone/tester/*_lrc $(TOPDIR)/submodules/linphone/tester/*_rc $(TOPDIR)/submodules/linphone/tester/tester_hosts $(TOPDIR)/submodules/linphone/tester/certificates/* $(TOPDIR)/res/raw/rootca.pem prepare-liblinphone_tester: $(TOPDIR)/submodules/linphone/tester/*_lrc $(TOPDIR)/submodules/linphone/tester/*_rc $(TOPDIR)/submodules/linphone/tester/tester_hosts $(TOPDIR)/res/raw/rootca.pem
mkdir -p liblinphone_tester/assets/rc_files rm -rf liblinphone_tester/assets/config_files
mkdir -p liblinphone_tester/assets/config_files
for file in $^; do \ for file in $^; do \
cp -f $$file $(TOPDIR)/liblinphone_tester/assets/rc_files/. \ cp -rf $$file $(TOPDIR)/liblinphone_tester/assets/config_files/. \
;done ;done
cp -rf $(TOPDIR)/submodules/linphone/tester/certificates $(TOPDIR)/liblinphone_tester/assets/config_files
#SQLite3 #SQLite3
SQLITE_SRC_DIR=$(TOPDIR)/submodules/externals/sqlite3 SQLITE_SRC_DIR=$(TOPDIR)/submodules/externals/sqlite3

View file

@ -16,6 +16,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application <application
android:allowBackup="true" android:allowBackup="true"

View file

@ -23,7 +23,7 @@ public class LogsActivity extends Activity {
@Override @Override
public void run() { public void run() {
String path = mLogsActivity.getFilesDir().getAbsolutePath(); String path = mLogsActivity.getFilesDir().getAbsolutePath()+"/config_files";
tester = new TesterLogger(mLogsActivity); tester = new TesterLogger(mLogsActivity);
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path})); List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path}));
list.addAll(Arrays.asList(mArgs)); list.addAll(Arrays.asList(mArgs));

View file

@ -10,6 +10,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.Menu; import android.view.Menu;
import android.view.View; import android.view.View;
@ -23,7 +24,11 @@ public class MainActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
try {
TestUnit.copyAssetsFromPackage(getApplicationContext());
} catch (IOException e) {
Log.e("liblinphone_tester", "Cannot install rc files",e);
}
TesterList suitesTest = new TesterList(); TesterList suitesTest = new TesterList();
suitesTest.run(new String[]{"tester", "--list-suites"}); suitesTest.run(new String[]{"tester", "--list-suites"});
LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list)); LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));

View file

@ -22,11 +22,29 @@ public class TestUnit extends AndroidTestCase {
mTest = test; mTest = test;
setName(suite + "/" + test); setName(suite + "/" + test);
} }
private void copyAssetsFromPackage() throws IOException {
Context ctx= getContext(); static public void copyAssetsFromPackage(Context ctx) throws IOException {
for (String file :ctx.getAssets().list("rc_files")) { copyAssetsFromPackage(ctx,"config_files");
FileOutputStream lOutputStream = ctx.openFileOutput (new File(file).getName(), 0); }
InputStream lInputStream = ctx.getAssets().open("rc_files/"+file);
public static void copyAssetsFromPackage(Context ctx,String fromPath) throws IOException {
new File(ctx.getFilesDir().getPath()+"/"+fromPath).mkdir();
for (String f :ctx.getAssets().list(fromPath)) {
String current_name=fromPath+"/"+f;
InputStream lInputStream;
try {
lInputStream = ctx.getAssets().open(current_name);
} catch (IOException e) {
//probably a dir
new File(ctx.getFilesDir().getPath()+"/"+current_name).mkdir();
copyAssetsFromPackage(ctx,current_name);
continue;
}
FileOutputStream lOutputStream = new FileOutputStream(new File(ctx.getFilesDir().getPath()+"/"+current_name));//ctx.openFileOutput (fromPath+"/"+f, 0);
int readByte; int readByte;
byte[] buff = new byte[8048]; byte[] buff = new byte[8048];
while (( readByte = lInputStream.read(buff)) != -1) { while (( readByte = lInputStream.read(buff)) != -1) {
@ -41,7 +59,7 @@ public class TestUnit extends AndroidTestCase {
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
if (isAssetCopied ==false) { if (isAssetCopied ==false) {
copyAssetsFromPackage(); copyAssetsFromPackage(getContext());
isAssetCopied=true; isAssetCopied=true;
} }
} }
@ -53,7 +71,7 @@ public class TestUnit extends AndroidTestCase {
@Override @Override
protected void runTest() { protected void runTest() {
String path = getContext().getFilesDir().getPath(); String path = getContext().getFilesDir().getPath()+"/config_files";
Tester tester = new Tester(); Tester tester = new Tester();
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest})); List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest}));
String[] array = list.toArray(new String[list.size()]); String[] array = list.toArray(new String[list.size()]);

View file

@ -26,7 +26,7 @@ public class Tester {
LinphoneCoreFactory.instance(); LinphoneCoreFactory.instance();
System.loadLibrary("cunit"); System.loadLibrary("cunit");
String eabi = "armeabi"; String eabi = "armeabi";
if (Version.isX86()) { if (Version.isX86()) {
eabi = "x86"; eabi = "x86";

@ -1 +1 @@
Subproject commit e319dc863b0a61dc86c8725f556792231d004a57 Subproject commit 50da78666027cd8a201ffc6a1f8c2964af7d11aa

@ -1 +1 @@
Subproject commit d7beb3193bd6da62cac7850686297b505222c0c2 Subproject commit 41b76330c857f0e7b6d9c23bfe18377f49427246