diff --git a/Makefile b/Makefile index 8b3b99e09..5781c5bbf 100644 --- a/Makefile +++ b/Makefile @@ -270,11 +270,14 @@ prepare-cunit: $(TOPDIR)/submodules/externals/cunit/CUnit/Headers/*.h $(TOPDIR)/res/raw/rootca.pem: 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 - mkdir -p liblinphone_tester/assets/rc_files +prepare-liblinphone_tester: $(TOPDIR)/submodules/linphone/tester/*_lrc $(TOPDIR)/submodules/linphone/tester/*_rc $(TOPDIR)/submodules/linphone/tester/tester_hosts $(TOPDIR)/res/raw/rootca.pem + rm -rf liblinphone_tester/assets/config_files + mkdir -p liblinphone_tester/assets/config_files for file in $^; do \ - cp -f $$file $(TOPDIR)/liblinphone_tester/assets/rc_files/. \ + cp -rf $$file $(TOPDIR)/liblinphone_tester/assets/config_files/. \ ;done + cp -rf $(TOPDIR)/submodules/linphone/tester/certificates $(TOPDIR)/liblinphone_tester/assets/config_files + #SQLite3 SQLITE_SRC_DIR=$(TOPDIR)/submodules/externals/sqlite3 diff --git a/liblinphone_tester/AndroidManifest.xml b/liblinphone_tester/AndroidManifest.xml index 298566cbe..0bf9ab62a 100644 --- a/liblinphone_tester/AndroidManifest.xml +++ b/liblinphone_tester/AndroidManifest.xml @@ -16,6 +16,7 @@ + list = new LinkedList(Arrays.asList(new String[]{"tester", "--verbose", "--config", path})); list.addAll(Arrays.asList(mArgs)); diff --git a/liblinphone_tester/src/org/linphone/tester/MainActivity.java b/liblinphone_tester/src/org/linphone/tester/MainActivity.java index b0502e59e..2d868eaf8 100644 --- a/liblinphone_tester/src/org/linphone/tester/MainActivity.java +++ b/liblinphone_tester/src/org/linphone/tester/MainActivity.java @@ -10,6 +10,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.AssetManager; +import android.util.Log; import android.view.Gravity; import android.view.Menu; import android.view.View; @@ -23,7 +24,11 @@ public class MainActivity extends Activity { super.onCreate(savedInstanceState); 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(); suitesTest.run(new String[]{"tester", "--list-suites"}); LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list)); diff --git a/liblinphone_tester/src/org/linphone/tester/TestUnit.java b/liblinphone_tester/src/org/linphone/tester/TestUnit.java index 0b5b7f10f..444ff10d2 100644 --- a/liblinphone_tester/src/org/linphone/tester/TestUnit.java +++ b/liblinphone_tester/src/org/linphone/tester/TestUnit.java @@ -22,11 +22,29 @@ public class TestUnit extends AndroidTestCase { mTest = test; setName(suite + "/" + test); } - private void copyAssetsFromPackage() throws IOException { - Context ctx= getContext(); - for (String file :ctx.getAssets().list("rc_files")) { - FileOutputStream lOutputStream = ctx.openFileOutput (new File(file).getName(), 0); - InputStream lInputStream = ctx.getAssets().open("rc_files/"+file); + + static public void copyAssetsFromPackage(Context ctx) throws IOException { + copyAssetsFromPackage(ctx,"config_files"); + } + + + 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; byte[] buff = new byte[8048]; while (( readByte = lInputStream.read(buff)) != -1) { @@ -41,7 +59,7 @@ public class TestUnit extends AndroidTestCase { protected void setUp() throws Exception { super.setUp(); if (isAssetCopied ==false) { - copyAssetsFromPackage(); + copyAssetsFromPackage(getContext()); isAssetCopied=true; } } @@ -53,7 +71,7 @@ public class TestUnit extends AndroidTestCase { @Override protected void runTest() { - String path = getContext().getFilesDir().getPath(); + String path = getContext().getFilesDir().getPath()+"/config_files"; 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()]); diff --git a/liblinphone_tester/src/org/linphone/tester/Tester.java b/liblinphone_tester/src/org/linphone/tester/Tester.java index e115ecfd4..83f1a5fb6 100644 --- a/liblinphone_tester/src/org/linphone/tester/Tester.java +++ b/liblinphone_tester/src/org/linphone/tester/Tester.java @@ -26,7 +26,7 @@ public class Tester { LinphoneCoreFactory.instance(); - System.loadLibrary("cunit"); + System.loadLibrary("cunit"); String eabi = "armeabi"; if (Version.isX86()) { eabi = "x86"; diff --git a/submodules/belle-sip b/submodules/belle-sip index e319dc863..50da78666 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit e319dc863b0a61dc86c8725f556792231d004a57 +Subproject commit 50da78666027cd8a201ffc6a1f8c2964af7d11aa diff --git a/submodules/linphone b/submodules/linphone index d7beb3193..41b76330c 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d7beb3193bd6da62cac7850686297b505222c0c2 +Subproject commit 41b76330c857f0e7b6d9c23bfe18377f49427246