Skip to content

Commit 3753885

Browse files
authored
Merge pull request #358 from AYUSHJAIN951/configupdate
Add config option for env and norun configurations and Update README
2 parents f0222dd + f8d46c5 commit 3753885

File tree

2 files changed

+85
-45
lines changed

2 files changed

+85
-45
lines changed

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,47 +61,48 @@ It is highly recommended for users to execute the following command as root when
6161

6262
```
6363
$ ./avocado-setup.py -h
64-
usage: avocado-setup.py [-h] [--bootstrap] [--run-suite RUN_SUITE]
65-
[--output-dir OUTPUTDIR] [--use-test-dir]
66-
[--input-file INPUTFILE]
67-
[--interval-time INTERVAL] [--verbose]
68-
[--only-filter ONLY_FILTER] [--no-filter NO_FILTER]
69-
[--additional-args ADD_ARGS] [--guest-os GUEST_OS]
70-
[--vt {qemu,libvirt}] [--install] [--no-download]
71-
[--no-deps-check] [--install-deps] [--clean]
72-
[--enable-kvm]
73-
74-
optional arguments:
75-
-h, --help show this help message and exit
76-
--bootstrap Prepare the environment for test
77-
--run-suite RUN_SUITE
64+
usage: avocado-setup.py [-h] [--bootstrap] [--run-suite RUN_SUITE] [--output-dir OUTPUTDIR]
65+
[--use-test-dir] [--input-file INPUTFILE] [--interval-time INTERVAL]
66+
[--verbose] [--only-filter ONLY_FILTER] [--no-filter NO_FILTER]
67+
[--additional-args ADD_ARGS] [--guest-os GUEST_OS] [--vt {qemu,libvirt}]
68+
[--install] [--no-download] [--no-deps-check] [--install-deps] [--clean]
69+
[--enable-kvm] [--nrunner] [--run-tests RUN_TESTS] [--config-env CONFIG_PATH]
70+
[--config-norun NORUNTEST_PATH]
71+
72+
options:
73+
-h, --help show this help message and exit
74+
--bootstrap Prepare the environment for test
75+
--run-suite RUN_SUITE
7876
Indicate which test suite(s) to run
79-
--output-dir OUTPUTDIR
77+
--output-dir OUTPUTDIR
8078
Specify the custom test results directory
81-
--use-test-dir Use corresponding test-name dir for storing job results
82-
--input-file INPUTFILE
83-
Specify input file for custom mux values for host
84-
tests
85-
--interval-time INTERVAL
79+
--use-test-dir Use corresponding test-name dir for storing job results
80+
--input-file INPUTFILE
81+
Specify input file for custom mux values for host tests
82+
--interval-time INTERVAL
8683
Specify the interval time between tests
87-
--verbose Enable verbose output on the console
88-
--only-filter ONLY_FILTER
89-
Add filters to include specific avocado tests,features
90-
from the guest test suite
91-
--no-filter NO_FILTER
92-
Add filters to exclude specific avocado tests,features
93-
from the guest test suite
94-
--additional-args ADD_ARGS
84+
--verbose Enable verbose output on the console
85+
--only-filter ONLY_FILTER
86+
Add filters to include specific avocado tests,features from the guest test suite
87+
--no-filter NO_FILTER
88+
Add filters to exclude specific avocado tests,features from the guest test suite
89+
--additional-args ADD_ARGS
9590
Pass additional arguments to the command
96-
--guest-os GUEST_OS Provide Guest os: Default: JeOS.27.ppc64le
97-
--vt {qemu,libvirt} Provide VT: qemu or libvirt Default: libvirt
98-
--install Install the Guest VM, if needed.
99-
--no-download To download the preinstalled guest image
100-
--no-deps-check To force wrapper not to check for dependancy packages
101-
--install-deps To force wrapper to install dependancy packages (Only
102-
for Ubuntu, SLES and yum based OS)
103-
--clean To remove/uninstall autotest, avocado from system
104-
--enable-kvm enable bootstrap kvm tests
91+
--guest-os GUEST_OS Provide Guest os: Default: JeOS.27.ppc64le
92+
--vt {qemu,libvirt} Provide VT: qemu or libvirt Default: libvirt
93+
--install Install the Guest VM, if needed.
94+
--no-download To download the preinstalled guest image
95+
--no-deps-check To force wrapper not to check for dependancy packages
96+
--install-deps To force wrapper to install dependancy packages (Only for Ubuntu, SLES and yum based OS)
97+
--clean To remove/uninstall autotest, avocado from system
98+
--enable-kvm enable bootstrap kvm tests
99+
--nrunner enable Parallel run
100+
--run-tests RUN_TESTS
101+
To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma]
102+
--config-env CONFIG_PATH
103+
Specify env config path
104+
--config-norun NORUNTEST_PATH
105+
Specify no run tests config path
105106
106107
```
107108

@@ -249,6 +250,17 @@ $ ./avocado-setup.py -h
249250
15. `--enable-kvm`:
250251
> By default kvm(guest VM) tests environment is not bootstrapped, enable this flag to bootstrap KVM (guest VM) tests.
251252
253+
16. `--nrunner`:
254+
> To enable Parallel run through avocado
255+
256+
17. `--run-tests`:
257+
> To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma]
258+
259+
18. `--config-env`:
260+
> Path to a custom environment config file for Avocado setup.
261+
262+
19. `--config-norun`:
263+
> Path to a custom NORUNTEST File path
252264
253265
### Customizing Test Suites:
254266

avocado-setup.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,13 @@
3636
NORUNTEST_PATH = "%s/config/wrapper/no_run_tests.conf" % BASE_PATH
3737
TEST_CONF_PATH = "%s/config/tests/" % BASE_PATH
3838
CONFIGFILE = configparser.ConfigParser()
39-
CONFIGFILE.read(CONFIG_PATH)
4039
NORUNTESTFILE = configparser.ConfigParser()
41-
NORUNTESTFILE.read(NORUNTEST_PATH)
4240
INPUTFILE = configparser.ConfigParser()
4341
INPUTFILE.optionxform = str
44-
BASE_FRAMEWORK = eval(CONFIGFILE.get('framework', 'base'))
45-
KVM_FRAMEWORK = eval(CONFIGFILE.get('framework', 'kvm'))
46-
OPTIONAL_FRAMEWORK = eval(CONFIGFILE.get('framework', 'optional'))
47-
TEST_REPOS = eval(CONFIGFILE.get('tests', 'name'))
4842
TEST_DIR = "%s/tests" % BASE_PATH
4943
DATA_DIR = "%s/data" % BASE_PATH
5044
LOG_DIR = "%s/results" % BASE_PATH
5145
logger = logger_init(filepath=BASE_PATH).getlogger()
52-
prescript_dir = CONFIGFILE.get('script-dir', 'prescriptdir')
53-
postscript_dir = CONFIGFILE.get('script-dir', 'postscriptdir')
5446
args = None
5547
outputdir = ''
5648
pipManager = None
@@ -665,8 +657,44 @@ def parse_test_config(test_config_file, avocado_bin, enable_kvm):
665657
parser.add_argument('--run-tests', dest="run_tests", action='store',
666658
default=None,
667659
help="To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma]")
660+
parser.add_argument('--config-env', dest='CONFIG_PATH',
661+
action='store', default=CONFIG_PATH,
662+
help='Specify env config path')
663+
parser.add_argument('--config-norun', dest='NORUNTEST_PATH',
664+
action='store', default=NORUNTEST_PATH,
665+
help='Specify no run tests config path')
668666

669667
args = parser.parse_args()
668+
669+
if args.CONFIG_PATH:
670+
if os.path.exists(args.CONFIG_PATH):
671+
CONFIGFILE.read(args.CONFIG_PATH)
672+
logger.info(f"Env Config: {args.CONFIG_PATH}")
673+
else:
674+
logger.error(f"Env Config Path: {args.CONFIG_PATH} does not exist")
675+
sys.exit(1)
676+
else:
677+
logger.error(f"Env Config Path: {args.CONFIG_PATH} not defined")
678+
sys.exit(1)
679+
680+
if args.NORUNTEST_PATH:
681+
if os.path.exists(args.NORUNTEST_PATH):
682+
NORUNTESTFILE.read(args.NORUNTEST_PATH)
683+
logger.info(f"No Run Config: {args.NORUNTEST_PATH}")
684+
else:
685+
logger.error(f"No Run Config Path: {args.NORUNTEST_PATH} does not exist")
686+
sys.exit(1)
687+
else:
688+
logger.error(f"No Run Config Path: {args.NORUNTEST_PATH} not defined")
689+
sys.exit(1)
690+
691+
globals() ['BASE_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'base'))
692+
globals() ['KVM_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'kvm'))
693+
globals() ['OPTIONAL_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'optional'))
694+
globals() ['TEST_REPOS'] = eval(CONFIGFILE.get('tests', 'name'))
695+
globals() ['prescript_dir'] = CONFIGFILE.get('script-dir', 'prescriptdir')
696+
globals() ['postscript_dir'] = CONFIGFILE.get('script-dir', 'postscriptdir')
697+
670698
if helper.get_machine_type() == 'pHyp':
671699
args.enable_kvm = False
672700
if args.run_suite:

0 commit comments

Comments
 (0)