more test work

This commit is contained in:
John Smith 2022-11-30 09:39:12 -05:00
parent 672d750f8f
commit b47b5c1e85
65 changed files with 44 additions and 67 deletions

View File

@ -14,8 +14,8 @@ default = []
rt-async-std = [ "async-std", "async-std-resolver", "async_executors/async_std", "rtnetlink?/smol_socket", "veilid-tools/rt-async-std" ]
rt-tokio = [ "tokio", "tokio-util", "tokio-stream", "trust-dns-resolver/tokio-runtime", "async_executors/tokio_tp", "async_executors/tokio_io", "async_executors/tokio_timer", "rtnetlink?/tokio_socket", "veilid-tools/rt-tokio" ]
android_tests = []
ios_tests = [ "simplelog" ]
keyring_manager_android_tests = []
veilid_core_ios_tests = [ "simplelog" ]
tracking = []
[dependencies]

View File

@ -30,8 +30,8 @@ elif [[ "$1" == "android" ]]; then
echo "No emulator ID specified"
exit 1
fi
APPNAME=veilidcore-tests
APPID=com.veilid.veilidcore_tests
APPNAME=veilid_core_android_tests
APPID=com.veilid.veilid_core_android_tests
ACTIVITYNAME=MainActivity
pushd src/tests/android/$APPNAME >/dev/null
# Build apk
@ -45,7 +45,7 @@ elif [[ "$1" == "android" ]]; then
# Get the pid of the program
APP_PID=`adb -s $ID shell pidof -s $APPID`
# Print the logcat
adb -s $ID shell logcat -d veilid-core:V *:S &
adb -s $ID shell logcat --pid=$APP_PID veilid-core:V *:S &
# Wait for the pid to be done
while [ "$(adb -s $ID shell pidof -s $APPID)" != "" ]; do
sleep 1

View File

@ -10,6 +10,6 @@ pub use table_store::*;
#[cfg(target_os = "android")]
pub mod android;
#[cfg(all(target_os = "ios", feature = "ios_tests"))]
#[cfg(all(target_os = "ios", feature = "veilid_core_ios_tests"))]
pub mod ios_test_setup;
pub mod network_interfaces;

View File

@ -1,6 +1,6 @@
#![deny(clippy::all)]
#![deny(unused_must_use)]
#![recursion_limit = "1024"]
#![recursion_limit = "256"]
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {

View File

@ -7,7 +7,7 @@ android {
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.veilid.veilidcore.veilidcore_android_tests"
applicationId "com.veilid.veilid_core_android_tests"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
@ -69,7 +69,7 @@ cargo {
profile = gradle.startParameter.taskNames.any{it.toLowerCase().contains("debug")} ? "debug" : "release"
pythonCommand = "python3"
features {
defaultAnd("android_tests", "rt-tokio")
defaultAnd("veilid_core_android_tests", "rt-tokio")
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.veilid.veilidcore.veilidcore_android_tests">
package="com.veilid.veilid_core_android_tests">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -1,4 +1,4 @@
package com.veilid.veilidcore.veilidcore_android_tests;
package com.veilid.veilid_core_android_tests;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;

View File

@ -1,3 +1,3 @@
#!/bin/bash
./adb+.sh uninstall com.veilid.veilidcore.veilidcore_android_tests
./adb+.sh uninstall com.veilid.veilid_core_android_tests

View File

@ -167,7 +167,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../../../../ios_build.sh --features ios_tests\n";
shellScript = "../../../../../scripts/ios_build.sh ../../../../ veilid_core --features veilid_core_ios_tests,rt-tokio\n";
};
/* End PBXShellScriptBuildPhase section */
@ -209,7 +209,7 @@
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,6 +264,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
@ -271,7 +272,7 @@
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,6 +320,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
@ -339,11 +341,11 @@
);
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
"-L../../../../../target/aarch64-apple-ios/debug",
"-L../../../../../target/lipo-ios/debug",
"-lveilid_core",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-L../../../../../target/x86_64-apple-ios/debug",
"-L../../../../../target/lipo-ios-sim/debug",
"-lveilid_core",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.veilid.veilidcore-tests";
@ -371,11 +373,11 @@
);
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
"-L../../../../../target/aarch64-apple-ios/release",
"-L../../../../../target/lipo-ios/release",
"-lveilid_core",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-L../../../../../target/x86_64-apple-ios/release",
"-L../../../../../target/lipo-ios-sim/release",
"-lveilid_core",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.veilid.veilidcore-tests";

View File

@ -5,13 +5,13 @@ use crate::network_manager::tests::*;
use crate::tests::common::*;
use crate::*;
#[cfg(all(target_os = "android", feature = "android_tests"))]
#[cfg(all(target_os = "android", feature = "veilid_core_android_tests"))]
use jni::{objects::JClass, objects::JObject, JNIEnv};
#[cfg(all(target_os = "android", feature = "android_tests"))]
#[cfg(all(target_os = "android", feature = "veilid_core_android_tests"))]
#[no_mangle]
#[allow(non_snake_case)]
pub extern "system" fn Java_com_veilid_veilidcore_veilidcore_1android_1tests_MainActivity_run_1tests(
pub extern "system" fn Java_com_veilid_veilid_1core_1android_1tests_MainActivity_run_1tests(
env: JNIEnv,
_class: JClass,
ctx: JObject,
@ -25,7 +25,7 @@ pub extern "system" fn Java_com_veilid_veilidcore_veilidcore_1android_1tests_Mai
run_all_tests();
}
#[cfg(all(target_os = "ios", feature = "ios_tests"))]
#[cfg(all(target_os = "ios", feature = "veilid_core_ios_tests"))]
#[no_mangle]
pub extern "C" fn run_veilid_core_tests() {
let log_path: std::path::PathBuf = [

View File

@ -88,9 +88,6 @@ cargo {
prebuiltToolchains = true
pythonCommand = "python3"
profile = gradle.startParameter.taskNames.any{it.toLowerCase().contains("debug")} ? "debug" : "release"
// features {
// defaultAnd("android_tests")
// }
}
afterEvaluate {

View File

@ -14,9 +14,8 @@ default = []
rt-async-std = [ "async-std", "async_executors/async_std", ]
rt-tokio = [ "tokio", "tokio-util", "async_executors/tokio_tp", "async_executors/tokio_io", "async_executors/tokio_timer", ]
android_tests = [ "dep:tracing-android" ]
ios_tests = []
tracking = []
veilid_tools_android_tests = [ "dep:tracing-android" ]
veilid_tools_ios_tests = []
tracing = [ "dep:tracing", "dep:tracing-subscriber" ]
[dependencies]

View File

@ -30,8 +30,8 @@ elif [[ "$1" == "android" ]]; then
echo "No emulator ID specified"
exit 1
fi
APPNAME=veilidtools-tests
APPID=com.veilid.veilidtools_tests
APPNAME=veilid_tools_android_tests
APPID=com.veilid.veilid_tools_android_tests
ACTIVITYNAME=MainActivity
pushd src/tests/android/$APPNAME >/dev/null
# Build apk
@ -45,7 +45,7 @@ elif [[ "$1" == "android" ]]; then
# Get the pid of the program
APP_PID=`adb -s $ID shell pidof -s $APPID`
# Print the logcat
adb -s $ID shell logcat -d veilid-tools:V *:S &
adb -s $ID shell logcat --pid=$APP_PID veilid-tools:V *:S &
# Wait for the pid to be done
while [ "$(adb -s $ID shell pidof -s $APPID)" != "" ]; do
sleep 1
@ -56,9 +56,9 @@ elif [[ "$1" == "android" ]]; then
popd >/dev/null
else
cargo test --features=rt-tokio,tracing
cargo test --features=rt-async-std,tracing
cargo test --features=rt-tokio
cargo test --features=rt-async-std
cargo test --features=rt-tokio,log --no-default-features
cargo test --features=rt-async-std,log --no-default-features
fi
popd 2>/dev/null

View File

@ -7,7 +7,7 @@ android {
buildToolsVersion "33.0.1"
defaultConfig {
applicationId "com.veilid.veilidtools_tests"
applicationId "com.veilid.veilid_tools_android_tests"
minSdkVersion 24
targetSdkVersion 33
versionCode 1
@ -47,25 +47,7 @@ android {
path file('CMakeLists.txt')
}
}
namespace 'com.veilid.veilidtools_tests'
testOptions {
managedDevices {
devices {
pixel2api30 (com.android.build.api.dsl.ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// ATD currently support only API level 30.
apiLevel = 30
// You can also specify "google-atd" if you require Google
// Play Services.
systemImageSource = "aosp-atd"
// Whether the image must be a 64 bit image.
require64Bit = false
}
}
}
}
namespace 'com.veilid.veilid_tools_android_tests'
}
dependencies {
@ -73,9 +55,6 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.security:security-crypto:1.1.0-alpha04'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test:runner:1.5.1'
androidTestImplementation 'androidx.test:rules:1.5.0'
}
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
@ -89,7 +68,7 @@ cargo {
profile = gradle.startParameter.taskNames.any{it.toLowerCase().contains("debug")} ? "debug" : "release"
pythonCommand = "python3"
features {
defaultAnd("android_tests", "rt-tokio")
defaultAnd("veilid_tools_android_tests", "rt-tokio")
}
}

View File

@ -1,4 +1,4 @@
package com.veilid.veilidtools_tests;
package com.veilid.veilid_tools_android_tests;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;

View File

@ -0,0 +1,3 @@
#!/bin/bash
./adb+.sh uninstall com.veilid.veilid_tools_android_tests

View File

@ -1,3 +0,0 @@
#!/bin/bash
./adb+.sh uninstall com.veilid.veilidtools.veilidtools_android_tests

View File

@ -167,7 +167,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../../../../../scripts/ios_build.sh ../../../../ veilid_tools --features ios_tests,rt-tokio\n";
shellScript = "../../../../../scripts/ios_build.sh ../../../../ veilid_tools --features veilid_tools_ios_tests,rt-tokio\n";
};
/* End PBXShellScriptBuildPhase section */

View File

@ -5,13 +5,13 @@ mod test_async_peek_stream;
use super::*;
#[cfg(all(target_os = "android", feature = "android_tests"))]
#[cfg(all(target_os = "android", feature = "veilid_tools_android_tests"))]
use jni::{objects::JClass, objects::JObject, JNIEnv};
#[cfg(all(target_os = "android", feature = "android_tests"))]
#[cfg(all(target_os = "android", feature = "veilid_tools_android_tests"))]
#[no_mangle]
#[allow(non_snake_case)]
pub extern "system" fn Java_com_veilid_veilidtools_1tests_MainActivity_run_1tests(
pub extern "system" fn Java_com_veilid_veilid_1tools_1android_1tests_MainActivity_run_1tests(
env: JNIEnv,
_class: JClass,
ctx: JObject,
@ -20,7 +20,7 @@ pub extern "system" fn Java_com_veilid_veilidtools_1tests_MainActivity_run_1test
run_all_tests();
}
#[cfg(all(target_os = "ios", feature = "ios_tests"))]
#[cfg(all(target_os = "ios", feature = "veilid_tools_ios_tests"))]
#[no_mangle]
#[allow(dead_code)]
pub extern "C" fn run_veilid_tools_tests() {