Exemple #1
0
def main():
    """
    test_clients main function.
    """

    # list of callback with its arguments
    callbacks = [(cb_path, ()), (cb_skip_list, ())]

    parser = ArgParse(__doc__, callbacks)
    parser.parse_it()  # parse the command line

    args_list = parser.args if not parser.no_args() else None

    # go and generate the test
    opath = parser.options.opath + '/' if parser.options.opath else ''
    npath = parser.options.npath + '/' if parser.options.npath else ''
    tpath = parser.options.tpath + '/' if parser.options.tpath else ''
    skip_list = parser.options.skip_list if parser.options.skip_list is not None else []
    if parser.options.sanity:
        gen_sanity_tests(npath, tpath, args_list, skip_list)
    elif parser.options.compare:
        gen_tests(opath, npath, tpath, args_list, parser.options.stubo,
                  skip_list)
    else:
        print("Specify Type of Test")
def main():
    """
    test_clients main function.
    """

    # list of callback with its arguments
    callbacks = [(cb_path, ()), (cb_skip_list, ())]

    parser = ArgParse(__doc__,callbacks)
    parser.parse_it() # parse the command line

    args_list  = parser.args if not parser.no_args() else None
    
    # go and generate the test
    opath     = parser.options.opath + '/' if parser.options.opath else ''
    npath     = parser.options.npath + '/' if parser.options.npath else ''
    tpath     = parser.options.tpath + '/' if parser.options.tpath else ''
    skip_list = parser.options.skip_list if parser.options.skip_list is not None else []
    if parser.options.sanity:
        gen_sanity_tests(npath, tpath, args_list, skip_list)
    elif parser.options.compare:
        gen_tests(opath, npath, tpath, args_list, parser. options.stubo, skip_list)
    else:
        print("Specify Type of Test")
Exemple #3
0
def main():
    """
    setup Cobalt Sims
    """
    parser = ArgParse(__doc__)
    parser.parse_it()  # parse the command line

    sysroot = 'sysroot'

    def create_bsim():
        if os.path.exists(parser.options.sim_path):
            if not os.path.isdir(parser.options.sim_path):
                print >> sys.stderr, "Sim path %s exists but not a directory" % \
                    parser.options.sim_path
                sys.exit(1)
        else:
            if os.path.isdir(os.path.dirname(parser.options.sim_path)):
                os.mkdir(parser.options.sim_path)
            else:
                print >> sys.stderr, "Parent %s not a directory" % \
                    os.path.dirname(parser.options.sim_path)
                sys.exit(1)

        os.chdir(parser.options.sim_path)
        curr_dir = os.getcwd()

        cdir = parser.options.cobalt
        crepo = parser.options.repo

        if not parser.options.skip_clone:
            subprocess.call(
                ('git', 'clone', '-b', parser.options.branch, crepo, cdir))

        os.mkdir(sysroot)
        os.mkdir(sysroot + '/etc')
        os.mkdir(sysroot + '/var')
        os.mkdir(sysroot + '/tmp')

        sysroot_etc = '%s/etc/' % sysroot
        local_sim = parser.options.cobalt + '/tools/local_sim/'

        subprocess.call(('cp', '%s/simulator.xml' % local_sim, '.'))
        subprocess.call(('cp', '%s/cstart.sh' % local_sim, '.'))
        subprocess.call(('cp', '%s/cinit.sh' % local_sim, '.'))
        subprocess.call(('cp', '%s/cobalt.key' % local_sim, sysroot_etc))
        subprocess.call(('cp', '%s/cobalt.cert' % local_sim, sysroot_etc))
        subprocess.call(('cp', '%s/cobalt.utility' % local_sim, sysroot_etc))
        subprocess.call(('cp', '%s/test-filter.py' % local_sim, sysroot_etc))
        subprocess.call(
            ('cp', '%s/test-script-fail.py' % local_sim, sysroot_etc))
        subprocess.call(
            ('cp', '%s/test-script-succeed.py' % local_sim, sysroot_etc))

        files = os.listdir(local_sim)

        for _file in files:
            if _file.find('partlist-') != -1 or _file.find('stest-') != -1:
                subprocess.call(('cp', local_sim + '/' + _file, sysroot_etc))

        cobalt_dir = parser.options.cobalt
        subprocess.call(('ln', '-s', 'lib', '%s/src/Cobalt' % cobalt_dir))

        os.chdir(cobalt_dir + '/src/components')
        subprocess.call(
            ('ln', '-s', '../../../simulator.xml', 'simulator.xml'))

        os.chdir(curr_dir)
        fd = open('setup_lsim', 'w')
        fd.write(LSIM.replace('<SIMPATH>', curr_dir))

        subprocess.call(
            ('ln', '-s', curr_dir + '/setup_lsim', curr_dir + '/cobalt_setup'))

        fd.close()
        fd = open('setup_csim', 'w')
        fd.write(CSIM.replace('<SIMPATH>', curr_dir))
        fd.close()
        fd = open('setup_client', 'w')
        fd.write(CLIENT.replace('<SIMPATH>', curr_dir))
        fd.close()
        fd = open('rm_testlinks', 'w')
        fd.write(RM_TESTLINKS.replace('<SIMPATH>', curr_dir))
        fd.close()

    create_bsim()
Exemple #4
0
def main():
    """
    setup Cobalt Sims
    """
    parser = ArgParse(__doc__)
    parser.parse_it()  # parse the command line

    sysroot = "sysroot"

    def create_bsim():
        if os.path.exists(parser.options.sim_path):
            if not os.path.isdir(parser.options.sim_path):
                print >>sys.stderr, "Sim path %s exists but not a directory" % parser.options.sim_path
                sys.exit(1)
        else:
            if os.path.isdir(os.path.dirname(parser.options.sim_path)):
                os.mkdir(parser.options.sim_path)
            else:
                print >>sys.stderr, "Parent %s not a directory" % os.path.dirname(parser.options.sim_path)
                sys.exit(1)

        os.chdir(parser.options.sim_path)
        curr_dir = os.getcwd()

        cdir = parser.options.cobalt
        crepo = parser.options.repo

        if not parser.options.skip_clone:
            subprocess.call(("git", "clone", "-b", parser.options.branch, crepo, cdir))

        os.mkdir(sysroot)
        os.mkdir(sysroot + "/etc")
        os.mkdir(sysroot + "/var")
        os.mkdir(sysroot + "/tmp")

        sysroot_etc = "%s/etc/" % sysroot
        local_sim = parser.options.cobalt + "/tools/local_sim/"

        subprocess.call(("cp", "%s/simulator.xml" % local_sim, "."))
        subprocess.call(("cp", "%s/cstart.sh" % local_sim, "."))
        subprocess.call(("cp", "%s/cinit.sh" % local_sim, "."))
        subprocess.call(("cp", "%s/cobalt.key" % local_sim, sysroot_etc))
        subprocess.call(("cp", "%s/cobalt.cert" % local_sim, sysroot_etc))
        subprocess.call(("cp", "%s/cobalt.utility" % local_sim, sysroot_etc))
        subprocess.call(("cp", "%s/test-filter.py" % local_sim, sysroot_etc))
        subprocess.call(("cp", "%s/test-script-fail.py" % local_sim, sysroot_etc))
        subprocess.call(("cp", "%s/test-script-succeed.py" % local_sim, sysroot_etc))

        files = os.listdir(local_sim)

        for _file in files:
            if _file.find("partlist-") != -1 or _file.find("stest-") != -1:
                subprocess.call(("cp", local_sim + "/" + _file, sysroot_etc))

        cobalt_dir = parser.options.cobalt
        subprocess.call(("ln", "-s", "lib", "%s/src/Cobalt" % cobalt_dir))

        os.chdir(cobalt_dir + "/src/components")
        subprocess.call(("ln", "-s", "../../../simulator.xml", "simulator.xml"))

        os.chdir(curr_dir)
        fd = open("setup_lsim", "w")
        fd.write(LSIM.replace("<SIMPATH>", curr_dir))

        subprocess.call(("ln", "-s", curr_dir + "/setup_lsim", curr_dir + "/cobalt_setup"))

        fd.close()
        fd = open("setup_csim", "w")
        fd.write(CSIM.replace("<SIMPATH>", curr_dir))
        fd.close()
        fd = open("setup_client", "w")
        fd.write(CLIENT.replace("<SIMPATH>", curr_dir))
        fd.close()
        fd = open("rm_testlinks", "w")
        fd.write(RM_TESTLINKS.replace("<SIMPATH>", curr_dir))
        fd.close()

    create_bsim()