From patchwork Wed Aug 15 05:41:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 957797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41qyyX4rPnz9sBq for ; Wed, 15 Aug 2018 15:41:56 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="cNa/A5tE"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41qyyX30LrzF1bR for ; Wed, 15 Aug 2018 15:41:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="cNa/A5tE"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41qyyR4SHVzF1Rc for ; Wed, 15 Aug 2018 15:41:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="cNa/A5tE"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41qyyR1sZLz9sBW; Wed, 15 Aug 2018 15:41:51 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1534311711; bh=UsNuP0acNxnsbgMAImWgWxA4zq4h5JAn4ENAEOu4r9A=; h=From:To:Cc:Subject:Date:From; b=cNa/A5tEU4XW5eOWXZ4rMFpz9BsHnaQY9M36PI7DS22dQAQU1eyhRiB3AwerTYvgg +PAmjjqjk323oJ04nu3PGtEsyaiR4WEcbOLIK1UYpljj3mtJwYJQ5us4wjR1fBy0V0 3B7zZdR1qMY5Z7oFOJULN7actE3JChKZA3q5bfq6OnnvpdHGVTL4Ny3n7XhYP3NBm7 UvXVgiWs/QqvZmLYLTJMKdQk/2hvnXT602stNQ1s8BYJlzraJGGp4qg4GW72a4k+UB lrsfhxswRxk51qxNTFlXiihrui1EEcbETyCKvbb90pO6TPYvxjDgwv+QwKejW3Cazn JzWHdYaJveS/A== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 15 Aug 2018 15:41:48 +1000 Message-Id: <20180815054148.883478-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 Subject: [Pdbg] [PATCH v2] tests: Add bmc hw tests X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" From: Alistair Popple Alistair, Here's reworked bmc hw test based on the updates to the test driver. This uses .test.bmc file to set up environment for the tests. Following variables are needed: BMC_HOST BMC_USER BMC_PASS PDBG_ARM_BUILD v2: I have dropped "-d p8" from PDBG command line. This was for my testing with palmetto. --- Makefile.am | 3 +- tests/test_hw_bmc.sh | 113 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100755 tests/test_hw_bmc.sh diff --git a/Makefile.am b/Makefile.am index a3f1bcf..fb8a270 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,8 @@ bin_PROGRAMS = pdbg check_PROGRAMS = optcmd_test PDBG_TESTS = \ - tests/test_selection.sh + tests/test_selection.sh \ + tests/test_hw_bmc.sh TESTS = optcmd_test $(PDBG_TESTS) diff --git a/tests/test_hw_bmc.sh b/tests/test_hw_bmc.sh new file mode 100755 index 0000000..7054181 --- /dev/null +++ b/tests/test_hw_bmc.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +. $(dirname "$0")/driver.sh + +BMC_TEST=".test.bmc" + +BMC_HOST= +BMC_USER= +BMC_PASS= + +PDBG_ARM_BUILD= +PDBG_PATH=/tmp/pdbg +PDBG=${PDBG_PATH}/pdbg + +load_config () +{ + if [ ! -f "$BMC_TEST" ] ; then + echo "Missing file $BMC_TEST, skipping tests" + return 77 + fi + + fail=0 + . "$BMC_TEST" + + for var in "BMC_HOST" "BMC_USER" "BMC_PASS" "PDBG_ARM_BUILD"; do + eval value="\$$var" + if [ -z "$value" ] ; then + echo "$var not defined in $BMC_TEST" + fail=1 + fi + done + + return $fail +} + +copy_pdbg () +{ + sshpass -p "$BMC_PASS" \ + rsync -Pav "${PDBG_ARM_BUILD}/.libs/"* \ + ${BMC_USER}@${BMC_HOST}:${PDBG_PATH} +} + +test_wrapper () +{ + sshpass -p "$BMC_PASS" \ + ssh ${BMC_USER}@${BMC_HOST} \ + LD_LIBRARY_PATH="${PDBG_PATH}" \ + "$@" +} + +test_setup load_config +test_setup copy_pdbg + +test_group "BMC HW tests" + +hw_state=0 + +do_skip () +{ + if [ $hw_state -ne 1 ] ; then + test_skip + fi +} + +echo -n "Checking if the host is up... " +output=$(test_wrapper /usr/sbin/obmcutil state | grep CurrentHostState) +rc=$? +if [ $rc -ne 0 ] || \ + [ "$output" != "xyz.openbmc_project.State.Host.HostState.Running" ] ; then + echo "yes" + hw_state=1 +else + echo "no" +fi + +result_filter () +{ + sed -E -e 's#0x[[:xdigit:]]{16}#HEX16#' \ + -E -e 's#0x[[:xdigit:]]{8}#HEX8#' +} + +test_result 0 <