Exemple #1
0
 def __init__(self, testID=None):
     self.testID = testID
     self.obGraph = NvCSTestGraph()
     self.obCamera = NvCSTestCamera(self.obGraph)
     self.testDir = os.path.join(self.testDir, testID)
     self.logger = nvcstestutils.Logger()
     self.nvrf = nvrawfile.NvRawFile()
Exemple #2
0
def printVersionInformation(logger=None):
    if (logger is None):
        logger = nvcstestutils.Logger()

    # print nvcstest version
    logger.info("nvcstest version: %s" % __version__)

    # print nvcamera module/nvcs version
    logger.info("nvcamera version: %s" % nvcamera.__version__)
Exemple #3
0
def main():

    numFailures = 0
    numTests = 0
    numSkippedTests = 0
    numStagingFailures = 0
    numStagingTests = 0
    numStagingSkippedTests = 0
    RunSuccessStr = ""
    logger = nvcstestutils.Logger()

    # parse arguments
    usage = "\n" \
            "%prog <options> - Run NVCS sanity and conformance test suite \n\n" \
            "Description:\n" \
            "\t NVCS sanity tests consists of a series of simple basic\n" \
            "\t tests to make sure that the nvcs infrastructure, basic\n" \
            "\t odm functionalities, camera core and algorithm paths are\n" \
            "\t functional.\n" \
            "\n \t Conformance tests are more sophisticated and specific\n" \
            "\t setup is required. Each test is designed to catch issues\n" \
            "\t which have been seen by camera team while working on\n" \
            "\t different customer devices. NVCS sanity test suite needs\n" \
            "\t to pass in order to run conformance test suite."

    standard_options = [
        make_option('-v',
                    '--version',
                    dest='version',
                    default=False,
                    action="store_true",
                    help='Display version information'),
        make_option('-l',
                    '--list',
                    dest='listTestNames',
                    default=False,
                    action="store_true",
                    help='Display list of sanity and conformance test names'),
        make_option(
            '-s',
            dest='sanity',
            default=False,
            action="store_true",
            help=
            'Run NVCS sanity tests. If no -i option is specified, the command will'
            + ' run using default imager id 0. Use -l option to look at the' +
            ' list of sanity tests'),
        make_option(
            '-c',
            dest='conformance',
            default=False,
            action="store_true",
            help='Run Conformance tests. Use -l option to look at the' +
            ' list of conformance tests'),
        make_option(
            '--classic',
            dest='useClassicRanges',
            default=False,
            action="store_true",
            help='Do not query sensor for gain and exposure range.' +
            'This option is only supported for \"linearity\" test at present'),
        make_option(
            '-t',
            dest='test_names',
            default=None,
            type="string",
            action="append",
            metavar="TEST_NAME",
            help=
            "Execute the specified test name. Multiple -t options are allowed to execute"
            + "more than one tests using a single command\n" + "example:\n" +
            "1) Command to run \"jpeg_capture\" test for imager id 0:\n" +
            "   python %s -t jpeg_capture -i 0\n" % sys.argv[0] +
            "2) Command to run multiple tests \"jpeg_capture\" and \n" +
            "  \"focuspos\" for imager id 0 using same command:\n" +
            "   python %s -t jpeg_capture -t focuspos -i 0" % sys.argv[0]),
        make_option('--width',
                    dest='width',
                    default=0,
                    type="int",
                    help='set width of the jpeg capture\n' +
                    'currently only "jpeg_capture" test supports this'),
        make_option('--height',
                    dest='height',
                    default=0,
                    type="int",
                    help='set height of the jpeg capture\n' +
                    'currently only "jpeg_capture" test supports this'),
        make_option('--fdelay',
                    dest='fdelay',
                    default=0,
                    type="float",
                    help='set delay for focuser to converge\n' +
                    'currently only "jpeg_capture" test supports this'),
        make_option(
            '-d',
            dest='disabled_test_names',
            default=None,
            type="string",
            action="append",
            metavar="TEST_NAME",
            help=
            'Disables the test. The test name specified as an argument will not'
            + ' execute. Multiple -d options are supported'),
        make_option(
            '-i',
            dest='imager_id',
            default=0,
            type="int",
            metavar="IMAGER_ID",
            help="set imager id. Most of the time imager id 0 is assigned for\n"
            + "rear facing and imager id 1 is assigned for front facing\n" +
            "camera sensor, but this might not be the case always\n" +
            "example:\n" +
            "- Command to run sanity test suite with imager id 1\n" +
            "  python %s -s -i 1" % sys.argv[0]),
        make_option('--nofocus',
                    dest='ignoreFocuser',
                    default=False,
                    action="store_true",
                    help='Ignore ALL focuser commands in the test'),
        make_option('-f',
                    dest='force',
                    default=False,
                    action="store_true",
                    help='run the tests without any prompts',
                    metavar="FORCE"),
        make_option('--overridesdir',
                    dest='overridesDir',
                    default='/data',
                    type="string",
                    metavar=" ",
                    help='Set Directory for used to set Camera Overrides'),
        make_option(
            '--overridesname',
            dest='overridesName',
            default='camera_overrides',
            type="string",
            metavar=" ",
            help="Set the Name of the file used to set Camera Overrides\n" +
            "Note: Should not include the assumed \'.isp\' extension"),
        make_option('-h',
                    '-?',
                    '--help',
                    dest='help',
                    action='store_true',
                    default=False,
                    help='print this help message')
    ]
    advanced_options = [
        make_option(
            '--nv',
            dest='advanced',
            action='store_true',
            default=False,
            help='Enable advanced options.' +
            ' This will enable options for advanced testing and debugging of tests'
        ),
        make_option(
            '-n',
            dest='numTimes',
            default=0,
            type="int",
            help='Set number of times the test should run.' +
            ' Currently only \"blacklevel\" and \"linearity\" test supports this option'
        ),
        make_option(
            '--nostaging',
            dest='stagingOff',
            default=False,
            action="store_true",
            help=
            'Do not run any of the staging tests in sanity or conformance suite'
            +
            ' Staging tests are ran to provide information internally to qualify new tests'
        ),
        make_option('--noshuffle',
                    dest='noShuffle',
                    action='store_true',
                    default=False,
                    help='Do not shuffle capture order' +
                    ' Currently only \"linearity\" test supports this option'),
        make_option('--eL',
                    dest='exposureLow',
                    default=0,
                    type="float",
                    help='Set minimum exposure for linearity3'),
        make_option('--eH',
                    dest='exposureHigh',
                    default=0,
                    type="float",
                    help='Set maximum expsoure for linearity3.'),
        make_option(
            '--threshold',
            dest='threshold',
            default=0,
            type="float",
            help='Set threshold for test (float).' +
            ' Currently only \"blacklevel\" test supports this option and it sets'
            +
            ' threshold for difference between the maximum and minimum black level'
            + ' variance'),
        make_option('--width',
                    dest='width',
                    default=2592,
                    type="int",
                    help='Set width for host sensor mode' +
                    ' Default width used by host sensor mode is 2592'),
        make_option('--height',
                    dest='height',
                    default=1944,
                    type="int",
                    help='Set height for host sensor mode' +
                    ' Default height used by host sensor mode is 1944'),
        make_option(
            '--gain',
            dest='utilGain',
            default=0,
            type="float",
            help='Set the gain for the capture.' +
            ' Currently only the \"hdr_ratio\" test supports this option'),
        make_option(
            '--exposure',
            dest='utilExposure',
            default=0,
            type="float",
            help='Set the exposure for the capture.' +
            ' Currently only the \"hdr_ratio\" test supports this option'),
    ]

    parser = OptionParser(
        usage,
        option_list=standard_options + advanced_options,
        add_help_option=False,
        formatter=nvcstestutils.IndentedHelpFormatterWithNL())

    # make a standard option for error checking if --nv is not specified
    standard_parser = OptionParser(
        usage,
        option_list=standard_options,
        add_help_option=False,
        formatter=nvcstestutils.IndentedHelpFormatterWithNL())

    # parse the command line arguments
    (test_options, args) = parser.parse_args()

    # parse the standard command line argument of the --nv is not present
    if (not test_options.advanced):
        (options, test_args) = standard_parser.parse_args()

    if (test_options.help):
        if (test_options.advanced):
            # print help message with advanced options
            parser.print_help()
        else:
            # print help message wihtout advanced options
            standard_parser.print_help()
        sys.exit(0)

    if (test_options.listTestNames):
        # print test names

        # print sanity test names
        print "SANITY TEST NAMES:"
        for sanity_test in TestFactory.sanityNameList:
            print "\t%s" % sanity_test

        # print sanity staging test names
        print "SANITY STAGING TEST NAMES:"
        for staging_test in TestFactory.sanityStagingNameList:
            print "\t%s" % staging_test

        print ""

        # print conformance test names
        print "CONFORMANCE TEST NAMES:"
        for conformance_test in TestFactory.conformanceNameList:
            print "\t%s" % conformance_test

        # print conformance staging test names
        print "CONFORMANCE STAGING TEST NAMES:"
        for staging_test in TestFactory.conformanceStagingNameList:
            print "\t%s" % staging_test

        print ""

        sys.exit(0)

    # print version infortion
    nvcstest.printVersionInformation(logger)

    if (test_options.version):
        # Already printed version in previous statement
        sys.exit(0)

    stagingNamesList = []
    testNamesList = []
    if (test_options.sanity):
        testNamesList = TestFactory.sanityNameList
        stagingNamesList = TestFactory.sanityStagingNameList

    elif (test_options.conformance):
        testNamesList = TestFactory.conformanceNameList
        stagingNamesList = TestFactory.conformanceStagingNameList

    elif (test_options.test_names != None):
        testNamesList = test_options.test_names

    __validateTestNames(testNamesList)

    # create a dictionary for disabled test names
    if (test_options.disabled_test_names != None):
        for testName in test_options.disabled_test_names:
            # get the test object
            if (TestFactory.hasTest(testName)):
                TestFactory.disableTest(testName)

    logger.info("Imager ID: %d" % test_options.imager_id)
    if (test_options.stagingOff == False):
        for testName in stagingNamesList:
            # get the test object
            try:
                # if the test is enabled, execute the test
                if (TestFactory.isEnabled(testName)):
                    numStagingTests = numStagingTests + 1

                    testOb = TestFactory.getTestObject(testName, test_options,
                                                       logger)
                    retVal = testOb.run()

                    if (retVal == nvcstest.NvCSTestResult.SUCCESS):
                        logger.info("STAGE TEST RESULT: PASS\n")
                    elif (retVal == nvcstest.NvCSTestResult.SKIPPED):
                        logger.info("STAGE RESULT: SKIP\n")
                        numStagingSkippedTests = numStagingSkippedTests + 1
                    else:
                        logger.info("STAGE RESULT: FAIL\n")
                        numStagingFailures = numStagingFailures + 1

            except Exception, err:
                print err
                numStagingFailures = numStagingFailures + 1
 def __init__(self, graphType=GraphType.JPEG):
     self.graphType = graphType
     self._obGraph = nvcamera.Graph()
     self._state = GraphState.CLOSED
     self.logger = nvcstestutils.Logger()
 def __init__(self, obGraph):
     if(obGraph == None):
         raise ValueError("Graph is not open")
     self._obGraph = obGraph
     self._obCamera = nvcamera.Camera()
     self.logger = nvcstestutils.Logger()
Exemple #6
0
def main():

    numFailures = 0
    numTests = 0
    numSkippedTests = 0

    logger = nvcstestutils.Logger()

    # parse arguments
    usage = "Usage: %prog <options>"

    options = [
        make_option('-s',
                    dest='sanity',
                    default=False,
                    action="store_true",
                    help='Run Sanity tests'),
        make_option('--odm',
                    dest='odm_conformance',
                    default=False,
                    action="store_true",
                    help='Run ODM Conformance tests'),
        make_option('-t',
                    dest='test_names',
                    default=None,
                    type="string",
                    action="append",
                    help='Test name to execute',
                    metavar="TEST_NAME"),
        make_option('-d',
                    dest='disabled_test_names',
                    default=None,
                    type="string",
                    action="append",
                    help='Disable the test',
                    metavar="TEST_NAME"),
        make_option(
            '-i',
            dest='imager_id',
            default=0,
            type="int",
            help='set imager id. 0 for rear facing, 1 for front facing',
            metavar="IMAGER_ID"),
        make_option('-f',
                    dest='force',
                    default=False,
                    action="store_true",
                    help='run the tests without any prompts',
                    metavar="FORCE")
    ]

    options_parser = OptionParser(usage, option_list=options)

    # parse the command line arguments
    (test_options, args) = options_parser.parse_args()

    # print version infortion
    nvcstest.printVersionInformation()

    testNamesList = []
    if (test_options.sanity):
        testNamesList = [
            "jpeg_capture", "raw_capture", "concurrent_raw", "exposuretime",
            "gain", "focuspos"
        ]

    elif (test_options.odm_conformance):
        testNamesList = ["linearity"]

    elif (test_options.test_names != None):
        testNamesList = test_options.test_names

    __validateTestNames(testNamesList)

    # create a dictionary for disabled test names
    if (test_options.disabled_test_names != None):
        for testName in test_options.disabled_test_names:
            # get the test object
            if (TestFactory.hasTest(testName)):
                TestFactory.disableTest(testName)

    logger.info("Imager ID: %d" % test_options.imager_id)
    for testName in testNamesList:
        # get the test object
        try:
            # if the test is enabled, execute the test
            if (TestFactory.isEnabled(testName)):
                numTests = numTests + 1

                testOb = TestFactory.getTestObject(testName, test_options)
                retVal = testOb.run()

                if (retVal == nvcstest.NvCSTestResult.SUCCESS):
                    logger.info("RESULT: PASS\n")
                elif (retVal == nvcstest.NvCSTestResult.SKIPPED):
                    logger.info("RESULT: SKIP\n")
                    numSkippedTests = numSkippedTests + 1
                else:
                    logger.info("RESULT: FAIL\n")
                    numFailures = numFailures + 1

        except Exception, err:
            print err
            numFailures = numFailures + 1
            logger.info("RESULT: FAIL\n")