Skip to content

[run_tests] improve run_tests.sh's usability#1990

Merged
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:run_test
Jul 29, 2020
Merged

[run_tests] improve run_tests.sh's usability#1990
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:run_test

Conversation

@yxieca
Copy link
Copy Markdown
Collaborator

@yxieca yxieca commented Jul 29, 2020

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

Making run_tests.sh more user friendly.

How did you do it?

  • Skip folder scripts, this folder contains helper scripts. Not intended to hold test cases.
  • Allow issue -c -e -s multiple times, so user could issue each value (pair) with an option.

Signed-off-by: Ying Xie ying.xie@microsoft.com

How did you verify/test it?

yinxi@acs-trusty8:/var/src/sonic-mgmt/tests$ ./run_tests.sh -d str-dx010-acs-1 -n vms3-t1-dx010-1 -i /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos -u -p /tmp/logs-01 -m debug -c test_a -c test_b -s test_c -s test_d -e param_1 -e "param2 2"
=== Show test settings ===
SCRIPT: ./run_tests.sh
FULL_PATH: /var/src/sonic-mgmt/tests/run_tests.sh
SCRIPT_PATH: /var/src/sonic-mgmt/tests
BASE_PATH: /var/src/sonic-mgmt
ANSIBLE_CONFIG: /var/src/sonic-mgmt/ansible
ANSIBLE_LIBRARY: /var/src/sonic-mgmt/ansible/library/
BYPASS_UTIL: True
CLI_LOG_LEVEL: warning
EXTRA_PARAMETERS: param_1 param2 2
FILE_LOG_LEVEL: debug
INVENTORY: /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos
LOG_PATH: /tmp/logs-01
OMIT_FILE_LOG: False
RETAIN_SUCCESS_LOG: False
SKIP_SCRIPTS: test_c test_d
SKIP_FOLDERS: ptftests acstests saitests scripts
TEST_CASES: test_a test_b
TEST_METHOD: debug
TESTBED_FILE: /var/src/sonic-mgmt/ansible/testbed.csv
TEST_LOGGING_OPTIONS: --junit-xml=/tmp/logs-01/tr.xml --log-file=/tmp/logs-01/test.log
TEST_TOPOLOGY_OPTIONS:
PRET_LOGGING_OPTIONS: --junit-xml=/tmp/logs-01/pretest.xml --log-file=/tmp/logs-01/pretest.log
POST_LOGGING_OPTIONS: --junit-xml=/tmp/logs-01/posttest.xml --log-file=/tmp/logs-01/posttest.log
UTIL_TOPOLOGY_OPTIONS: --topology util
PYTEST_COMMON_OPTS: --inventory /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos --host-pattern str-dx010-acs-1 --testbed vms3-t1-dx010-1 --testbed_file /var/src/sonic-mgmt/ansible/testbed.csv --log-cli-level warning --log-file-level debug --allow_recover --showlocals --assert plain --show-capture no -rav --ignore=test_c --ignore=test_d --ignore=ptftests --ignore=acstests --ignore=saitests --ignore=scripts

- Skip folder scripts, this folder contains helper scripts. Not intended to hold test cases.
- Allow issue -c -e -s multiple times, so user could issue each value (pair) with an option.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@yxieca yxieca requested a review from a team July 29, 2020 14:42
;;
e )
EXTRA_PARAMETERS=${OPTARG}
EXTRA_PARAMETERS="${EXTRA_PARAMETERS} ${OPTARG}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this consumed in the testcase? How do we differentiate between single arg vs key value pair?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest would handle the difference, the script would just pass the parameter list to pytest.

@yxieca
Copy link
Copy Markdown
Collaborator Author

yxieca commented Jul 29, 2020

This change is more useful for human user than to a repeated scheduled tests. For instance, one is running a test manually and want to check another test also, then he/she can simple add another -c another_test to the command line instead of changing the existing -c original_test to -c "original_test another_test" and having to add the quotes.

@yxieca yxieca merged commit 0a59218 into sonic-net:master Jul 29, 2020
@yxieca yxieca deleted the run_test branch July 29, 2020 16:40
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Commits:
f147d9e - 2021-10-27 : [Mux orch] Handle setting unknown mux state (sonic-net#1984) [Prince Sunny]
4618b2b - 2021-10-28 : Change tunnel orch order (sonic-net#1990) [Prince Sunny]
505d52d - 2021-10-20 : Fix the option missing in kernel config issue (sonic-net#1973) [xumia]
7bf4dfb - 2021-10-18 : SAI_REDIS_SWITCH_ATTR_CONTEXT shouldbe the last attribute. This is what sairedis library expects (sonic-net#1935) [judyjoseph]
c58919e - 2021-10-08 : [logfile][202012]: Add option to specify swss rec file name (sonic-net#1946) [judyjoseph]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants