ios work
80
veilid-tools/src/tests/android/mod.rs
Normal file
@@ -0,0 +1,80 @@
|
||||
use super::*;
|
||||
|
||||
use jni::errors::Result as JniResult;
|
||||
use jni::{objects::GlobalRef, objects::JObject, objects::JString, JNIEnv, JavaVM};
|
||||
use lazy_static::*;
|
||||
use std::backtrace::Backtrace;
|
||||
use std::panic;
|
||||
use tracing::*;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::*;
|
||||
|
||||
pub struct AndroidGlobals {
|
||||
pub vm: JavaVM,
|
||||
pub ctx: GlobalRef,
|
||||
}
|
||||
|
||||
impl Drop for AndroidGlobals {
|
||||
fn drop(&mut self) {
|
||||
// Ensure we're attached before dropping GlobalRef
|
||||
self.vm.attach_current_thread_as_daemon().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref ANDROID_GLOBALS: Arc<Mutex<Option<AndroidGlobals>>> = Arc::new(Mutex::new(None));
|
||||
}
|
||||
|
||||
pub fn veilid_tools_setup_android_no_log<'a>(env: JNIEnv<'a>, ctx: JObject<'a>) {
|
||||
*ANDROID_GLOBALS.lock() = Some(AndroidGlobals {
|
||||
vm: env.get_java_vm().unwrap(),
|
||||
ctx: env.new_global_ref(ctx).unwrap(),
|
||||
});
|
||||
}
|
||||
|
||||
pub fn veilid_tools_setup<'a>(env: JNIEnv<'a>, ctx: JObject<'a>, log_tag: &'a str) {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "tracing")] {
|
||||
// Set up subscriber and layers
|
||||
|
||||
let subscriber = Registry::default();
|
||||
let mut layers = Vec::new();
|
||||
let layer = tracing_android::layer(log_tag)
|
||||
.expect("failed to set up android logging")
|
||||
.with_filter(LevelFilter::TRACE);
|
||||
layers.push(layer.boxed());
|
||||
|
||||
let subscriber = subscriber.with(layers);
|
||||
subscriber
|
||||
.try_init()
|
||||
.expect("failed to init android tracing");
|
||||
}
|
||||
}
|
||||
|
||||
// Set up panic hook for backtraces
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
let bt = Backtrace::capture();
|
||||
error!("Backtrace:\n{:?}", bt);
|
||||
}));
|
||||
|
||||
veilid_core_setup_android_no_log(env, ctx);
|
||||
}
|
||||
|
||||
pub fn get_android_globals() -> (JavaVM, GlobalRef) {
|
||||
let globals_locked = ANDROID_GLOBALS.lock();
|
||||
let globals = globals_locked.as_ref().unwrap();
|
||||
let env = globals.vm.attach_current_thread_as_daemon().unwrap();
|
||||
let vm = env.get_java_vm().unwrap();
|
||||
let ctx = globals.ctx.clone();
|
||||
(vm, ctx)
|
||||
}
|
||||
|
||||
pub fn with_null_local_frame<'b, T, F>(env: JNIEnv<'b>, s: i32, f: F) -> JniResult<T>
|
||||
where
|
||||
F: FnOnce() -> JniResult<T>,
|
||||
{
|
||||
env.push_local_frame(s)?;
|
||||
let out = f();
|
||||
env.pop_local_frame(JObject::null())?;
|
||||
out
|
||||
}
|
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 |
@@ -1,2 +1,27 @@
|
||||
pub mod test_async_tag_lock;
|
||||
pub mod test_host_interface;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub static DEFAULT_LOG_IGNORE_LIST: [&str; 21] = [
|
||||
"mio",
|
||||
"h2",
|
||||
"hyper",
|
||||
"tower",
|
||||
"tonic",
|
||||
"tokio",
|
||||
"runtime",
|
||||
"tokio_util",
|
||||
"want",
|
||||
"serial_test",
|
||||
"async_std",
|
||||
"async_io",
|
||||
"polling",
|
||||
"rustls",
|
||||
"async_tungstenite",
|
||||
"tungstenite",
|
||||
"netlink_proto",
|
||||
"netlink_sys",
|
||||
"trust_dns_resolver",
|
||||
"trust_dns_proto",
|
||||
"attohttpc",
|
||||
];
|
||||
|
61
veilid-tools/src/tests/ios/mod.rs
Normal file
@@ -0,0 +1,61 @@
|
||||
use super::*;
|
||||
|
||||
use std::backtrace::Backtrace;
|
||||
use std::panic;
|
||||
|
||||
pub fn veilid_tools_setup<'a>() -> Result<(), String> {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "tracing")] {
|
||||
use tracing_subscriber::{filter, fmt, prelude::*};
|
||||
let mut filters = filter::Targets::new();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
filters = filters.with_target(ig, filter::LevelFilter::OFF);
|
||||
}
|
||||
let fmt_layer = fmt::layer();
|
||||
tracing_subscriber::registry()
|
||||
.with(filters)
|
||||
.with(filter::LevelFilter::TRACE)
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
} else {
|
||||
use simplelog::*;
|
||||
let mut logs: Vec<Box<dyn SharedLogger>> = Vec::new();
|
||||
let mut cb = ConfigBuilder::new();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
cb.add_filter_ignore_str(ig);
|
||||
}
|
||||
logs.push(TermLogger::new(
|
||||
LevelFilter::Trace,
|
||||
cb.build(),
|
||||
TerminalMode::Mixed,
|
||||
ColorChoice::Auto,
|
||||
));
|
||||
CombinedLogger::init(logs).map_err(|e| format!("logger init error: {}", e))?;
|
||||
}
|
||||
}
|
||||
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
let bt = Backtrace::capture();
|
||||
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);
|
||||
}));
|
||||
|
||||
Ok(())
|
||||
}
|
@@ -7,31 +7,31 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4317C6BD2694A676009C717F /* veilid-tools.c in Sources */ = {isa = PBXBuildFile; fileRef = 4317C6BC2694A676009C717F /* veilid-tools.c */; };
|
||||
43C436B0268904AC002D11C5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436AF268904AC002D11C5 /* AppDelegate.swift */; };
|
||||
43C436B2268904AC002D11C5 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436B1268904AC002D11C5 /* SceneDelegate.swift */; };
|
||||
43C436B4268904AC002D11C5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436B3268904AC002D11C5 /* ViewController.swift */; };
|
||||
43C436B7268904AC002D11C5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43C436B5268904AC002D11C5 /* Main.storyboard */; };
|
||||
43C436B9268904AD002D11C5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43C436B8268904AD002D11C5 /* Assets.xcassets */; };
|
||||
43C436BC268904AD002D11C5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43C436BA268904AD002D11C5 /* LaunchScreen.storyboard */; };
|
||||
4317C6BD3694A676009C717F /* (null) in Sources */ = {isa = PBXBuildFile; };
|
||||
43C436B0368904AC002D11C5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436AF368904AC002D11C5 /* AppDelegate.swift */; };
|
||||
43C436B2368904AC002D11C5 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436B1368904AC002D11C5 /* SceneDelegate.swift */; };
|
||||
43C436B4368904AC002D11C5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C436B3368904AC002D11C5 /* ViewController.swift */; };
|
||||
43C436B7368904AC002D11C5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43C436B5368904AC002D11C5 /* Main.storyboard */; };
|
||||
43C436B9368904AD002D11C5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43C436B8368904AD002D11C5 /* Assets.xcassets */; };
|
||||
43C436BC368904AD002D11C5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43C436BA368904AD002D11C5 /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
4317C6BA2694A675009C717F /* veilidtools-tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "veilidtools-tests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
4317C6BB2694A676009C717F /* veilid-tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "veilid-tools.h"; sourceTree = "<group>"; };
|
||||
4317C6BC2694A676009C717F /* veilid-tools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "veilid-tools.c"; sourceTree = "<group>"; };
|
||||
43C436AC268904AC002D11C5 /* veilidtools-tests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "veilidtools-tests.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
43C436AF268904AC002D11C5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
43C436B1268904AC002D11C5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||
43C436B3268904AC002D11C5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
43C436B6268904AC002D11C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
43C436B8268904AD002D11C5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
43C436BB268904AD002D11C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
43C436BD268904AD002D11C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
4317C6BA3694A675009C717F /* veilidtools-tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "veilidtools-tests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
4317C6BB3694A676009C717F /* veilid-tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "veilid-tools.h"; sourceTree = "<group>"; };
|
||||
4317C6BC3694A676009C717F /* veilid-tools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "veilid-tools.c"; sourceTree = "<group>"; };
|
||||
43C436AC368904AC002D11C5 /* veilidtools-tests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "veilidtools-tests.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
43C436AF368904AC002D11C5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
43C436B1368904AC002D11C5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||
43C436B3368904AC002D11C5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
43C436B6368904AC002D11C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
43C436B8368904AD002D11C5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
43C436BB368904AD002D11C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
43C436BD368904AD002D11C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
43C436A9268904AC002D11C5 /* Frameworks */ = {
|
||||
43C436A9368904AC002D11C5 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -41,43 +41,43 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
4317C6B7269490DA009C717F /* Frameworks */ = {
|
||||
4317C6B7369490DA009C717F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
43C436A3268904AC002D11C5 = {
|
||||
43C436A3368904AC002D11C5 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4317C6BB2694A676009C717F /* veilid-tools.h */,
|
||||
4317C6BC2694A676009C717F /* veilid-tools.c */,
|
||||
43C436AE268904AC002D11C5 /* veilidtools-tests */,
|
||||
43C436AD268904AC002D11C5 /* Products */,
|
||||
4317C6B7269490DA009C717F /* Frameworks */,
|
||||
4317C6BA2694A675009C717F /* veilidtools-tests-Bridging-Header.h */,
|
||||
4317C6BB3694A676009C717F /* veilid-tools.h */,
|
||||
4317C6BC3694A676009C717F /* veilid-tools.c */,
|
||||
43C436AE368904AC002D11C5 /* veilidtools-tests */,
|
||||
43C436AD368904AC002D11C5 /* Products */,
|
||||
4317C6B7369490DA009C717F /* Frameworks */,
|
||||
4317C6BA3694A675009C717F /* veilidtools-tests-Bridging-Header.h */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
43C436AD268904AC002D11C5 /* Products */ = {
|
||||
43C436AD368904AC002D11C5 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
43C436AC268904AC002D11C5 /* veilidtools-tests.app */,
|
||||
43C436AC368904AC002D11C5 /* veilidtools-tests.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
43C436AE268904AC002D11C5 /* veilidtools-tests */ = {
|
||||
43C436AE368904AC002D11C5 /* veilidtools-tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
43C436AF268904AC002D11C5 /* AppDelegate.swift */,
|
||||
43C436B1268904AC002D11C5 /* SceneDelegate.swift */,
|
||||
43C436B3268904AC002D11C5 /* ViewController.swift */,
|
||||
43C436B5268904AC002D11C5 /* Main.storyboard */,
|
||||
43C436B8268904AD002D11C5 /* Assets.xcassets */,
|
||||
43C436BA268904AD002D11C5 /* LaunchScreen.storyboard */,
|
||||
43C436BD268904AD002D11C5 /* Info.plist */,
|
||||
43C436AF368904AC002D11C5 /* AppDelegate.swift */,
|
||||
43C436B1368904AC002D11C5 /* SceneDelegate.swift */,
|
||||
43C436B3368904AC002D11C5 /* ViewController.swift */,
|
||||
43C436B5368904AC002D11C5 /* Main.storyboard */,
|
||||
43C436B8368904AD002D11C5 /* Assets.xcassets */,
|
||||
43C436BA368904AD002D11C5 /* LaunchScreen.storyboard */,
|
||||
43C436BD368904AD002D11C5 /* Info.plist */,
|
||||
);
|
||||
path = "veilidtools-tests";
|
||||
sourceTree = "<group>";
|
||||
@@ -85,14 +85,14 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
43C436AB268904AC002D11C5 /* veilidtools-tests */ = {
|
||||
43C436AB368904AC002D11C5 /* veilidtools-tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 43C436C0268904AD002D11C5 /* Build configuration list for PBXNativeTarget "veilidtools-tests" */;
|
||||
buildConfigurationList = 43C436C0368904AD002D11C5 /* Build configuration list for PBXNativeTarget "veilidtools-tests" */;
|
||||
buildPhases = (
|
||||
43C436C326893020002D11C5 /* Cargo Build */,
|
||||
43C436A8268904AC002D11C5 /* Sources */,
|
||||
43C436A9268904AC002D11C5 /* Frameworks */,
|
||||
43C436AA268904AC002D11C5 /* Resources */,
|
||||
43C436C336893020002D11C5 /* Cargo Build */,
|
||||
43C436A8368904AC002D11C5 /* Sources */,
|
||||
43C436A9368904AC002D11C5 /* Frameworks */,
|
||||
43C436AA368904AC002D11C5 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -100,25 +100,25 @@
|
||||
);
|
||||
name = "veilidtools-tests";
|
||||
productName = "veilidtools-tests";
|
||||
productReference = 43C436AC268904AC002D11C5 /* veilidtools-tests.app */;
|
||||
productReference = 43C436AC368904AC002D11C5 /* veilidtools-tests.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
43C436A4268904AC002D11C5 /* Project object */ = {
|
||||
43C436A4368904AC002D11C5 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1250;
|
||||
LastUpgradeCheck = 1250;
|
||||
TargetAttributes = {
|
||||
43C436AB268904AC002D11C5 = {
|
||||
43C436AB368904AC002D11C5 = {
|
||||
CreatedOnToolsVersion = 12.5.1;
|
||||
LastSwiftMigration = 1250;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 43C436A7268904AC002D11C5 /* Build configuration list for PBXProject "veilidtools-tests" */;
|
||||
buildConfigurationList = 43C436A7368904AC002D11C5 /* Build configuration list for PBXProject "veilidtools-tests" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
@@ -126,31 +126,31 @@
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 43C436A3268904AC002D11C5;
|
||||
productRefGroup = 43C436AD268904AC002D11C5 /* Products */;
|
||||
mainGroup = 43C436A3368904AC002D11C5;
|
||||
productRefGroup = 43C436AD368904AC002D11C5 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
43C436AB268904AC002D11C5 /* veilidtools-tests */,
|
||||
43C436AB368904AC002D11C5 /* veilidtools-tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
43C436AA268904AC002D11C5 /* Resources */ = {
|
||||
43C436AA368904AC002D11C5 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
43C436BC268904AD002D11C5 /* LaunchScreen.storyboard in Resources */,
|
||||
43C436B9268904AD002D11C5 /* Assets.xcassets in Resources */,
|
||||
43C436B7268904AC002D11C5 /* Main.storyboard in Resources */,
|
||||
43C436BC368904AD002D11C5 /* LaunchScreen.storyboard in Resources */,
|
||||
43C436B9368904AD002D11C5 /* Assets.xcassets in Resources */,
|
||||
43C436B7368904AC002D11C5 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
43C436C326893020002D11C5 /* Cargo Build */ = {
|
||||
43C436C336893020002D11C5 /* Cargo Build */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -167,37 +167,37 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "../../../../ios_build.sh --features ios_tests\n";
|
||||
shellScript = "../../../../ios_build.sh veilid_tools --features ios_tests,rt-tokio\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
43C436A8268904AC002D11C5 /* Sources */ = {
|
||||
43C436A8368904AC002D11C5 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
43C436B4268904AC002D11C5 /* ViewController.swift in Sources */,
|
||||
43C436B0268904AC002D11C5 /* AppDelegate.swift in Sources */,
|
||||
43C436B2268904AC002D11C5 /* SceneDelegate.swift in Sources */,
|
||||
4317C6BD2694A676009C717F /* veilid-tools.c in Sources */,
|
||||
43C436B4368904AC002D11C5 /* ViewController.swift in Sources */,
|
||||
43C436B0368904AC002D11C5 /* AppDelegate.swift in Sources */,
|
||||
43C436B2368904AC002D11C5 /* SceneDelegate.swift in Sources */,
|
||||
4317C6BD3694A676009C717F /* (null) in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
43C436B5268904AC002D11C5 /* Main.storyboard */ = {
|
||||
43C436B5368904AC002D11C5 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
43C436B6268904AC002D11C5 /* Base */,
|
||||
43C436B6368904AC002D11C5 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
43C436BA268904AD002D11C5 /* LaunchScreen.storyboard */ = {
|
||||
43C436BA368904AD002D11C5 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
43C436BB268904AD002D11C5 /* Base */,
|
||||
43C436BB368904AD002D11C5 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
@@ -205,11 +205,11 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
43C436BE268904AD002D11C5 /* Debug */ = {
|
||||
43C436BE368904AD002D11C5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = arm64;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
@@ -264,14 +264,15 @@
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
43C436BF268904AD002D11C5 /* Release */ = {
|
||||
43C436BF368904AD002D11C5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = arm64;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
@@ -319,16 +320,18 @@
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
43C436C1268904AD002D11C5 /* Debug */ = {
|
||||
43C436C1368904AD002D11C5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = ZJPQSFX5MW;
|
||||
INFOPLIST_FILE = "veilidtools-tests/Info.plist";
|
||||
@@ -338,16 +341,13 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
|
||||
"-L../../../../../target/aarch64-apple-ios/debug",
|
||||
"-lveilid_tools",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
|
||||
"-L../../../../../target/x86_64-apple-ios/debug",
|
||||
"-L../../../../../target/lipo-ios-sim/debug",
|
||||
"-lveilid_tools",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.veilid.veilidtools-tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "veilidtools-tests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -355,12 +355,13 @@
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
43C436C2268904AD002D11C5 /* Release */ = {
|
||||
43C436C2368904AD002D11C5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = ZJPQSFX5MW;
|
||||
INFOPLIST_FILE = "veilidtools-tests/Info.plist";
|
||||
@@ -370,16 +371,13 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
|
||||
"-L../../../../../target/aarch64-apple-ios/release",
|
||||
"-lveilid_tools",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
|
||||
"-L../../../../../target/x86_64-apple-ios/release",
|
||||
"-L../../../../../target/lipo-ios-sim/release",
|
||||
"-lveilid_tools",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.veilid.veilidtools-tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "veilidtools-tests-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -389,25 +387,25 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
43C436A7268904AC002D11C5 /* Build configuration list for PBXProject "veilidtools-tests" */ = {
|
||||
43C436A7368904AC002D11C5 /* Build configuration list for PBXProject "veilidtools-tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
43C436BE268904AD002D11C5 /* Debug */,
|
||||
43C436BF268904AD002D11C5 /* Release */,
|
||||
43C436BE368904AD002D11C5 /* Debug */,
|
||||
43C436BF368904AD002D11C5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
43C436C0268904AD002D11C5 /* Build configuration list for PBXNativeTarget "veilidtools-tests" */ = {
|
||||
43C436C0368904AD002D11C5 /* Build configuration list for PBXNativeTarget "veilidtools-tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
43C436C1268904AD002D11C5 /* Debug */,
|
||||
43C436C2268904AD002D11C5 /* Release */,
|
||||
43C436C1368904AD002D11C5 /* Debug */,
|
||||
43C436C2368904AD002D11C5 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 43C436A4268904AC002D11C5 /* Project object */;
|
||||
rootObject = 43C436A4368904AC002D11C5 /* Project object */;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1250"
|
||||
LastUpgradeVersion = "1410"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "43C436AB268904AC002D11C5"
|
||||
BlueprintIdentifier = "43C436AB368904AC002D11C5"
|
||||
BuildableName = "veilidtools-tests.app"
|
||||
BlueprintName = "veilidtools-tests"
|
||||
ReferencedContainer = "container:veilidtools-tests.xcodeproj">
|
||||
@@ -44,7 +44,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "43C436AB268904AC002D11C5"
|
||||
BlueprintIdentifier = "43C436AB368904AC002D11C5"
|
||||
BuildableName = "veilidtools-tests.app"
|
||||
BlueprintName = "veilidtools-tests"
|
||||
ReferencedContainer = "container:veilidtools-tests.xcodeproj">
|
||||
@@ -61,7 +61,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "43C436AB268904AC002D11C5"
|
||||
BlueprintIdentifier = "43C436AB368904AC002D11C5"
|
||||
BuildableName = "veilidtools-tests.app"
|
||||
BlueprintName = "veilidtools-tests"
|
||||
ReferencedContainer = "container:veilidtools-tests.xcodeproj">
|
@@ -6,12 +6,14 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Darwin
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
run_veilid_tools_tests()
|
||||
exit(0)
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,3 +1,11 @@
|
||||
#[cfg(target_os = "android")]
|
||||
mod android;
|
||||
pub mod common;
|
||||
#[cfg(target_os = "ios")]
|
||||
mod ios;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod native;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub use common::*;
|
||||
|
@@ -3,8 +3,7 @@
|
||||
|
||||
mod test_async_peek_stream;
|
||||
|
||||
use crate::tests::common::*;
|
||||
use crate::*;
|
||||
use super::*;
|
||||
|
||||
#[cfg(all(target_os = "android", feature = "android_tests"))]
|
||||
use jni::{objects::JClass, objects::JObject, JNIEnv};
|
||||
@@ -17,30 +16,15 @@ pub extern "system" fn Java_com_veilid_veilidtools_veilidtools_1android_1tests_M
|
||||
_class: JClass,
|
||||
ctx: JObject,
|
||||
) {
|
||||
crate::intf::utils::android::veilid_tools_setup_android(
|
||||
env,
|
||||
ctx,
|
||||
"veilid_tools",
|
||||
crate::veilid_config::VeilidConfigLogLevel::Trace,
|
||||
);
|
||||
crate::tests::android::veilid_tools_setup(env, ctx, "veilid-tools");
|
||||
run_all_tests();
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "ios", feature = "ios_tests"))]
|
||||
#[no_mangle]
|
||||
#[allow(dead_code)]
|
||||
pub extern "C" fn run_veilid_tools_tests() {
|
||||
let log_path: std::path::PathBuf = [
|
||||
std::env::var("HOME").unwrap().as_str(),
|
||||
"Documents",
|
||||
"veilid-tools.log",
|
||||
]
|
||||
.iter()
|
||||
.collect();
|
||||
crate::intf::utils::ios_test_setup::veilid_tools_setup(
|
||||
"veilid-tools",
|
||||
Some(Level::Trace),
|
||||
Some((Level::Trace, log_path.as_path())),
|
||||
);
|
||||
crate::tests::ios::veilid_tools_setup().expect("setup failed");
|
||||
run_all_tests();
|
||||
}
|
||||
|
||||
@@ -88,43 +72,37 @@ fn exec_test_async_tag_lock() {
|
||||
cfg_if! {
|
||||
if #[cfg(test)] {
|
||||
|
||||
static DEFAULT_LOG_IGNORE_LIST: [&str; 21] = [
|
||||
"mio",
|
||||
"h2",
|
||||
"hyper",
|
||||
"tower",
|
||||
"tonic",
|
||||
"tokio",
|
||||
"runtime",
|
||||
"tokio_util",
|
||||
"want",
|
||||
"serial_test",
|
||||
"async_std",
|
||||
"async_io",
|
||||
"polling",
|
||||
"rustls",
|
||||
"async_tungstenite",
|
||||
"tungstenite",
|
||||
"netlink_proto",
|
||||
"netlink_sys",
|
||||
"trust_dns_resolver",
|
||||
"trust_dns_proto",
|
||||
"attohttpc",
|
||||
];
|
||||
|
||||
use serial_test::serial;
|
||||
use simplelog::*;
|
||||
use std::sync::Once;
|
||||
|
||||
static SETUP_ONCE: Once = Once::new();
|
||||
|
||||
pub fn setup() {
|
||||
SETUP_ONCE.call_once(|| {
|
||||
let mut cb = ConfigBuilder::new();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
cb.add_filter_ignore_str(ig);
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "tracing")] {
|
||||
use tracing_subscriber::{filter, fmt, prelude::*};
|
||||
let mut filters = filter::Targets::new();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
filters = filters.with_target(ig, filter::LevelFilter::OFF);
|
||||
}
|
||||
let fmt_layer = fmt::layer();
|
||||
tracing_subscriber::registry()
|
||||
.with(filters)
|
||||
.with(filter::LevelFilter::TRACE)
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
} else {
|
||||
use simplelog::*;
|
||||
let mut cb = ConfigBuilder::new();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
cb.add_filter_ignore_str(ig);
|
||||
}
|
||||
TestLogger::init(LevelFilter::Trace, cb.build()).unwrap();
|
||||
}
|
||||
}
|
||||
TestLogger::init(LevelFilter::Trace, cb.build()).unwrap();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|