From 1ce7d9cdaa4db767ac0ba7ab4e15cf4df3b47881 Mon Sep 17 00:00:00 2001 From: Ville-Pekka Juntunen Date: Fri, 16 Aug 2024 14:37:42 +0300 Subject: [PATCH 1/3] Add orin-nx and lenovo-x1 boot tests Add orin-nx and lenovo-x1 boot tests to ghah-infra mainline. Signed-off-by: Ville-Pekka Juntunen --- ghaf-main-pipeline.groovy | 5 +++++ ghaf-test-boot.groovy | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/ghaf-main-pipeline.groovy b/ghaf-main-pipeline.groovy index 3143bf8..4117ac7 100644 --- a/ghaf-main-pipeline.groovy +++ b/ghaf-main-pipeline.groovy @@ -52,6 +52,8 @@ pipeline { utils.nix_build('.#packages.x86_64-linux.nvidia-jetson-orin-nx-debug-from-x86_64', 'archive') utils.nix_build('.#packages.x86_64-linux.lenovo-x1-carbon-gen11-debug', 'archive') utils.nix_build('.#packages.riscv64-linux.microchip-icicle-kit-debug', 'archive') + // Build, but don't archive the build results: + utils.nix_build('.#packages.x86_64-linux.generic-x86_64-debug') utils.nix_build('.#packages.x86_64-linux.doc') } } @@ -75,6 +77,9 @@ pipeline { jenkins_url = "https://ghaf-jenkins-controller-dev.northeurope.cloudapp.azure.com" utils.boot_test('.#packages.x86_64-linux.nvidia-jetson-orin-agx-debug-from-x86_64', 'orin-agx', jenkins_url) utils.boot_test('.#packages.aarch64-linux.nvidia-jetson-orin-agx-debug', 'orin-agx', jenkins_url) + utils.boot_test('.#packages.x86_64-linux.nvidia-jetson-orin-nx-debug-from-x86_64', 'orin-nx', jenkins_url) + utils.boot_test('.#packages.aarch64-linux.nvidia-jetson-orin-nx-debug', 'orin-nx', jenkins_url) + utils.boot_test('.#packages.x86_64-linux.lenovo-x1-carbon-gen11-debug', 'lenovo-x1', jenkins_url) } } } diff --git a/ghaf-test-boot.groovy b/ghaf-test-boot.groovy index cbceddc..226a16e 100644 --- a/ghaf-test-boot.groovy +++ b/ghaf-test-boot.groovy @@ -94,6 +94,26 @@ pipeline { 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 if(["orin-nx"].contains(params.DEVICE_CONFIG_NAME)) { + // Device-sepcific configuration needed in other steps are passed + // as environment variables + env.DEVICE = 'OrinNX1' + env.INCLUDE_TEST_TAGS = 'bootANDorin-nx' + // 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 if(["lenovo-x1"].contains(params.DEVICE_CONFIG_NAME)) { + // Device-sepcific configuration needed in other steps are passed + // as environment variables + env.DEVICE = 'LenovoX1-2' + env.INCLUDE_TEST_TAGS = 'bootANDlenovo-x1' + // 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" @@ -103,6 +123,19 @@ pipeline { // Read the device name dev = run_cmd("lsblk -o model,name | grep ${devstr} | rev | cut -d ' ' -f 1 | rev | grep .") println "Using device '$dev'" + if(["lenovo-x1"].contains(params.DEVICE_CONFIG_NAME)) { + echo "Wiping filesystem..." + def SECTOR = 512 + def MIB_TO_SECTORS = 20480 + // Disk size in 512-byte sectors + def SECTORS = sh(script: "sudo blockdev --getsz /dev/${dev}", returnStdout: true).trim() + // Unmount possible mounted filesystems + sh "sync; sudo umount -q /dev/${dev}* || true" + // Wipe first 10MiB of disk + sh "sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} conv=fsync status=none" + // Wipe last 10MiB of disk + sh "sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} seek=\$(( ${SECTORS} - ${MIB_TO_SECTORS} )) conv=fsync status=none" + } // Write the image img_relpath = run_cmd("find ${TMP_IMG_DIR} -type f -print -quit | grep .") println "Using image '$img_relpath'" @@ -125,6 +158,8 @@ pipeline { withCredentials([ string(credentialsId: 'testagent-dut-pass', variable: 'DUT_PASS'), string(credentialsId: 'testagent-plug-pass', variable: 'PLUG_PASS'), + string(credentialsId: 'testagent-switch-token', variable: 'SW_TOKEN'), + string(credentialsId: 'testagent-switch-secret', variable: 'SW_SECRET'), ]) { dir('Robot-Framework/test-suites') { sh 'rm -f *.png output.xml report.html log.html' @@ -139,6 +174,8 @@ pipeline { -v PASSWORD:$DUT_PASS \ -v PLUG_USERNAME:ville-pekka.juntunen@unikie.com \ -v PLUG_PASSWORD:$PLUG_PASS \ + -v SWITCH_TOKEN:$SW_TOKEN \ + -v SWITCH_SECRET:$SW_SECRET \ -i $INCLUDE_TEST_TAGS . ''' } From b27e574b7a5de55e9936b60d9bed0387a88a80bc Mon Sep 17 00:00:00 2001 From: Henri Rosten Date: Fri, 16 Aug 2024 15:37:28 +0300 Subject: [PATCH 2/3] Simplify boot test flashing stage Signed-off-by: Henri Rosten --- ghaf-test-boot.groovy | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/ghaf-test-boot.groovy b/ghaf-test-boot.groovy index 226a16e..f06b589 100644 --- a/ghaf-test-boot.groovy +++ b/ghaf-test-boot.groovy @@ -83,45 +83,26 @@ pipeline { println "Missing DEVICE_CONFIG_NAME parameter" sh "exit 1" } - mount_cmd = unmount_cmd = devstr = null if(["orin-agx"].contains(params.DEVICE_CONFIG_NAME)) { - // 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 if(["orin-nx"].contains(params.DEVICE_CONFIG_NAME)) { - // Device-sepcific configuration needed in other steps are passed - // as environment variables env.DEVICE = 'OrinNX1' env.INCLUDE_TEST_TAGS = 'bootANDorin-nx' - // 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 if(["lenovo-x1"].contains(params.DEVICE_CONFIG_NAME)) { - // Device-sepcific configuration needed in other steps are passed - // as environment variables env.DEVICE = 'LenovoX1-2' env.INCLUDE_TEST_TAGS = 'bootANDlenovo-x1' - // 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" } + hub_serial = get_test_conf_property(CONF_FILE_PATH, env.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}" // Mount the target disk sh "${mount_cmd}" // Read the device name - dev = run_cmd("lsblk -o model,name | grep ${devstr} | rev | cut -d ' ' -f 1 | rev | grep .") + dev = run_cmd("lsblk -o model,name | grep 'PSSD' | rev | cut -d ' ' -f 1 | rev | grep .") println "Using device '$dev'" if(["lenovo-x1"].contains(params.DEVICE_CONFIG_NAME)) { echo "Wiping filesystem..." From c0d013ab6ad4f2eb52e9143f636278c6ee11f500 Mon Sep 17 00:00:00 2001 From: Henri Rosten Date: Mon, 19 Aug 2024 13:05:20 +0300 Subject: [PATCH 3/3] Fix sudo usage in wiping lenovo-x1 Signed-off-by: Henri Rosten --- ghaf-test-boot.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghaf-test-boot.groovy b/ghaf-test-boot.groovy index f06b589..ac4593b 100644 --- a/ghaf-test-boot.groovy +++ b/ghaf-test-boot.groovy @@ -109,13 +109,13 @@ pipeline { def SECTOR = 512 def MIB_TO_SECTORS = 20480 // Disk size in 512-byte sectors - def SECTORS = sh(script: "sudo blockdev --getsz /dev/${dev}", returnStdout: true).trim() + def SECTORS = sh(script: "/run/wrappers/bin/sudo blockdev --getsz /dev/${dev}", returnStdout: true).trim() // Unmount possible mounted filesystems - sh "sync; sudo umount -q /dev/${dev}* || true" + sh "sync; /run/wrappers/bin/sudo umount -q /dev/${dev}* || true" // Wipe first 10MiB of disk - sh "sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} conv=fsync status=none" + sh "/run/wrappers/bin/sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} conv=fsync status=none" // Wipe last 10MiB of disk - sh "sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} seek=\$(( ${SECTORS} - ${MIB_TO_SECTORS} )) conv=fsync status=none" + sh "/run/wrappers/bin/sudo dd if=/dev/zero of=/dev/${dev} bs=${SECTOR} count=${MIB_TO_SECTORS} seek=\$(( ${SECTORS} - ${MIB_TO_SECTORS} )) conv=fsync status=none" } // Write the image img_relpath = run_cmd("find ${TMP_IMG_DIR} -type f -print -quit | grep .")