Example #1
0
 def setUp(self):
     """
     Setup the test case
     """
     metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL,
                         TEST_DRIVER_FLAVOR)
     self.assertTrue(metadata)
     self.nose = NoseTest(metadata)
     self.assertTrue(self.nose)
Example #2
0
def run():
    """
    Run tests for one or more drivers.  If -b is passed then
    we read driver list from the build bot configuration, otherwise
    we use the current IDK driver.
    @return: If any test fails return false, otherwise true
    """

    opts = parseArgs()
    failure = False

    for metadata in get_metadata(opts):
        app = NoseTest(metadata,
                       testname=opts.testname,
                       suppress_stdout=opts.suppress_stdout,
                       noseargs=opts.noseargs)

        app.report_header()

        if (opts.unit):
            success = app.run_unit()
        elif (opts.integration):
            success = app.run_integration()
        elif (opts.qualification):
            success = app.run_qualification()
        elif (opts.publication):
            success = app.run_publication()
        else:
            success = app.run()

        if (not success): failure = True

    return failure
def run():
    """
    Run tests for one or more drivers.  If -b is passed then
    we read driver list from the build bot configuration, otherwise
    we use the current IDK driver.
    @return: If any test fails return false, otherwise true
    """

    opts = parseArgs()
    failure = False

    for metadata in get_metadata(opts):
        app = NoseTest(metadata, testname=opts.testname, suppress_stdout=opts.suppress_stdout, noseargs=opts.noseargs)

        app.report_header()

        if( opts.unit ):
            success = app.run_unit()
        elif( opts.integration ):
            success = app.run_integration()
        elif( opts.qualification ):
            success = app.run_qualification()
        elif( opts.publication ):
            success = app.run_publication()
        else:
            success = app.run()

        if(not success): failure = True

    return failure
def run_buildbot_qual(opts):
    devices = read_buildbot_config()
    ret = True
    for (key, config) in devices:
        make = config.get(BuildBotConfig.MAKE)
        model = config.get(BuildBotConfig.MODEL)
        flavor = config.get(BuildBotConfig.FLAVOR)
        metadata = Metadata(make, model, flavor)
        app = NoseTest(metadata, testname=opts.testname)
        app.report_header()

        if False == app.run_qualification():
            ret = False
    return ret
Example #5
0
    def run_qualification_tests(self):
        """
        @brief Run all qualification tests for the driver and store the results for packaging
        """
        log.info("-- Running qualification tests")

        test = NoseTest(self.metadata, log_file=self.log_path())
        test.report_header()

        if (test.run_qualification()):
            log.info(" ++ Qualification tests passed")
            return True
        else:
            log.error("Qualification tests have fail!  No package created.")
            return False
    def run_qualification_tests(self):
        """
        @brief Run all qualification tests for the driver and store the results for packaging
        """
        log.info("-- Running qualification tests")

        test = NoseTest(self.metadata, log_file=self.log_path())
        test.report_header()

        if(test.run_qualification()):
            log.info(" ++ Qualification tests passed")
            return True
        else:
            log.error("Qualification tests have fail!  No package created.")
            return False
    def test_nose_with_testname(self):
        """
        Test nose when specifying a specific test name
        """

        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL, TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata, testname='test_autosample')
        self.assertTrue(self.nose)

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class, 'SBEQualificationTestCase')

        self.assertEqual(self.nose._testname, 'test_autosample')

        self.assertEqual(self.nose._unit_test_module_param(),
                         "%s:%s.%s" % (
                         self.nose._driver_test_filename(), self.nose._unit_test_class, 'test_autosample'))

        self.assertEqual(self.nose._int_test_module_param(),
                         "%s:%s.%s" % (self.nose._driver_test_filename(), self.nose._int_test_class, 'test_autosample'))

        self.assertEqual(self.nose._qual_test_module_param(),
                         "%s:%s.%s" % (
                         self.nose._driver_test_filename(), self.nose._qual_test_class, 'test_autosample'))
 def setUp(self):
     """
     Setup the test case
     """
     metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL, TEST_DRIVER_FLAVOR)
     self.assertTrue(metadata)
     self.nose = NoseTest(metadata)
     self.assertTrue(self.nose)
Example #9
0
    def test_nose_with_testname(self):
        '''
        Test nose when specifying a specific test name
        '''

        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL,
                            TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata, testname='test_autosample')
        self.assertTrue(self.nose)

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class,
                         'SBEQualificationTestCase')

        self.assertEqual(self.nose._testname, 'test_autosample')

        self.assertEqual(
            self.nose._unit_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._unit_test_class, 'test_autosample'))

        self.assertEqual(
            self.nose._int_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._int_test_class, 'test_autosample'))

        self.assertEqual(
            self.nose._qual_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._qual_test_class, 'test_autosample'))
class TestNose(MiUnitTest):
    """
    Test the nose_test IDK module
    """

    def setUp(self):
        """
        Setup the test case
        """
        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL, TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata)
        self.assertTrue(self.nose)

    @unittest.skip('Unused. Fix or Remove')
    def test_inspect_module(self):
        """
        Test the _inspect_test_module method to verify it identifies all test classes properly.
        """

        # Positive test.
        self.nose._inspect_driver_module(self.nose._driver_test_module())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class, 'SBEQualificationTestCase')

        # Test Failure, one of the tests is not found.
        with self.assertRaises(IDKException):
            self.nose._inspect_driver_module('unittest')

    @unittest.skip('Unused. Fix or Remove')
    def test_nose(self):
        """
        Verify that we can initialize a NoseTest.  What we really want to see is that we can build the nose test
        command lines properly from a test module.
        """

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class, 'SBEQualificationTestCase')

        self.assertEqual(self.nose._unit_test_module_param(),
                         "%s:%s" % (self.nose._driver_test_filename(), self.nose._unit_test_class))

        self.assertEqual(self.nose._int_test_module_param(),
                         "%s:%s" % (self.nose._driver_test_filename(), self.nose._int_test_class))

        self.assertEqual(self.nose._qual_test_module_param(),
                         "%s:%s" % (self.nose._driver_test_filename(), self.nose._qual_test_class))

        self.assertIsNone(self.nose._testname)

    @unittest.skip('Unused. Fix or Remove')
    def test_nose_with_testname(self):
        """
        Test nose when specifying a specific test name
        """

        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL, TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata, testname='test_autosample')
        self.assertTrue(self.nose)

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class, 'SBEQualificationTestCase')

        self.assertEqual(self.nose._testname, 'test_autosample')

        self.assertEqual(self.nose._unit_test_module_param(),
                         "%s:%s.%s" % (
                         self.nose._driver_test_filename(), self.nose._unit_test_class, 'test_autosample'))

        self.assertEqual(self.nose._int_test_module_param(),
                         "%s:%s.%s" % (self.nose._driver_test_filename(), self.nose._int_test_class, 'test_autosample'))

        self.assertEqual(self.nose._qual_test_module_param(),
                         "%s:%s.%s" % (
                         self.nose._driver_test_filename(), self.nose._qual_test_class, 'test_autosample'))
def run():

    opts = parseArgs()


    if( opts.buildbot ):
        devices = read_buildbot_config()

        for (key, config) in devices:
            make = config.get(BuildBotConfig.MAKE)
            model = config.get(BuildBotConfig.MODEL)
            flavor =config.get(BuildBotConfig.FLAVOR)
            metadata = Metadata(make, model, flavor)
            app = NoseTest(metadata, testname=opts.testname)
            app.report_header()
            app.run_unit()
            app.run_integration()
            app.run_qualification()
    else:
        app = NoseTest(Metadata(), testname=opts.testname)
        if( opts.unit ):
            app.report_header()
            app.run_unit()
        elif( opts.integration ):
            app.report_header()
            app.run_integration()
        elif( opts.qualification ):
            app.report_header()
            app.run_qualification()
        else:
            app.run()
Example #12
0
class TestNose(MiUnitTest):
    """
    Test the nose_test IDK module
    """
    def setUp(self):
        """
        Setup the test case
        """
        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL,
                            TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata)
        self.assertTrue(self.nose)

    def test_inspect_module(self):
        '''
        Test the _inspect_test_module method to verify it identifies all test classes properly.
        '''

        # Positive test.
        self.nose._inspect_driver_module(self.nose._driver_test_module())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class,
                         'SBEQualificationTestCase')

        # Test Failure, one of the tests is not found.
        with self.assertRaises(IDKException):
            self.nose._inspect_driver_module('unittest')

    def test_nose(self):
        '''
        Verify that we can initialize a NoseTest.  What we really want to see is that we can build the nose test
        command lines properly from a test module.
        '''

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class,
                         'SBEQualificationTestCase')

        self.assertEqual(
            self.nose._unit_test_module_param(), "%s:%s" %
            (self.nose._driver_test_filename(), self.nose._unit_test_class))

        self.assertEqual(
            self.nose._int_test_module_param(), "%s:%s" %
            (self.nose._driver_test_filename(), self.nose._int_test_class))

        self.assertEqual(
            self.nose._qual_test_module_param(), "%s:%s" %
            (self.nose._driver_test_filename(), self.nose._qual_test_class))

        self.assertIsNone(self.nose._testname)

    def test_nose_with_testname(self):
        '''
        Test nose when specifying a specific test name
        '''

        metadata = Metadata(TEST_DRIVER_MAKE, TEST_DRIVER_MODEL,
                            TEST_DRIVER_FLAVOR)
        self.assertTrue(metadata)
        self.nose = NoseTest(metadata, testname='test_autosample')
        self.assertTrue(self.nose)

        # Verify we can get the test module name and file
        self.assertEqual(self.nose._driver_test_module(), DRIVER_TEST_MODULE)
        test_file = self.nose._driver_test_module().replace('.', '/') + ".py"

        self.assertTrue(test_file in self.nose._driver_test_filename())

        self.assertEqual(self.nose._unit_test_class, 'SBEUnitTestCase')
        self.assertEqual(self.nose._int_test_class, 'SBEIntTestCase')
        self.assertEqual(self.nose._qual_test_class,
                         'SBEQualificationTestCase')

        self.assertEqual(self.nose._testname, 'test_autosample')

        self.assertEqual(
            self.nose._unit_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._unit_test_class, 'test_autosample'))

        self.assertEqual(
            self.nose._int_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._int_test_class, 'test_autosample'))

        self.assertEqual(
            self.nose._qual_test_module_param(),
            "%s:%s.%s" % (self.nose._driver_test_filename(),
                          self.nose._qual_test_class, 'test_autosample'))
def run():
    opts = parseArgs()
    app = NoseTest(Metadata())

    if( opts.unit ):
        app.report_header()
        app.run_unit()
    elif( opts.integration ):
        app.report_header()
        app.run_integration()
    elif( opts.qualification ):
        app.report_header()
        app.run_qualification()
    else:
        app.run()
Example #14
0
 def get_nose_test(self):
     return NoseTest(self.metadata, log_file=self.log_path())
Example #15
0
def run():

    opts = parseArgs()

    if opts.buildbot_unit:
        return not run_buildbot_unit(opts)

    if opts.buildbot_int:
        return not run_buildbot_int(opts)

    if opts.buildbot_qual:
        return not run_buildbot_qual(opts)

    if opts.buildbot:
        devices = read_buildbot_config()
        ret = True
        for (key, config) in devices:
            make = config.get(BuildBotConfig.MAKE)
            model = config.get(BuildBotConfig.MODEL)
            flavor = config.get(BuildBotConfig.FLAVOR)
            metadata = Metadata(make, model, flavor)
            app = NoseTest(metadata, testname=opts.testname)
            app.report_header()
            if False == app.run_unit():
                ret = False
            if False == app.run_integration():
                ret = False
            if False == app.run_qualification():
                ret = False
        return not ret

    else:
        app = NoseTest(Metadata(), testname=opts.testname)
        if opts.unit:
            app.report_header()
            app.run_unit()
        elif opts.integration:
            app.report_header()
            app.run_integration()
        elif opts.qualification:
            app.report_header()
            app.run_qualification()
        else:
            app.run()