From 0ae25e75f2cd23445d305811c33b4967de15324f Mon Sep 17 00:00:00 2001 From: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:43:03 -0300 Subject: [PATCH] Copy XML data model files from SDK (#51) --- .../sdk_tests/scripts/fetch_sdk_tests_and_runner.sh | 8 +++++++- test_collections/sdk_tests/support/chip/chip_tool.py | 6 ++++-- .../models/rpc_client/test_harness_client.py | 5 +++-- .../sdk_tests/support/python_testing/models/utils.py | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh b/test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh index 2fcfb422..52910b3d 100755 --- a/test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh +++ b/test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh @@ -29,6 +29,7 @@ TMP_SDK_PATH="/tmp/$TMP_SDK_FOLDER" SDK_YAML_PATH="src/app/tests/suites/certification" SDK_PYTHON_SCRIPT_PATH="src/python_testing" +SDK_PYTHON_DATA_MODEL_PATH="data_model" SDK_SCRIPTS_PATH="scripts/" SDK_EXAMPLE_CHIP_TOOL_PATH="examples/chip-tool" SDK_EXAMPLE_PLACEHOLDER_PATH="examples/placeholder" @@ -107,7 +108,7 @@ then git clone --filter=blob:none --no-checkout --depth 1 --sparse https://github.com/project-chip/connectedhomeip.git $TMP_SDK_FOLDER cd $TMP_SDK_FOLDER git sparse-checkout init - git sparse-checkout set $SDK_YAML_PATH $SDK_SCRIPTS_PATH $SDK_EXAMPLE_PLACEHOLDER_PATH $SDK_EXAMPLE_CHIP_TOOL_PATH $SDK_DATA_MODEL_PATH $SDK_PYTHON_SCRIPT_PATH + git sparse-checkout set $SDK_YAML_PATH $SDK_SCRIPTS_PATH $SDK_EXAMPLE_PLACEHOLDER_PATH $SDK_EXAMPLE_CHIP_TOOL_PATH $SDK_DATA_MODEL_PATH $SDK_PYTHON_SCRIPT_PATH $SDK_PYTHON_DATA_MODEL_PATH git checkout -q $SDK_SHA SDK_PATH="$TMP_SDK_PATH" fi @@ -137,6 +138,11 @@ cp * "$SDK_YAML_DIR_YAML_TEST_COLLECTION_PATH/" cd "$SDK_PATH/$SDK_PYTHON_SCRIPT_PATH" cp -R * "$PYTHON_TESTING_SCRIPTS_TEST_COLLECTION_PATH/" +# Copy XML data models for SDK Python Testing +cd "$SDK_PATH/$SDK_PYTHON_DATA_MODEL_PATH" +mkdir -p "$PYTHON_TESTING_TEST_COLLECTION_PATH/data_model" +cp -R * "$PYTHON_TESTING_TEST_COLLECTION_PATH/data_model" + # Delete deprecated codegenerated python wrappers for yaml rm -Rf "$TEST_COLLECTIONS_PATH/manual_tests" rm -Rf "$TEST_COLLECTIONS_PATH/automated_and_semi_automated" diff --git a/test_collections/sdk_tests/support/chip/chip_tool.py b/test_collections/sdk_tests/support/chip/chip_tool.py index 4ca60ff1..26b0dd1e 100644 --- a/test_collections/sdk_tests/support/chip/chip_tool.py +++ b/test_collections/sdk_tests/support/chip/chip_tool.py @@ -106,7 +106,7 @@ # Python Testing Folder LOCAL_TEST_COLLECTIONS_PATH = "/home/ubuntu/certification-tool/backend/test_collections" LOCAL_PYTHON_TESTING_PATH = Path( - LOCAL_TEST_COLLECTIONS_PATH + "/sdk_tests/sdk_checkout/python_testing/scripts/sdk" + LOCAL_TEST_COLLECTIONS_PATH + "/sdk_tests/sdk_checkout/python_testing" ) DOCKER_PYTHON_TESTING_PATH = "/root/python_testing" @@ -115,7 +115,9 @@ LOCAL_TEST_COLLECTIONS_PATH + "/sdk_tests/support/python_testing/models/rpc_client/" "test_harness_client.py" ) -DOCKER_RPC_PYTHON_TESTING_PATH = "/root/python_testing/test_harness_client.py" +DOCKER_RPC_PYTHON_TESTING_PATH = ( + "/root/python_testing/scripts/sdk/test_harness_client.py" +) # Docker Network diff --git a/test_collections/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py b/test_collections/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py index 10070bb5..7174d5a9 100644 --- a/test_collections/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py +++ b/test_collections/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py @@ -34,8 +34,9 @@ class TestRunnerHooks: def main() -> None: - # Load python_testing as a module. This folder is where all python script is located - sys.path.append("/root/python_testing") + # Load python_testing/scripts/sdk as a module. This folder is where all python + # script are located + sys.path.append("/root/python_testing/scripts/sdk") test_args = sys.argv[2:] config = parse_matter_test_args(test_args) diff --git a/test_collections/sdk_tests/support/python_testing/models/utils.py b/test_collections/sdk_tests/support/python_testing/models/utils.py index 80ba44c7..7391b5e5 100644 --- a/test_collections/sdk_tests/support/python_testing/models/utils.py +++ b/test_collections/sdk_tests/support/python_testing/models/utils.py @@ -25,7 +25,7 @@ from test_collections.sdk_tests.support.chip import ChipTool # Command line params -RUNNER_CLASS_PATH = "/root/python_testing/test_harness_client.py" +RUNNER_CLASS_PATH = "/root/python_testing/scripts/sdk/test_harness_client.py" EXECUTABLE = "python3"