From cee42ce5f2cfd0c109f6ef48f5709f95bafce41b Mon Sep 17 00:00:00 2001 From: Ville-Pekka Juntunen Date: Thu, 11 Jul 2024 14:57:52 +0300 Subject: [PATCH] Adds get_test_conf_property function Adds fucntion to ghaf-test-boot pipeline to get wanted property from test-config.json Adds that in use to get usb hub serial. Signed-off-by: Ville-Pekka Juntunen --- ghaf-test-boot.groovy | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ghaf-test-boot.groovy b/ghaf-test-boot.groovy index b294f05..cbceddc 100644 --- a/ghaf-test-boot.groovy +++ b/ghaf-test-boot.groovy @@ -8,6 +8,7 @@ def REPO_URL = 'https://github.com/tiiuae/ci-test-automation/' def DEF_LABEL = 'testagent' def TMP_IMG_DIR = 'image' +def CONF_FILE_PATH = '/etc/jenkins/test_config.json' //////////////////////////////////////////////////////////////////////////////// @@ -16,6 +17,13 @@ def run_cmd(String cmd) { return sh(script: cmd, returnStdout:true).trim() } +def get_test_conf_property(file_path, device, property) { + // get wanted property data from wanted device from test_config.json file + def device_data = readJSON file: file_path + property_data = "${device_data['addresses'][device][property]}" + return property_data +} + //////////////////////////////////////////////////////////////////////////////// pipeline { @@ -77,13 +85,15 @@ pipeline { } mount_cmd = unmount_cmd = devstr = null if(["orin-agx"].contains(params.DEVICE_CONFIG_NAME)) { - mount_cmd = '/run/wrappers/bin/sudo AcronameHubCLI -u 0 -s 0x2954223B; sleep 10' - unmount_cmd = '/run/wrappers/bin/sudo AcronameHubCLI -u 1 -s 0x2954223B' - devstr = 'PSSD' // Device-sepcific configuration needed in other steps are passed // as environment variables env.DEVICE = 'OrinAGX1' env.INCLUDE_TEST_TAGS = 'bootANDorin-agx' + // get usb hub serial number from test_config.json + hub_serial = get_test_conf_property(CONF_FILE_PATH, DEVICE, 'usbhub_serial') + mount_cmd = "/run/wrappers/bin/sudo AcronameHubCLI -u 0 -s ${hub_serial}; sleep 10" + unmount_cmd = "/run/wrappers/bin/sudo AcronameHubCLI -u 1 -s ${hub_serial}" + devstr = 'PSSD' } else { println "Error: unsupported device config '${params.DEVICE_CONFIG_NAME}'" sh "exit 1" @@ -156,4 +166,4 @@ pipeline { } } -//////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////////////////////////////////////