1 // Copyright 2023 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 use cmd_runner::run_cmd_shell;
16 use std::path;
17
18 // This has to happen after both boringssl has been built and prepare rust openssl patches has been run.
check_ldt_jni(root: &path::Path) -> anyhow::Result<()>19 pub fn check_ldt_jni(root: &path::Path) -> anyhow::Result<()> {
20 run_cmd_shell(root, "cargo build -p ldt_np_jni --no-default-features --features=boringssl")?;
21 Ok(())
22 }
23
run_kotlin_tests(root: &path::Path) -> anyhow::Result<()>24 pub fn run_kotlin_tests(root: &path::Path) -> anyhow::Result<()> {
25 let kotlin_lib_path = root.to_path_buf().join("presence/ldt_np_jni/java/LdtNpJni");
26 run_cmd_shell(&kotlin_lib_path, "./gradlew :test")?;
27 Ok(())
28 }
29
run_ukey2_jni_tests(root: &path::Path) -> anyhow::Result<()>30 pub fn run_ukey2_jni_tests(root: &path::Path) -> anyhow::Result<()> {
31 run_cmd_shell(root, "cargo build -p ukey2_jni")?;
32 let ukey2_jni_path = root.to_path_buf().join("connections/ukey2/ukey2_jni/java");
33 run_cmd_shell(&ukey2_jni_path, "./gradlew :test")?;
34 Ok(())
35 }
36
run_np_java_ffi_tests(root: &path::Path) -> anyhow::Result<()>37 pub fn run_np_java_ffi_tests(root: &path::Path) -> anyhow::Result<()> {
38 run_cmd_shell(root, "cargo build -p np_java_ffi -F crypto_provider_default/rustcrypto")?;
39 let ukey2_jni_path = root.to_path_buf().join("presence/np_java_ffi");
40 run_cmd_shell(&ukey2_jni_path, "./gradlew :test --info --rerun")?;
41 Ok(())
42 }
43