diff --git a/qnx_qemu/BUILD b/qnx_qemu/BUILD index 030893978d..0ee32b983b 100644 --- a/qnx_qemu/BUILD +++ b/qnx_qemu/BUILD @@ -114,3 +114,22 @@ py_itf_test( "target_config.json", ], ) + +py_itf_test( + name = "test_persistency_qemu", + srcs = [ + "test/itf/test_persistency.py", + ], + args = [ + "--target_config=$(location target_config.json)", + "--ecu=s_core_ecu_qemu", + "--qemu_image=$(location //build:init)", + ], + plugins = [ + "itf.plugins.base.base_plugin", + ], + data = [ + "//build:init", + "target_config.json", + ], +) diff --git a/qnx_qemu/MODULE.bazel b/qnx_qemu/MODULE.bazel index 40d1ad9c84..5fa697079b 100644 --- a/qnx_qemu/MODULE.bazel +++ b/qnx_qemu/MODULE.bazel @@ -95,6 +95,8 @@ bazel_dep(name = "score_communication", version = "0.1.1") bazel_dep(name = "score_scrample", version = "0.1.0") +bazel_dep(name = "score_persistency", version = "0.2.1") + bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") archive_override( module_name = "rules_boost", diff --git a/qnx_qemu/build/BUILD b/qnx_qemu/build/BUILD index edd5072ffb..077d30e0e9 100644 --- a/qnx_qemu/build/BUILD +++ b/qnx_qemu/build/BUILD @@ -51,9 +51,11 @@ qnx_ifs( ":configs", "@score_scrample//src:scrample", "//scrample_integration:etc_configs", + "@score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios", ], ext_repo_maping = { "SCRAMPLE_PATH": "$(location @score_scrample//src:scrample)", + "CPP_TEST_SCENARIOS_PATH": "$(location @score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios)", }, visibility = [ "//:__pkg__" diff --git a/qnx_qemu/build/system.build b/qnx_qemu/build/system.build index dabbd2bfa8..baab76a47f 100644 --- a/qnx_qemu/build/system.build +++ b/qnx_qemu/build/system.build @@ -280,3 +280,4 @@ pci/pci_debug2.so # Enhanced PCI debugging support [perms=777] /etc/mw_com_config.json = scrample_integration/etc/mw_com_config.json # DHCP client configuration file [perms=777] /scrample = ${SCRAMPLE_PATH} +[perms=777] /cpp_tests_persistency = ${CPP_TEST_SCENARIOS_PATH} diff --git a/qnx_qemu/test/itf/test_persistency.py b/qnx_qemu/test/itf/test_persistency.py new file mode 100644 index 0000000000..96c16fc165 --- /dev/null +++ b/qnx_qemu/test/itf/test_persistency.py @@ -0,0 +1,38 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* +from itf.plugins.com.ping import ping +from itf.plugins.com.ssh import execute_command_output +import logging + +logger = logging.getLogger(__name__) + + +def test_persistency_test_app_is_deployed(target_fixture): + with target_fixture.sut.ssh() as ssh: + exit_code, stdout, stderr = execute_command_output( + ssh, "test -f cpp_tests_persistency" + ) + assert exit_code == 0, "SSH command failed" + +def test_persistency_test_app_is_running(target_fixture): + with target_fixture.sut.ssh() as ssh: + exit_code, stdout, stderr = execute_command_output( + ssh, "./cpp_tests_persistency --name basic.basic --input '{\"kvs_parameters\":{\"instance_id\":0}}'", + timeout = 30, max_exec_time = 180, + logger_in = logger, verbose = True, + ) + + logger.info (stdout) + logger.info (stderr) + + assert exit_code == 0, "SSH command failed"