fix android liblinphone tester
This commit is contained in:
parent
b87e741f53
commit
269d62c8d1
8 changed files with 42 additions and 15 deletions
9
Makefile
9
Makefile
|
@ -268,11 +268,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
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
@ -23,7 +23,7 @@ public class LogsActivity extends Activity {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
String path = mLogsActivity.getFilesDir().getAbsolutePath();
|
||||
String path = mLogsActivity.getFilesDir().getAbsolutePath()+"/config_files";
|
||||
tester = new TesterLogger(mLogsActivity);
|
||||
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path}));
|
||||
list.addAll(Arrays.asList(mArgs));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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<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()]);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Tester {
|
|||
|
||||
LinphoneCoreFactory.instance();
|
||||
|
||||
System.loadLibrary("cunit");
|
||||
System.loadLibrary("cunit");
|
||||
String eabi = "armeabi";
|
||||
if (Version.isX86()) {
|
||||
eabi = "x86";
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d37b480eb8219d64306a8d16ca1c581a946f18e
|
||||
Subproject commit 50da78666027cd8a201ffc6a1f8c2964af7d11aa
|
|
@ -1 +1 @@
|
|||
Subproject commit 0138897ef049fbf124b9a324592877bfe47349b2
|
||||
Subproject commit 41b76330c857f0e7b6d9c23bfe18377f49427246
|
Loading…
Reference in a new issue