more test work
58
veilid-core/src/tests/android/mod.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
use crate::*;
|
||||
use backtrace::Backtrace;
|
||||
use jni::{
|
||||
objects::GlobalRef, objects::JClass, objects::JObject, objects::JString, JNIEnv, JavaVM,
|
||||
};
|
||||
use lazy_static::*;
|
||||
use std::panic;
|
||||
use tracing::*;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::*;
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(non_snake_case)]
|
||||
pub extern "system" fn Java_com_veilid_veilid_1core_1android_1tests_MainActivity_run_1tests(
|
||||
env: JNIEnv,
|
||||
_class: JClass,
|
||||
ctx: JObject,
|
||||
) {
|
||||
crate::intf::utils::android::veilid_core_setup_android_tests(env, ctx);
|
||||
run_all_tests();
|
||||
}
|
||||
|
||||
pub fn veilid_core_setup_android_tests(env: JNIEnv, ctx: JObject) {
|
||||
// Set up subscriber and layers
|
||||
use tracing_subscriber::{filter, fmt, prelude::*};
|
||||
let filter = VeilidLayerFilter::new(VeilidConfigLogLevel::Trace, None);
|
||||
let layer = tracing_android::layer("veilid-core").expect("failed to set up android logging");
|
||||
tracing_subscriber::registry()
|
||||
.with(filters)
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
|
||||
// Set up panic hook for backtraces
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
let bt = Backtrace::new();
|
||||
if let Some(location) = panic_info.location() {
|
||||
error!(
|
||||
"panic occurred in file '{}' at line {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
);
|
||||
} else {
|
||||
error!("panic occurred but can't get location information...");
|
||||
}
|
||||
if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(a) = panic_info.payload().downcast_ref::<std::fmt::Arguments>() {
|
||||
error!("panic payload: {:?}", a);
|
||||
} else {
|
||||
error!("no panic payload");
|
||||
}
|
||||
error!("Backtrace:\n{:?}", bt);
|
||||
}));
|
||||
|
||||
veilid_core_setup_android(env, ctx);
|
||||
}
|
@@ -60,10 +60,10 @@ dependencies {
|
||||
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
|
||||
|
||||
cargo {
|
||||
module = "../../../../"
|
||||
module = "../../../../../"
|
||||
libname = "veilid_core"
|
||||
targets = ["arm", "arm64", "x86", "x86_64"]
|
||||
targetDirectory = "../../../../../target"
|
||||
targetDirectory = "../../../../../../target"
|
||||
prebuiltToolchains = true
|
||||
profile = gradle.startParameter.taskNames.any{it.toLowerCase().contains("debug")} ? "debug" : "release"
|
||||
pythonCommand = "python3"
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |