All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Subject: [PATCH openbmc-test-automation 37/60] Use argumnet file with pyrobot and added instructions to READEME file.
Date: Mon, 11 Jan 2016 10:50:03 -0600	[thread overview]
Message-ID: <1452531026-13715-38-git-send-email-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <1452531026-13715-1-git-send-email-openbmc-patches@stwcx.xyz>

From: Manjunath A Kumatagi <mkumatag@in.ibm.com>

---
 .gitignore                     |  2 ++
 README.md                      | 18 +++++++++++-
 lib/resource.txt               |  6 ++--
 lib/rest_client.robot          |  8 +++---
 tests/test_ssh.robot           | 64 ------------------------------------------
 tools/generate_argumentfile.sh |  5 ++++
 tox.ini                        | 30 +++++++++-----------
 7 files changed, 45 insertions(+), 88 deletions(-)
 delete mode 100644 tests/test_ssh.robot
 create mode 100755 tools/generate_argumentfile.sh

diff --git a/.gitignore b/.gitignore
index 9f23ed1..8aea548 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
 /log.html
 /output.xml
 /report.html
+/.idea/
+/.tox/
\ No newline at end of file
diff --git a/README.md b/README.md
index f491b6c..589d693 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,18 @@
 #openbmc-automation
-More information needs to be added.
+
+Quickstart
+----------
+
+To run openbmc-automation first you need to install the prerequisite python
+packages which will help to invoke tests through tox.
+
+1. Install the python dependencies for tox
+    $ easy_install tox pip
+
+2. Initilize the following environment variable which will used while testing
+    $ export OPENBMC_HOST=<openbmc machine ip address>
+    $ export OPENBMC_PASSWORD=<openbmc username>
+    $ export OPENBMC_USERNAME=<openbmc password>
+
+3. Run tests
+    $ tox -e tests
diff --git a/lib/resource.txt b/lib/resource.txt
index 5acddcf..c34e026 100644
--- a/lib/resource.txt
+++ b/lib/resource.txt
@@ -5,8 +5,8 @@ Library           RequestsLibrary.RequestsKeywords
 Library           OperatingSystem
 
 *** Variables ***
-${HOST}           192.168.122.100    # openbmc ip address
+${OPENBMC_HOST}           192.168.122.100    # openbmc ip address
 ${PORT}           3000
 ${AUTH_URI}       http://${HOST}:${PORT}
-${USERNAME}       root
-${PASSWORD}       abc123
+${OPENBMC_USERNAME}       root
+${OPENBMC_PASSWORD}       abc123
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
index 1de2b77..45c4226 100644
--- a/lib/rest_client.robot
+++ b/lib/rest_client.robot
@@ -5,12 +5,12 @@ Library           RequestsLibrary.RequestsKeywords
 Library           OperatingSystem
 
 *** Variables ***
-${HOST}           192.168.122.100    # openbmc ip address
+${OPENBMC_HOST}           192.168.122.100    # openbmc ip address
 ${DBUS_PREFIX}    /bus/session
 ${PORT}           3000
-${AUTH_URI}       http://${HOST}:${PORT}
-${USERNAME}       root
-${PASSWORD}       abc123
+${AUTH_URI}       http://${OPENBMC_HOST}:${PORT}
+${OPENBMC_USERNAME}       root
+${OPENBMC_PASSWORD}       abc123
 # Response codes
 ${HTTP_CONTINUE}    100
 ${HTTP_SWITCHING_PROTOCOLS}    101
diff --git a/tests/test_ssh.robot b/tests/test_ssh.robot
deleted file mode 100644
index cabcea0..0000000
--- a/tests/test_ssh.robot
+++ /dev/null
@@ -1,64 +0,0 @@
-*** Settings ***
-Documentation     This example demonstrates executing commands on a remote machine
-...               and getting their output and the return code.
-...
-...               Notice how connections are handled as part of the suite setup and
-...               teardown. This saves some time when executing several test cases.
-Suite Setup       Open Connection And Log In
-Suite Teardown    Close All Connections
-Library           SSHLibrary
-
-*** Variables ***
-${HOST}           192.168.122.100
-${USERNAME}       manjunath
-${PASSWORD}       passw0rd
-
-*** Test Cases ***
-Execute Command And Verify Output
-    [Documentation]    Execute Command can be used to ran commands on the remote machine.
-    ...    The keyword returns the standard output by default.
-    ${output}=    Execute Command    echo Hello SSHLibrary!
-    Should Be Equal    ${output}    Hello SSHLibrary!
-
-Execute Command And Verify Return Code
-    [Documentation]    Often getting the return code of the command is enough.
-    ...    This behaviour can be adjusted as Execute Command arguments.
-    ${rc}=    Execute Command    echo Success guaranteed.    return_stdout=False    return_rc=True
-    Should Be Equal    ${rc}    ${0}
-
-Executing Commands In An Interactive Session
-    [Documentation]    Execute Command always executes the command in a new shell.
-    ...    This means that changes to the environment are not persisted
-    ...    between subsequent Execute Command keyword calls.
-    ...    Write and Read Until variants can be used to operate in the same shell.
-    Write    cd ..
-    Write    echo Hello from the parent directory!
-    ${output}=    Read Until    directory!
-    Should End With    ${output}    Hello from the parent directory!
-
-List all the files
-    [Documentation]    List all the files in the remote machine
-    ${output}    ${stderr}    ${rc}=    Execute Command    ls    return_stderr=True    return_rc=True
-    ${msg}=    Catenate    output:${output}    stderr:${stderr}    rc:${rc}
-    Log To Console    ${msg}
-
-File Not Found
-    [Documentation]    This testcase is for testing ls command with non existing file
-    ${output}    ${stderr}    ${rc}=    Execute Command    ls file_doesnotexist.txt    return_stderr=True    return_rc=True
-    ${msg}=    Catenate    output:${output}    stderr:${stderr}    rc:${rc}
-    Log To Console    ${msg}
-    Should Be Equal    ${rc}    ${2}
-    Should Contain    ${stderr}    No such file or directory
-
-etc passwd entry
-    [Documentation]    This testcase is for testing /etc/passwd entry
-    ${output}    ${stderr}    ${rc}=    Execute Command    grep manjunath /etc/passwd    return_stderr=True    return_rc=True
-    ${msg}=    Catenate    output:${output}    stderr:${stderr}    rc:${rc}
-    Log To Console    ${msg}
-    Should Be Equal    ${rc}    ${0}
-    Should Contain    ${output}    manjunath
-
-*** Keywords ***
-Open Connection And Log In
-    Open Connection    ${HOST}
-    Login    ${USERNAME}    ${PASSWORD}
diff --git a/tools/generate_argumentfile.sh b/tools/generate_argumentfile.sh
new file mode 100755
index 0000000..518a48f
--- /dev/null
+++ b/tools/generate_argumentfile.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo "--variable OPENBMC_HOST:$OPENBMC_HOST" > $ARG_FILE
+echo "--variable OPENBMC_USERNAME:$OPENBMC_USERNAME" >> $ARG_FILE
+echo "--variable OPENBMC_HOST:$OPENBMC_HOST" >> $ARG_FILE
diff --git a/tox.ini b/tox.ini
index fc08416..75ab527 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,32 +1,30 @@
 [tox]
 skipsdist = True
 
-[openbmcenv]
-sitepackages = False
-setenv = VIRTUAL_ENV={envdir}
-deps = setuptools
-       -r{toxinidir}/requirements.txt
-
 [testenv]
+passenv = *
+setenv = ARG_FILE={env:ARG_FILE:/tmp/argument_file.txt}
+whitelist_externals = *
 install_command = pip install -U {opts} {packages}
 deps = -r{toxinidir}/requirements.txt
 commands =
-	python -m robot.run {posargs}
+    python -m robot.run --argumentfile {env:ARG_FILE:/tmp/argument_file.txt} {posargs}
 
 [testenv:full]
-install_command = pip install -U {opts} {packages}
-deps = -r{toxinidir}/requirements.txt
+deps = {[testenv]deps}
+setenv = {[testenv]setenv}
 commands =
-	python -m robot.run .
+    python -m robot.run --argumentfile {env:ARG_FILE:/tmp/argument_file.txt} .
 
 [testenv:tests]
-install_command = pip install -U {opts} {packages}
-deps = -r{toxinidir}/requirements.txt
+deps = {[testenv]deps}
+setenv = {[testenv]setenv}
 commands =
-	python -m robot.run tests
+    bash {toxinidir}/tools/generate_argumentfile.sh
+    python -m robot.run --argumentfile {env:ARG_FILE:/tmp/argument_file.txt} tests
 
 [testenv:custom]
-install_command = pip install -U {opts} {packages}
-deps = -r{toxinidir}/requirements.txt
+deps = {[testenv]deps}
+setenv = {[testenv]setenv}
 commands =
-	python -m robot.run {posargs}
\ No newline at end of file
+    python -m robot.run --argumentfile {env:ARG_FILE:/tmp/argument_file.txt} {posargs}
\ No newline at end of file
-- 
2.6.4

  parent reply	other threads:[~2016-01-11 16:51 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 16:49 [PATCH openbmc-test-automation 00/60] Pull Manjunath's automation repository OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 01/60] first commit OpenBMC Patches
2016-01-12  4:18   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 02/60] added files OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 03/60] Update README.md OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 04/60] added log statement OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 05/60] added testcase for etc passwd OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 06/60] Added git ignore file OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 07/60] Use argumnet file with pyrobot and added instructions to READEME file OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 08/60] Update README for better html display OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 09/60] Added Inventory list testcase OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 10/60] Added DIMM specific inventory tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 11/60] base add for sensor tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 12/60] fixed errors in tox and generate_argumentfile.sh script OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 13/60] fixed review comments OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 14/60] created loops for tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 15/60] Add initial rest test cases Support to test Null properties OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 16/60] Moved Read Attribute and Read Properties to rest_client OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 17/60] fix review comment OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 18/60] Added full sensor suite OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 19/60] Update README.md OpenBMC Patches
2016-01-12  4:21   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 20/60] Added SSL tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 21/60] Handle new rest client from Brad OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 22/60] Ran the tests and fixed errors in SSL tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 23/60] Modified the doc OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 24/60] Added firmware version validation test OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 25/60] update readme file with tox version OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 26/60] Fix errors OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 27/60] Fix Errors in test_obmcrest.robot and removed the empty testcases OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 28/60] Added one more testcase to test non-ssl connection to port 443 OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 29/60] OpenBMC REST Testing OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 30/60] updated the REST API for firmware version OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 31/60] first commit OpenBMC Patches
2016-01-12  5:07   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 32/60] added files OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 33/60] Update README.md OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 34/60] added log statement OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 35/60] added testcase for etc passwd OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 36/60] Added git ignore file OpenBMC Patches
2016-01-11 16:50 ` OpenBMC Patches [this message]
2016-01-11 16:50 ` [PATCH openbmc-test-automation 38/60] Update README for better html display OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 39/60] Added Inventory list testcase OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 40/60] Added DIMM specific inventory tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 41/60] base add for sensor tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 42/60] fixed errors in tox and generate_argumentfile.sh script OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 43/60] fixed review comments OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 44/60] created loops for tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 45/60] Add initial rest test cases Support to test Null properties OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 46/60] Moved Read Attribute and Read Properties to rest_client OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 47/60] fix review comment OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 48/60] Added full sensor suite OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 49/60] Update README.md OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 50/60] Added SSL tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 51/60] Handle new rest client from Brad OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 52/60] Ran the tests and fixed errors in SSL tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 53/60] Modified the doc OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 54/60] Added firmware version validation test OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 55/60] update readme file with tox version OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 56/60] Fix errors OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 57/60] Fix Errors in test_obmcrest.robot and removed the empty testcases OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 58/60] Added one more testcase to test non-ssl connection to port 443 OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 59/60] OpenBMC REST Testing OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 60/60] updated the REST API for firmware version OpenBMC Patches
2016-01-12  0:00 ` [PATCH openbmc-test-automation 00/60] Pull Manjunath's automation repository Daniel Axtens
2016-01-12  0:10 ` Cyril Bur
2016-01-12  9:35   ` Manjunath A Kumatagi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452531026-13715-38-git-send-email-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.