[PATCH v2] cmd:Elaborate 'blkcache' cmd HELP statement

2021-06-30 Thread opensource . kab
From: Adarsh Babu Kalepalli 

HELP description is provided for ‘configure’ sub-command
of ‘blkcache’.

Signed-off-by: Adarsh Babu Kalepalli 
---

(no changes since v1)

 cmd/blkcache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/blkcache.c b/cmd/blkcache.c
index 25f252e455..47ea1ec0b9 100644
--- a/cmd/blkcache.c
+++ b/cmd/blkcache.c
@@ -83,5 +83,6 @@ U_BOOT_CMD(
blkcache, 4, 0, do_blkcache,
"block cache diagnostics and control",
"show - show and reset statistics\n"
-   "blkcache configure blocks entries\n"
+   "blkcache configure   "
+   "- set max blocks per entry and max cache entries\n"
 );
-- 
2.17.1



[PATCH] doc/usage: cmd-usage help file for askenv

2021-06-11 Thread opensource . kab
From: Adarsh Babu Kalepalli 

help file for using askenv cmd is created.
It provides description on the command purpose,
description of arguments,
couple of examples (illustrating command usage),
configuration parameter and
possible return values.

Signed-off-by: Adarsh Babu Kalepalli 
---

 doc/usage/askenv.rst | 87 
 1 file changed, 87 insertions(+)
 create mode 100644 doc/usage/askenv.rst

diff --git a/doc/usage/askenv.rst b/doc/usage/askenv.rst
new file mode 100644
index 00..5c4ca35d4c
--- /dev/null
+++ b/doc/usage/askenv.rst
@@ -0,0 +1,87 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+askenv command
+===
+
+Synopsis
+
+
+::
+
+askenv name [message] [size]
+
+Description
+---
+
+Display message and get environment variable name of max size characters
+from stdin.
+
+name
+name of the environment variable
+
+message
+message is displayed while the command waits for the  value to be
+entered from stdin.if no message is specified,a default message
+"Please enter name:" will be displayed.
+
+size
+maximum number of characters that will be stored in environment
+variable name.this is in decimal number format (unlike in
+other commands where size values are in hexa-decimal). Default
+value of size is 1023 (CONFIG_SYS_CBSIZE - 1).
+
+Example
+---
+
+Value of a environment variable env1 without message and size parameters:
+
+::
+
+=> askenv env1;echo $?
+Please enter 'env1': val1
+0
+=> printenv env1
+env1=val1
+
+Value of a environment variable env2 with message and size parameters:
+
+::
+
+=> askenv env2 Please type-in a value for env2: 10;echo $?
+Please type-in a value for env2: 1234567890123
+0
+=> printenv env2
+env2=1234567890
+
+Value of a environment variable env3 with size parameter only:
+
+::
+
+=> askenv env3 10;echo $?
+Please enter 'env3': val3
+0
+=> printenv env3
+env3=val3
+
+Return Value of askenv command, when used without any other arguments:
+
+::
+
+=> askenv;echo $?
+askenv - get environment variables from stdin
+
+Usage:
+askenv name [message] [size]
+- display 'message' and get environment variable 'name' from stdin 
(max 'size' chars)
+1
+
+Configuration
+-
+
+The askenv command is only available if CMD_ASKENV=y
+
+Return value
+
+
+The return value $? is set to 0 (true).
+If no other arguments are specified (along with askenv), it is set to 1 
(false).
-- 
2.17.1



[PATCH] cmd:Update HELP text of ’askenv’

2021-06-01 Thread opensource . kab
From: Adarsh Babu Kalepalli 

Help text of ‘askenv’ cmd is updated

Signed-off-by: Adarsh Babu Kalepalli 
---

 cmd/nvedit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index d14ba10cef..910cf16aaf 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -1569,7 +1569,7 @@ U_BOOT_CMD(
askenv, CONFIG_SYS_MAXARGS, 1,  do_env_ask,
"get environment variables from stdin",
"name [message] [size]\n"
-   "- get environment variable 'name' from stdin (max 'size' chars)"
+   "- display 'message' and get environment variable 'name' from stdin 
(max 'size' chars)"
 );
 #endif
 
-- 
2.17.1



[PATCH] cmd:Elaborate ‘blkcache’ cmd HELP statement

2021-05-31 Thread opensource . kab
From: Adarsh Babu Kalepalli 

"HELP description is provided for ‘configure’ sub-command
of ‘blkcache’.

Signed-off-by: Adarsh Babu Kalepalli 
---

 cmd/blkcache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/blkcache.c b/cmd/blkcache.c
index 25f252e455..89ae52150a 100644
--- a/cmd/blkcache.c
+++ b/cmd/blkcache.c
@@ -84,4 +84,5 @@ U_BOOT_CMD(
"block cache diagnostics and control",
"show - show and reset statistics\n"
"blkcache configure blocks entries\n"
+   "   - configure 'max blocks/entry' to 'blocks' and 'max cache 
entries' to 'entries'\n"
 );
-- 
2.17.1



[PATCH] test/py:Update python tests for ‘gpio’ cmd

2021-05-31 Thread opensource . kab
From: Adarsh Babu Kalepalli 

Generic Python Test cases are developed to verfiy 'gpio' command.

Signed-off-by: Adarsh Babu Kalepalli 
---

 test/py/tests/test_gpio.py | 175 -
 1 file changed, 174 insertions(+), 1 deletion(-)

diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py
index 8c64f686b0..109649e2c7 100644
--- a/test/py/tests/test_gpio.py
+++ b/test/py/tests/test_gpio.py
@@ -1,6 +1,16 @@
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier:  GPL-2.0+
+#
+# Copyright (c) 2021 Adarsh Babu Kalepalli 
+# Copyright (c) 2020 Alex Kiernan 
 
 import pytest
+import time
+import u_boot_utils
+
+"""
+   test_gpio_input is intended to test the fix 4dbc107f4683.
+   4dbc107f4683:"cmd: gpio: Correct do_gpio() return value"
+"""
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpio')
@@ -35,3 +45,166 @@ def test_gpio_exit_statuses(u_boot_console):
 assert(expected_response in response)
 response = u_boot_console.run_command('gpio input 200; echo rc:$?')
 assert(expected_response in response)
+
+
+"""
+Generic Tests for 'gpio' command on sandbox and real hardware.
+The below sequence of tests rely on env__gpio_dev_config for configuration 
values of gpio pins.
+
+ Configuration data for gpio command.
+ The  set,clear,toggle ,input and status options of 'gpio' command are 
verified.
+ For sake of verification,A  LED/buzzer could be connected to GPIO pins 
configured as O/P.
+ Logic level '1'/'0' can be applied onto GPIO pins configured as I/P
+
+
+env__gpio_dev_config = {
+#the number of 'gpio_str_x' strings should equal to
+#'gpio_str_count' value
+'gpio_str_count':4 ,
+'gpio_str_1': '0',
+'gpio_str_2': '31',
+'gpio_str_3': '63',
+'gpio_str_4': '127',
+'gpio_op_pin': '64',
+'gpio_ip_pin_set':'65',
+'gpio_ip_pin_clear':'66',
+'gpio_clear_value': 'value is 0',
+'gpio_set_value': 'value is 1',
+}
+"""
+
+
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_status_all_generic(u_boot_console):
+"""Test the 'gpio status' command.
+
+   Displays all gpio pins available on the Board.
+   To verify if the status of pins is displayed or not,
+the user can configure (gpio_str_count) and verify existence of certain
+   pins.The details of these can be configured in 'gpio_str_n'.
+of boardenv_* (example above).User can configure any
+number of such pins and mention that count in 'gpio_str_count'.
+"""
+
+f = u_boot_console.config.env.get('env__gpio_dev_config',False)
+if not f:
+pytest.skip("gpio not configured")
+
+gpio_str_count = f['gpio_str_count']
+
+#Display all the GPIO ports
+cmd = 'gpio status -a'
+response = u_boot_console.run_command(cmd)
+
+for str_value in range(1,gpio_str_count + 1):
+assert f["gpio_str_%d" %(str_value)] in response
+
+
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_set_generic(u_boot_console):
+"""Test the 'gpio set' command.
+
+   A specific gpio pin configured by user as output
+(mentioned in gpio_op_pin) is verified for
+   'set' option
+
+"""
+
+f = u_boot_console.config.env.get('env__gpio_dev_config',False)
+if not f:
+pytest.skip("gpio not configured")
+
+gpio_pin_adr = f['gpio_op_pin'];
+gpio_set_value = f['gpio_set_value'];
+
+
+cmd = 'gpio set ' + gpio_pin_adr
+response = u_boot_console.run_command(cmd)
+good_response = gpio_set_value
+assert good_response in response
+
+
+
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_clear_generic(u_boot_console):
+"""Test the 'gpio clear' command.
+
+   A specific gpio pin configured by user as output
+(mentioned in gpio_op_pin) is verified for
+   'clear' option
+"""
+
+f = u_boot_console.config.env.get('env__gpio_dev_config',False)
+if not f:
+pytest.skip("gpio not configured")
+
+gpio_pin_adr = f['gpio_op_pin'];
+gpio_clear_value = f['gpio_clear_value'];
+
+
+cmd = 'gpio clear ' + gpio_pin_adr
+response = u_boot_console.run_command(cmd)
+good_response = gpio_clear_value
+assert good_response in response
+
+
+@pytest.mark.buildconfigspec('cmd_gpio')
+def test_gpio_toggle_generic(u_boot_console):
+"""Test the 'gpio toggle' command.
+
+   A specific gpio pin configured by user as output
+(mentioned in gpio_op_pin) is verified for
+   'toggle' option
+"""
+
+
+f = u_boot_console.config.env.get('env__gpio_dev_config',False)
+if not f:
+pytest.skip("gpio not configured")
+
+gpio_pin_adr = f['gpio_op_pin'];
+gpio_set_value = f['gpio_set_value'];
+gpio_clear_value = f['gpio_clear_value'];
+
+cmd = 'gpio set ' + gpio_pin_adr
+response = u_boot_console.run_command(cmd)
+good_response = gpio_set_value
+assert good_response in response
+
+cmd = 'gpio t

[PATCH] pytest:Shutdown power-supply to board after the pytest execution

2021-05-27 Thread opensource . kab
From: Adarsh Babu Kalepalli 

After executing the test-cases from pytest ,the board
is still powered.Shutting down the board power supply at
this point ,would keep the board safe.

Signed-off-by: Adarsh Babu Kalepalli 
---

 test/py/conftest.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 11a3f307ea..077358a37f 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -406,6 +406,13 @@ def cleanup():
 """
 
 if console:
+if ((console.config.board_type != "sandbox") and 
(console.config.board_type != "sandbox64")):
+args = [console.config.board_type, console.config.board_identity]
+console.log.action('Powering Down the board')
+cmd = ['u-boot-test-power-off'] + args
+runner = console.log.get_runner(cmd[0], sys.stdout)
+runner.run(cmd)
+runner.close()
 console.close()
 if log:
 with log.section('Status Report', 'status_report'):
-- 
2.17.1



[PATCH] cmd:(cosmetic)Mentioned in 'chpart' command HELP text that it is for MTD devices

2021-05-24 Thread opensource . kab
From: Adarsh Babu Kalepalli 

Modified the help text of 'chpart' command ,mentioning that it is
for MTD devices.

Signed-off-by: Adarsh Babu Kalepalli 
---

 cmd/mtdparts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index ed373a8c4d..3048700778 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -2077,9 +2077,9 @@ static int do_mtdparts(struct cmd_tbl *cmdtp, int flag, 
int argc,
 /***/
 U_BOOT_CMD(
chpart, 2,  0,  do_chpart,
-   "change active partition",
+   "change active partition of a MTD device",
"part-id\n"
-   "- change active partition (e.g. part-id = nand0,1)"
+   "- change active partition (e.g. part-id = nand0,1) of a MTD device"
 );
 
 #ifdef CONFIG_SYS_LONGHELP
-- 
2.17.1