diff --git a/README.md b/README.md index 46303060..1b9b12ac 100644 --- a/README.md +++ b/README.md @@ -61,47 +61,48 @@ It is highly recommended for users to execute the following command as root when ``` $ ./avocado-setup.py -h - usage: avocado-setup.py [-h] [--bootstrap] [--run-suite RUN_SUITE] - [--output-dir OUTPUTDIR] [--use-test-dir] - [--input-file INPUTFILE] - [--interval-time INTERVAL] [--verbose] - [--only-filter ONLY_FILTER] [--no-filter NO_FILTER] - [--additional-args ADD_ARGS] [--guest-os GUEST_OS] - [--vt {qemu,libvirt}] [--install] [--no-download] - [--no-deps-check] [--install-deps] [--clean] - [--enable-kvm] - - optional arguments: - -h, --help show this help message and exit - --bootstrap Prepare the environment for test - --run-suite RUN_SUITE + usage: avocado-setup.py [-h] [--bootstrap] [--run-suite RUN_SUITE] [--output-dir OUTPUTDIR] + [--use-test-dir] [--input-file INPUTFILE] [--interval-time INTERVAL] + [--verbose] [--only-filter ONLY_FILTER] [--no-filter NO_FILTER] + [--additional-args ADD_ARGS] [--guest-os GUEST_OS] [--vt {qemu,libvirt}] + [--install] [--no-download] [--no-deps-check] [--install-deps] [--clean] + [--enable-kvm] [--nrunner] [--run-tests RUN_TESTS] [--config-env CONFIG_PATH] + [--config-norun NORUNTEST_PATH] + + options: + -h, --help show this help message and exit + --bootstrap Prepare the environment for test + --run-suite RUN_SUITE Indicate which test suite(s) to run - --output-dir OUTPUTDIR + --output-dir OUTPUTDIR Specify the custom test results directory - --use-test-dir Use corresponding test-name dir for storing job results - --input-file INPUTFILE - Specify input file for custom mux values for host - tests - --interval-time INTERVAL + --use-test-dir Use corresponding test-name dir for storing job results + --input-file INPUTFILE + Specify input file for custom mux values for host tests + --interval-time INTERVAL Specify the interval time between tests - --verbose Enable verbose output on the console - --only-filter ONLY_FILTER - Add filters to include specific avocado tests,features - from the guest test suite - --no-filter NO_FILTER - Add filters to exclude specific avocado tests,features - from the guest test suite - --additional-args ADD_ARGS + --verbose Enable verbose output on the console + --only-filter ONLY_FILTER + Add filters to include specific avocado tests,features from the guest test suite + --no-filter NO_FILTER + Add filters to exclude specific avocado tests,features from the guest test suite + --additional-args ADD_ARGS Pass additional arguments to the command - --guest-os GUEST_OS Provide Guest os: Default: JeOS.27.ppc64le - --vt {qemu,libvirt} Provide VT: qemu or libvirt Default: libvirt - --install Install the Guest VM, if needed. - --no-download To download the preinstalled guest image - --no-deps-check To force wrapper not to check for dependancy packages - --install-deps To force wrapper to install dependancy packages (Only - for Ubuntu, SLES and yum based OS) - --clean To remove/uninstall autotest, avocado from system - --enable-kvm enable bootstrap kvm tests + --guest-os GUEST_OS Provide Guest os: Default: JeOS.27.ppc64le + --vt {qemu,libvirt} Provide VT: qemu or libvirt Default: libvirt + --install Install the Guest VM, if needed. + --no-download To download the preinstalled guest image + --no-deps-check To force wrapper not to check for dependancy packages + --install-deps To force wrapper to install dependancy packages (Only for Ubuntu, SLES and yum based OS) + --clean To remove/uninstall autotest, avocado from system + --enable-kvm enable bootstrap kvm tests + --nrunner enable Parallel run + --run-tests RUN_TESTS + To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma] + --config-env CONFIG_PATH + Specify env config path + --config-norun NORUNTEST_PATH + Specify no run tests config path ``` @@ -249,6 +250,17 @@ $ ./avocado-setup.py -h 15. `--enable-kvm`: > By default kvm(guest VM) tests environment is not bootstrapped, enable this flag to bootstrap KVM (guest VM) tests. +16. `--nrunner`: + > To enable Parallel run through avocado + +17. `--run-tests`: + > To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma] + +18. `--config-env`: + > Path to a custom environment config file for Avocado setup. + +19. `--config-norun`: + > Path to a custom NORUNTEST File path ### Customizing Test Suites: diff --git a/avocado-setup.py b/avocado-setup.py index ebc49c6a..9f82e043 100644 --- a/avocado-setup.py +++ b/avocado-setup.py @@ -36,21 +36,13 @@ NORUNTEST_PATH = "%s/config/wrapper/no_run_tests.conf" % BASE_PATH TEST_CONF_PATH = "%s/config/tests/" % BASE_PATH CONFIGFILE = configparser.ConfigParser() -CONFIGFILE.read(CONFIG_PATH) NORUNTESTFILE = configparser.ConfigParser() -NORUNTESTFILE.read(NORUNTEST_PATH) INPUTFILE = configparser.ConfigParser() INPUTFILE.optionxform = str -BASE_FRAMEWORK = eval(CONFIGFILE.get('framework', 'base')) -KVM_FRAMEWORK = eval(CONFIGFILE.get('framework', 'kvm')) -OPTIONAL_FRAMEWORK = eval(CONFIGFILE.get('framework', 'optional')) -TEST_REPOS = eval(CONFIGFILE.get('tests', 'name')) TEST_DIR = "%s/tests" % BASE_PATH DATA_DIR = "%s/data" % BASE_PATH LOG_DIR = "%s/results" % BASE_PATH logger = logger_init(filepath=BASE_PATH).getlogger() -prescript_dir = CONFIGFILE.get('script-dir', 'prescriptdir') -postscript_dir = CONFIGFILE.get('script-dir', 'postscriptdir') args = None outputdir = '' pipManager = None @@ -665,8 +657,44 @@ def parse_test_config(test_config_file, avocado_bin, enable_kvm): parser.add_argument('--run-tests', dest="run_tests", action='store', default=None, help="To run the host tests provided in the option and publish result [Note: test names(full path) and separated by comma]") + parser.add_argument('--config-env', dest='CONFIG_PATH', + action='store', default=CONFIG_PATH, + help='Specify env config path') + parser.add_argument('--config-norun', dest='NORUNTEST_PATH', + action='store', default=NORUNTEST_PATH, + help='Specify no run tests config path') args = parser.parse_args() + + if args.CONFIG_PATH: + if os.path.exists(args.CONFIG_PATH): + CONFIGFILE.read(args.CONFIG_PATH) + logger.info(f"Env Config: {args.CONFIG_PATH}") + else: + logger.error(f"Env Config Path: {args.CONFIG_PATH} does not exist") + sys.exit(1) + else: + logger.error(f"Env Config Path: {args.CONFIG_PATH} not defined") + sys.exit(1) + + if args.NORUNTEST_PATH: + if os.path.exists(args.NORUNTEST_PATH): + NORUNTESTFILE.read(args.NORUNTEST_PATH) + logger.info(f"No Run Config: {args.NORUNTEST_PATH}") + else: + logger.error(f"No Run Config Path: {args.NORUNTEST_PATH} does not exist") + sys.exit(1) + else: + logger.error(f"No Run Config Path: {args.NORUNTEST_PATH} not defined") + sys.exit(1) + + globals() ['BASE_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'base')) + globals() ['KVM_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'kvm')) + globals() ['OPTIONAL_FRAMEWORK'] = eval(CONFIGFILE.get('framework', 'optional')) + globals() ['TEST_REPOS'] = eval(CONFIGFILE.get('tests', 'name')) + globals() ['prescript_dir'] = CONFIGFILE.get('script-dir', 'prescriptdir') + globals() ['postscript_dir'] = CONFIGFILE.get('script-dir', 'postscriptdir') + if helper.get_machine_type() == 'pHyp': args.enable_kvm = False if args.run_suite: