Merge "Open storperf testcase to huawei-pod2"
[yardstick.git] / yardstick / benchmark / core / testsuite.py
1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 """ Handler for yardstick command 'testcase' """
11 from __future__ import absolute_import
12 from __future__ import print_function
13
14 import os
15 import logging
16
17 from yardstick.common import constants as consts
18
19 LOG = logging.getLogger(__name__)
20
21
22 class Testsuite(object):
23     """Testcase commands.
24
25        Set of commands to discover and display test cases.
26     """
27
28     def list_all(self, args):
29         """List existing test cases"""
30
31         testsuite_list = self._get_testsuite_file_list()
32
33         return testsuite_list
34
35     def _get_testsuite_file_list(self):
36         try:
37             testsuite_files = sorted(os.listdir(consts.TESTSUITE_DIR))
38         except OSError:
39             LOG.exception('Failed to list dir:\n%s\n', consts.TESTSUITE_DIR)
40             raise
41
42         return testsuite_files